html, body {
  margin: 0;
  height: 100%;
  background: #050b18;
  color: #dce6f7;
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Noto Sans JP", "Verdana", "Arial", system-ui, -apple-system, sans-serif;
  font-size: 13px;
  line-height: 1.5;
}

button, input, th, td { font-family: inherit; }

#game-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  background: #000;
  outline: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.touch-bar {
  display: none;
  position: fixed;
  top: max(8px, env(safe-area-inset-top));
  right: max(8px, env(safe-area-inset-right));
  z-index: 5;
  gap: 5px;
  padding: 4px;
  background: rgba(7, 17, 40, .62);
  border: 1px solid rgba(118, 178, 242, .35);
  border-radius: 6px;
  opacity: .55;
  transition: opacity .15s;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
.touch-bar:active { opacity: 1; }
.touch-bar button {
  font-size: 11px;
  letter-spacing: .02em;
  padding: 5px 8px;
  min-height: 28px;
  border-radius: 4px;
}
.touch-bar.collapsed button:not(#touch-toggle) { display: none; }
#touch-toggle { min-width: 28px; padding: 5px 6px; }
@media (hover: none) and (pointer: coarse) {
  .touch-bar.active { display: flex; align-items: center; }
}

#launcher {
  position: fixed;
  inset: 0;
  z-index: 10;
  overflow: auto;
  padding: 20px 24px 36px;
  background:
    radial-gradient(ellipse at 65% 15%, rgba(32, 82, 160, .45), rgba(10, 24, 56, .25) 48%, transparent 75%),
    linear-gradient(180deg, #071229, #050d1e 55%, #030712);
}

#launcher.fade-out { opacity: 0; pointer-events: none; }
.hidden { display: none !important; }
html.boot table.layout { visibility: hidden; }

table.layout {
  width: 740px;
  max-width: 100%;
  border-collapse: separate;
  border-spacing: 10px;
  border-left: 1px solid rgba(92, 188, 255, .55);
  padding-left: 10px;
}

.banner {
  background: linear-gradient(180deg, rgba(16, 40, 86, .78), rgba(8, 20, 48, .86));
  border: 1px solid rgba(118, 178, 242, .38);
  padding: 10px 14px;
}

.brand { display: flex; align-items: center; gap: 12px; }
.logo { display: block; flex: none; }
.banner h1 { margin: 0; font-size: 20px; font-weight: normal; letter-spacing: .06em; color: #f4f8ff; }
.banner .sub { margin-top: 2px; font-size: 12px; color: #96c4f4; }

td.sidebar { width: 185px; vertical-align: top; }
td.content { vertical-align: top; }

table.panel {
  width: 100%;
  margin-bottom: 10px;
  border: 1px solid rgba(112, 168, 232, .3);
  background: rgba(7, 17, 40, .72);
  border-collapse: collapse;
}

table.panel th {
  text-align: left;
  background: linear-gradient(90deg, rgba(28, 72, 142, .55), rgba(12, 30, 68, .45));
  color: #eaf3ff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: 5px 9px;
  border-bottom: 1px solid rgba(112, 168, 232, .32);
}

table.panel td { padding: 8px 10px; }
td.side-body { padding: 7px 9px; font-size: 12px; background: rgba(6, 14, 34, .65); }
.side-body div { margin-bottom: 2px; }
.side-body b { color: #82c6ff; font-weight: 600; }
.controls { font-size: 11.5px; line-height: 1.45; color: #c2d4f0; }
.controls div { margin-bottom: 0; }
.side-links { line-height: 1.7; }

hr { border: 0; border-top: 1px solid rgba(112, 168, 232, .22); margin: 7px 0; }
p { margin: 0 0 8px; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11.5px; color: #a4d8ff; }

.req-files, .status-box {
  padding: 6px 8px;
  border: 1px solid rgba(112, 168, 232, .25);
  background: rgba(4, 10, 24, .7);
}
.req-files { font-size: 11.5px; line-height: 1.65; }
.status-box { margin-top: 8px; font-size: 12px; }
.status-box.err { border-color: rgba(235, 96, 96, .65); background: rgba(42, 12, 18, .65); }
.badge { font-weight: bold; margin-right: 4px; color: #ff8c8c; }
.badge::before { content: "["; }
.badge::after { content: "]"; }
.folder { font-weight: bold; color: #f0d48a; margin-right: 4px; }
.missing-list { margin: 5px 0 0; padding-left: 18px; max-height: 110px; overflow-y: auto; color: #ff9c9c; }
.loading-row { margin-top: 8px; font-size: 12px; color: #8ad4ff; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; }

button {
  font-size: 12px;
  letter-spacing: .04em;
  padding: 6px 14px;
  color: #dceaff;
  background: linear-gradient(180deg, rgba(16, 38, 82, .85), rgba(9, 22, 50, .92));
  border: 1px solid rgba(130, 185, 245, .45);
  cursor: pointer;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
button:hover:not(:disabled), #btn-start:not(:disabled) {
  color: #fff;
  background: linear-gradient(180deg, rgba(44, 112, 204, .88), rgba(22, 66, 136, .95));
  border-color: #7fd2ff;
  box-shadow: 0 0 11px rgba(78, 168, 255, .38);
}
#btn-start:not(:disabled) { font-weight: 600; }
#btn-start:hover:not(:disabled) {
  background: linear-gradient(180deg, rgba(64, 136, 228, .95), rgba(30, 84, 164, .98));
  border-color: #b4e8ff;
}
button:active:not(:disabled) { background: rgba(20, 56, 116, .95); }
button:disabled { color: rgba(160, 182, 215, .4); background: rgba(8, 18, 40, .5); border-color: rgba(112, 168, 232, .18); cursor: not-allowed; }

.panel ul { margin: 0; padding-left: 18px; font-size: 12px; color: #b8cae6; }
.panel li { margin-bottom: 3px; }
.downloads { font-size: 12px; color: #b8cae6; }
.dl-links { padding-left: 12px; margin-top: 2px; }
.dl-item { color: #7c98c2; cursor: default; }
.dl-note { margin-left: 6px; font-size: 11.5px; color: #7c98c2; }
.footer { margin-top: 4px; font-size: 11.5px; color: #7c98c2; }

a { color: #7ec8ff; text-decoration: none; border-bottom: 1px solid rgba(126, 200, 255, .35); }
a:visited { color: #9ec0ff; }
a:hover { color: #fff; border-bottom-color: #fff; }

@media (max-width: 640px) {
  #launcher {
    padding: max(12px, env(safe-area-inset-top)) 12px calc(24px + env(safe-area-inset-bottom));
  }
  table.layout {
    width: 100%;
    border-spacing: 0;
    padding-left: 8px;
  }
  table.layout, table.layout > tbody {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  table.layout > tbody > tr, td.sidebar, td.content { display: contents; }
  table.panel { margin-bottom: 0; }
  .banner { order: 1; padding: 10px 12px; }
  .banner h1 { font-size: 18px; }
  .logo { width: 48px; height: 48px; }
  .panel-dir { order: 2; }
  .panel-status { order: 3; }
  .panel-notes { order: 4; }
  .panel-downloads { order: 5; }
  .panel-controls { order: 6; }
  .footer { order: 7; }
  .req-files { overflow-wrap: anywhere; }
  .actions button { flex: 1 1 100%; min-height: 40px; }
  .controls { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; }
}
