/* 달까지 냥냥 · 달 탐사 관제실 테마
   관제실 콘솔(회녹색 철판), 주 화면(녹색 형광 모니터), 기록 용지(그린바 연속 용지),
   라벨 테이프, 표시등 단추로 화면을 짠다. */

:root {
  --paint: #4e5a53;        /* 콘솔 철판 */
  --paint-face: #58655d;   /* 계기판 덮개 */
  --paint-deep: #343d38;   /* 모니터 테두리, 책상 */
  --ink-dark: #151816;     /* 라벨 테이프, 단추 테두리 */
  --text: #f4f1e6;
  --text-soft: #cfd8cf;
  --crt: #0b1712;          /* 모니터 바탕 */
  --phosphor: #9ef0b0;     /* 모니터 글자 */
  --phosphor-dim: #74c48a;
  --paper: #f3f0e2;
  --paper-band: #dcebd5;
  --paper-ink: #1d2420;
  --paper-ink-soft: #4b544e;
  --red-ink: #a3242b;
  --amber: #f5b23a;
  --green: #6fd08c;
  --pink: #f48fb7;

  --font-display: 'Orbit', 'Gothic A1', sans-serif;
  --font-body: 'Gothic A1', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  --font-data: 'Nanum Gothic Coding', ui-monospace, monospace;

  color-scheme: dark;
  scrollbar-color: var(--paint-deep) var(--paint);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  word-break: keep-all;
  overflow-wrap: break-word;
  color: var(--text);
  background-color: var(--paint);
}

::selection {
  background: var(--pink);
  color: var(--ink-dark);
}

h1,
h2,
p {
  margin: 0;
}

button {
  font: inherit;
  cursor: pointer;
}

:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 3px;
}

/* ---------- 관제실 윗판 ---------- */

.masthead {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "patch title status";
  align-items: center;
  column-gap: 20px;
  padding: 14px max(32px, calc((100% - 1320px) / 2 + 32px));
  background: var(--paint-deep);
  border-bottom: 2px solid #66736b;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.25);
}

.patch {
  grid-area: patch;
  width: 76px;
  height: 76px;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.4));
}

.patch-ring-text {
  font-family: var(--font-data);
  font-weight: 700;
  font-size: 10.5px;
  letter-spacing: 0.06em;
  fill: #e9e3cf;
}

.title-block {
  grid-area: title;
  min-width: 0;
}

.title-block h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 44px;
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: var(--text);
}

.title-block p {
  margin-top: 4px;
  font-size: 15px;
  color: var(--text-soft);
}

/* 임무 상태 표시등: 게임 상태에 맞는 문구 하나만 보인다 */
.mission-status {
  grid-area: status;
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
}

.lamp {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: inset 0 -2px 2px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.5);
}

.state {
  display: none;
  padding: 7px 14px;
  border: 2px solid var(--ink-dark);
  border-radius: 4px;
  font-weight: 800;
  font-size: 15px;
  line-height: 1.3;
  color: #2a1a00;
  background: var(--amber) linear-gradient(to bottom, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0) 55%);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

body:not(:has(#initials-dialog[open])):not(:has(#game-start[hidden])) .state-standby,
body:not(:has(#initials-dialog[open])):has(#game-start[hidden]):has(#game-status:not([hidden])) .state-loading,
body:not(:has(#initials-dialog[open])):has(#game-start[hidden]):has(#game-status[hidden]) .state-flight,
body:has(#initials-dialog[open]) .state-record {
  display: inline-block;
}

.state-flight {
  color: #0f2416;
  background-color: var(--green);
}

.state-record {
  color: #3a0f22;
  background-color: var(--pink);
}

body:has(#game-start[hidden]):has(#game-status[hidden]) .lamp {
  background: var(--green);
  animation: lamp-blink 1.6s steps(2, jump-none) infinite;
}

body:has(#initials-dialog[open]) .lamp {
  background: var(--pink);
}

@keyframes lamp-blink {
  50% {
    opacity: 0.35;
  }
}

/* ---------- 관제 콘솔: 개요, 주 화면, 고도 기록판 ---------- */

.console {
  max-width: 1320px;
  margin: 32px auto 0;
  padding: 0 32px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  grid-template-areas: "brief monitor record";
  gap: 32px;
  align-items: start;
}

.monitor-bay {
  grid-area: monitor;
}

.brief-bay {
  grid-area: brief;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.record-bay {
  grid-area: record;
}

/* 라벨 테이프: 검은 테이프에 눌러 찍은 흰 글자 */
.tape {
  display: inline-block;
  margin-bottom: 14px;
  padding: 5px 12px 4px;
  font-family: var(--font-data);
  font-weight: 700;
  font-size: 15px;
  line-height: 1.4;
  letter-spacing: 0.12em;
  color: var(--text);
  background: linear-gradient(to bottom, #222622, #111311);
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.9), 0 1px 0 rgba(255, 255, 255, 0.14);
  transform: rotate(-0.8deg);
}

.record-bay .tape {
  transform: rotate(0.6deg);
}

/* ---------- 주 화면 ---------- */

.monitor {
  display: flex;
  gap: 12px;
  padding: 14px;
  background: var(--paint-deep);
  border-radius: 10px;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.07),
    inset 0 -3px 0 rgba(0, 0, 0, 0.25),
    0 12px 26px rgba(0, 0, 0, 0.35);
}

/* 고도 눈금: 지상에서 달까지. 게임이 도는 동안 고양이 표시가 오르내린다. */
.altimeter {
  position: relative;
  width: 58px;
  flex: none;
}

/* 눈금은 오른쪽 띠에만 새긴다. 글자 밑에는 깔리지 않는다. */
.altimeter::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 6px;
  width: 18px;
  background:
    repeating-linear-gradient(to top, var(--text-soft) 0 2px, transparent 2px 70px) right 0 bottom 0 / 18px 100% no-repeat,
    repeating-linear-gradient(to top, rgba(207, 216, 207, 0.6) 0 1px, transparent 1px 14px) right 0 bottom 0 / 10px 100% no-repeat;
}

.alt-mark {
  position: absolute;
  left: 6px;
  font-family: var(--font-data);
  font-weight: 700;
  font-size: 12px;
  line-height: 1.2;
  color: var(--text-soft);
}

.alt-moon {
  top: 8px;
  color: #f4e3a1;
}

.alt-cloud {
  top: 50%;
}

.alt-ground {
  bottom: 10px;
}

.alt-cat {
  position: absolute;
  left: 8px;
  bottom: 34px;
  width: 26px;
  height: 30px;
}

body:has(#game-start[hidden]):has(#game-status[hidden]) .alt-cat {
  animation: cat-climb 9s cubic-bezier(0.16, 1, 0.3, 1) infinite alternate;
}

@keyframes cat-climb {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(-420%);
  }
}

#game-slot {
  position: relative;
  width: min(400px, max(240px, calc((100svh - 232px) * 9 / 16)));
  aspect-ratio: 9 / 16;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 6px;
  background:
    repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0.22) 0 1px, transparent 1px 3px),
    url("plot.svg") center / cover no-repeat,
    radial-gradient(ellipse at 50% 45%, #13261d, var(--crt) 70%);
  box-shadow: inset 0 0 0 2px #070b09, inset 0 0 48px rgba(0, 0, 0, 0.65);
}

/* 게임 화면은 게임 자리를 꽉 채운다.
   손가락 동작은 canvas 안에서만 게임이 받고, 페이지의 스크롤과 확대는 그대로 둔다. */
#game-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

/* 발사 단추: 불이 들어온 사각 표시등 단추 */
#game-start {
  position: relative;
  display: grid;
  place-items: center;
  gap: 2px;
  width: 172px;
  min-height: 132px;
  padding: 14px 10px;
  color: #2a1a00;
  background: var(--amber) linear-gradient(to bottom, rgba(255, 255, 255, 0.32), rgba(255, 255, 255, 0) 50%);
  border: 4px solid var(--ink-dark);
  border-radius: 6px;
  box-shadow: 0 0 0 7px var(--paint-deep), 0 0 0 9px #66736b, 0 12px 22px rgba(0, 0, 0, 0.6);
  transition: transform 120ms cubic-bezier(0.16, 1, 0.3, 1), filter 160ms ease-out;
}

/* 게임이 켜지면 app.js 가 hidden 을 붙인다. 위의 display 가 hidden 을 덮지 않게 한다. */
#game-start[hidden] {
  display: none;
}

#game-start:hover {
  filter: brightness(1.08);
}

#game-start:active {
  transform: translateY(3px);
}

#game-start:focus-visible {
  outline: 3px solid var(--text);
  outline-offset: 13px;
}

.launch-word {
  font-family: var(--font-display);
  font-size: 44px;
  line-height: 1;
}

.launch-sub {
  font-weight: 800;
  font-size: 15px;
  line-height: 1.2;
}

/* 불러오는 중, 실패 안내: 모니터에 찍힌 글자 */
.slot-label {
  position: relative;
  margin: 0 20px;
  padding: 12px 16px;
  font-family: var(--font-data);
  font-size: 15px;
  line-height: 1.5;
  text-align: center;
  color: var(--phosphor);
  background: rgba(11, 23, 18, 0.92);
  border: 1px solid var(--phosphor-dim);
  border-radius: 2px;
}

/* ---------- 계기판 덮개: 임무 개요, 조종법 ---------- */

.panel {
  padding: 18px 22px 22px;
  border-radius: 8px;
  background:
    radial-gradient(circle, #2c332f 0 2.5px, rgba(255, 255, 255, 0.18) 3px, transparent 3.6px) 0 0 / 22px 22px no-repeat,
    radial-gradient(circle, #2c332f 0 2.5px, rgba(255, 255, 255, 0.18) 3px, transparent 3.6px) 100% 0 / 22px 22px no-repeat,
    radial-gradient(circle, #2c332f 0 2.5px, rgba(255, 255, 255, 0.18) 3px, transparent 3.6px) 0 100% / 22px 22px no-repeat,
    radial-gradient(circle, #2c332f 0 2.5px, rgba(255, 255, 255, 0.18) 3px, transparent 3.6px) 100% 100% / 22px 22px no-repeat,
    var(--paint-face);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 -2px 0 rgba(0, 0, 0, 0.18),
    0 4px 10px rgba(0, 0, 0, 0.22);
}

.panel p {
  max-width: 34em;
  text-wrap: pretty;
}

.controls {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 14px;
}

.controls li {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  font-size: 15px;
  line-height: 1.45;
}

.keys {
  display: flex;
  gap: 8px;
}

kbd {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 40px;
  color: var(--paper-ink);
  background: linear-gradient(to bottom, #ece6d2, #cfc8b2);
  border-radius: 6px;
  border-bottom: 4px solid #8e8875;
  box-shadow: 0 5px 8px rgba(0, 0, 0, 0.3);
}

kbd svg {
  width: 20px;
  height: 20px;
}

.phone {
  width: 34px;
  height: 44px;
}

/* ---------- 임무 제원: 금속 명판 ---------- */

.plate {
  padding: 18px 22px 20px;
  color: var(--paper-ink);
  border: 1px solid #8d918a;
  border-radius: 4px;
  background:
    radial-gradient(circle, #8d918a 0 2px, #f2f3ee 2.6px, transparent 3.2px) 0 0 / 20px 20px no-repeat,
    radial-gradient(circle, #8d918a 0 2px, #f2f3ee 2.6px, transparent 3.2px) 100% 0 / 20px 20px no-repeat,
    radial-gradient(circle, #8d918a 0 2px, #f2f3ee 2.6px, transparent 3.2px) 0 100% / 20px 20px no-repeat,
    radial-gradient(circle, #8d918a 0 2px, #f2f3ee 2.6px, transparent 3.2px) 100% 100% / 20px 20px no-repeat,
    linear-gradient(to bottom, #d5d7d0, #babdb5);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 4px 10px rgba(0, 0, 0, 0.3);
}

.plate-title {
  padding-bottom: 8px;
  margin-bottom: 14px;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.06em;
  border-bottom: 2px solid var(--paper-ink);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.55);
}

.info {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 18px;
}

.info dt {
  font-size: 13px;
  font-weight: 600;
  color: var(--paper-ink);
}

.info dd {
  margin: 2px 0 0;
  font-weight: 800;
  font-size: 18px;
  line-height: 1.3;
}

/* ---------- 고도 기록판: 그린바 연속 용지 ---------- */

.printout {
  position: relative;
  padding: 18px 40px 28px;
  color: var(--paper-ink);
  background:
    radial-gradient(circle, var(--paint) 0 4px, rgba(0, 0, 0, 0.18) 4.5px, transparent 5px) 0 6px / 26px 24px repeat-y,
    radial-gradient(circle, var(--paint) 0 4px, rgba(0, 0, 0, 0.18) 4.5px, transparent 5px) 100% 6px / 26px 24px repeat-y,
    linear-gradient(to right, transparent 26px, rgba(29, 36, 32, 0.22) 26px 27px, transparent 27px calc(100% - 27px), rgba(29, 36, 32, 0.22) calc(100% - 27px) calc(100% - 26px), transparent calc(100% - 26px)),
    var(--paper);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.35);
}

.printout-head {
  padding-bottom: 10px;
  font-family: var(--font-data);
  font-size: 14px;
  line-height: 1.55;
  border-bottom: 1px dashed var(--paper-ink-soft);
}

.printout-head p:first-child {
  font-weight: 700;
  font-size: 16px;
}

.printout-cols,
.scores li {
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr) auto;
  align-items: baseline;
  column-gap: 10px;
}

.printout-cols {
  margin-top: 10px;
  padding: 0 12px;
  font-family: var(--font-data);
  font-size: 12.5px;
  color: var(--paper-ink-soft);
}

.printout-cols span:last-child {
  text-align: right;
}

.scores {
  list-style: none;
  margin: 6px -12px 0;
  padding: 0;
  font-family: var(--font-data);
}

.scores li {
  padding: 7px 24px;
  font-size: 17px;
  line-height: 1.5;
}

.scores li:nth-child(odd) {
  background: var(--paper-band);
}

.scores .rank {
  color: var(--paper-ink-soft);
}

.scores .name {
  font-weight: 700;
  letter-spacing: 0.16em;
}

.scores .points {
  font-weight: 700;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* 1~3위는 빨간 펜으로 순위를 적고, 1위는 형광펜으로 칠한다 */
.scores li.first .rank,
.scores li.second .rank,
.scores li.third .rank {
  font-weight: 700;
  color: var(--red-ink);
}

.scores li.first .name,
.scores li.first .points {
  padding: 0 4px;
  margin: 0 -4px;
  background: linear-gradient(to bottom, transparent 12%, #f6e05e 12% 88%, transparent 88%);
}

/* 방금 올린 줄: 분홍 형광펜이 지나간다 */
.scores li.just-added {
  background:
    linear-gradient(to bottom, transparent 10%, rgba(244, 143, 183, 0.75) 10% 90%, transparent 90%) left / 100% 100% no-repeat,
    var(--paper);
  animation: highlighter 0.9s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes highlighter {
  from {
    background-size: 0% 100%, auto;
  }
}

.scores li.soft {
  display: block;
  padding: 16px 24px;
  font-family: var(--font-body);
  font-size: 15px;
}

/* ---------- 교신 기록: 댓글 ---------- */

.comms {
  max-width: 1320px;
  margin: 64px auto 0;
  padding: 0 32px;
}

.comms-desk {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 32px;
}

.comms-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.field input,
.field textarea {
  width: 100%;
  padding: 12px 14px;
  font-family: var(--font-data);
  font-size: 16px;
  line-height: 1.5;
  color: var(--phosphor);
  caret-color: var(--amber);
  background: var(--crt);
  border: 2px solid var(--ink-dark);
  border-radius: 4px;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.6);
}

.field textarea {
  resize: vertical;
  min-height: 112px;
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--phosphor-dim);
  opacity: 1;
}

.field input:focus-visible,
.field textarea:focus-visible {
  outline-offset: 2px;
}

#comment-submit {
  align-self: flex-start;
  min-height: 50px;
  padding: 0 26px;
  font-weight: 800;
  font-size: 16px;
  color: #0f2416;
  background: var(--green) linear-gradient(to bottom, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0) 55%);
  border: 3px solid var(--ink-dark);
  border-bottom-width: 7px;
  border-radius: 6px;
  box-shadow: 0 6px 10px rgba(0, 0, 0, 0.35);
  transition: transform 120ms cubic-bezier(0.16, 1, 0.3, 1), box-shadow 120ms ease-out;
}

#comment-submit:hover {
  filter: brightness(1.06);
}

#comment-submit:active {
  transform: translateY(3px);
  border-bottom-width: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.35);
}

#comment-submit:disabled {
  opacity: 0.55;
  cursor: wait;
}

#comment-message {
  font-weight: 600;
  font-size: 15px;
  color: #f5c66a;
}

.comms-screen {
  min-height: 280px;
  max-height: 440px;
  overflow-y: auto;
  padding: 12px 20px;
  border: 2px solid var(--ink-dark);
  border-radius: 6px;
  background:
    repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0.25) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at 50% 40%, #12251c, var(--crt) 75%);
  box-shadow: inset 0 0 36px rgba(0, 0, 0, 0.7);
  scrollbar-color: var(--phosphor-dim) var(--crt);
}

.comments {
  list-style: none;
  margin: 0;
  padding: 0;
  font-family: var(--font-data);
  color: var(--phosphor);
}

.comments li {
  padding: 12px 0;
  border-bottom: 1px dashed rgba(158, 240, 176, 0.25);
}

.comments li:last-child {
  border-bottom: 0;
}

.comment-nickname {
  display: block;
  font-weight: 700;
  font-size: 14px;
  color: var(--amber);
}

.comment-text {
  margin-top: 2px;
  font-size: 15.5px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

/* 닉네임 없이 글만 있는 줄은 흐린 글자로 */
.comments li:not(:has(.comment-nickname)) .comment-text {
  color: var(--phosphor-dim);
}

.comments li.soft {
  color: var(--phosphor-dim);
  font-size: 15px;
}

/* ---------- 맨 아래 ---------- */

.console-foot {
  max-width: 1320px;
  margin: 64px auto 0;
  padding: 18px 32px 36px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-family: var(--font-data);
  font-size: 13px;
  color: var(--text-soft);
  border-top: 1px solid rgba(0, 0, 0, 0.25);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* ---------- 이니셜 창: 우주선 항법 컴퓨터 입력판 ---------- */

#initials-dialog {
  width: min(420px, calc(100vw - 24px));
  padding: 22px 22px 20px;
  color: var(--ink-dark);
  border: 3px solid var(--ink-dark);
  border-radius: 10px;
  background:
    radial-gradient(circle, #6f736b 0 2.5px, #d6d8d1 3px, transparent 3.6px) 0 0 / 24px 24px no-repeat,
    radial-gradient(circle, #6f736b 0 2.5px, #d6d8d1 3px, transparent 3.6px) 100% 0 / 24px 24px no-repeat,
    radial-gradient(circle, #6f736b 0 2.5px, #d6d8d1 3px, transparent 3.6px) 0 100% / 24px 24px no-repeat,
    radial-gradient(circle, #6f736b 0 2.5px, #d6d8d1 3px, transparent 3.6px) 100% 100% / 24px 24px no-repeat,
    linear-gradient(to bottom, #b4b7ae, #a2a59c);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

#initials-dialog[open] {
  animation: dialog-in 260ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes dialog-in {
  from {
    transform: translateY(12px);
    opacity: 0.4;
  }
}

#initials-dialog::backdrop {
  background: rgba(8, 12, 10, 0.78);
}

#initials-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 26px;
  line-height: 1.25;
}

.dsky-hint {
  margin: 6px 0 16px;
  font-size: 14.5px;
  line-height: 1.5;
  color: #262b27;
}

.dsky-window {
  padding: 12px 14px 16px;
  background: #0f1a14;
  border: 2px solid var(--ink-dark);
  border-radius: 6px;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.8);
}

.dsky-label {
  margin-bottom: 8px;
  font-family: var(--font-data);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.1em;
  color: var(--phosphor);
}

.initials-slots {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.initial-slot {
  display: grid;
  gap: 8px;
  padding: 6px;
  border: 2px solid transparent;
  border-radius: 6px;
  cursor: pointer;
}

.initial-slot.active {
  border-color: var(--amber);
  background: rgba(245, 178, 58, 0.1);
}

.initial-letter {
  display: block;
  font-family: var(--font-data);
  font-weight: 700;
  font-size: 52px;
  line-height: 1.1;
  text-align: center;
  color: var(--phosphor);
}

.initial-step {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 48px;
  color: var(--text);
  background: linear-gradient(to bottom, #646a64, #474c47);
  border: 2px solid var(--ink-dark);
  border-bottom-width: 5px;
  border-radius: 6px;
  transition: transform 100ms cubic-bezier(0.16, 1, 0.3, 1);
}

.initial-step svg {
  width: 24px;
  height: 24px;
}

.initial-step:hover {
  background: linear-gradient(to bottom, #737a73, #545a54);
}

.initial-step:active {
  transform: translateY(2px);
  border-bottom-width: 3px;
}

#initials-message {
  margin-top: 12px;
  font-weight: 600;
  font-size: 14.5px;
  color: #6e1414;
}

.initials-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  gap: 12px;
  margin-top: 18px;
}

.initials-actions button {
  min-height: 52px;
  font-weight: 800;
  font-size: 16px;
  border: 3px solid var(--ink-dark);
  border-bottom-width: 6px;
  border-radius: 6px;
}

#initials-cancel {
  color: var(--ink-dark);
  background: #dcded7;
}

#initials-confirm {
  color: #0f2416;
  background: var(--green) linear-gradient(to bottom, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0) 55%);
}

.initials-actions button:active {
  transform: translateY(2px);
  border-bottom-width: 4px;
}

.initials-actions button:disabled {
  opacity: 0.55;
  cursor: wait;
}

#initials-dialog :focus-visible {
  outline-color: var(--ink-dark);
}

.dsky-window :focus-visible {
  outline-color: var(--amber);
}

/* ---------- 작은 컴퓨터, 태블릿: 개요를 아래로 내린다 ---------- */

@media (max-width: 1180px) {
  .console {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      "monitor record"
      "brief brief";
  }

  .brief-bay {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    align-items: start;
  }
}

/* ---------- 휴대폰: 윗판, 주 화면, 기록판, 개요, 교신 순서 ---------- */

@media (max-width: 760px) {
  .masthead {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      "patch title"
      "patch status";
    column-gap: 12px;
    row-gap: 6px;
    padding: 10px 12px;
  }

  .patch {
    width: 58px;
    height: 58px;
  }

  .title-block h1 {
    font-size: 28px;
  }

  .title-block p {
    display: none;
  }

  .status-name {
    font-size: 12px;
  }

  .state {
    padding: 3px 10px;
    font-size: 13px;
  }

  .console {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "monitor"
      "record"
      "brief";
    margin-top: 12px;
    padding: 0 12px;
    gap: 36px;
  }

  /* 주 화면 라벨은 휴대폰에서 눈으로는 숨기고 읽기 프로그램에는 남긴다 */
  .monitor-bay .tape {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .monitor {
    justify-content: center;
    padding: 8px;
  }

  .altimeter {
    display: none;
  }

  /* 휴대폰 세로 화면에서 게임 자리가 화면 높이를 넘지 않게 한다 */
  #game-slot {
    width: min(100%, calc((100svh - 120px) * 9 / 16));
  }

  .brief-bay {
    display: flex;
    align-items: stretch;
  }

  .printout {
    padding: 16px 30px 22px;
    background:
      radial-gradient(circle, var(--paint) 0 3.5px, rgba(0, 0, 0, 0.18) 4px, transparent 4.5px) 0 6px / 20px 24px repeat-y,
      radial-gradient(circle, var(--paint) 0 3.5px, rgba(0, 0, 0, 0.18) 4px, transparent 4.5px) 100% 6px / 20px 24px repeat-y,
      linear-gradient(to right, transparent 20px, rgba(29, 36, 32, 0.22) 20px 21px, transparent 21px calc(100% - 21px), rgba(29, 36, 32, 0.22) calc(100% - 21px) calc(100% - 20px), transparent calc(100% - 20px)),
      var(--paper);
  }

  .scores li {
    padding: 7px 16px;
  }

  .printout-cols {
    padding: 0 4px;
  }

  .scores {
    margin: 6px -12px 0;
  }

  .comms {
    margin-top: 48px;
    padding: 0 12px;
  }

  .comms-desk {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }

  #comment-submit {
    align-self: stretch;
  }

  .comms-screen {
    min-height: 0;
  }

  .console-foot {
    flex-direction: column;
    gap: 2px;
    margin-top: 48px;
    padding: 16px 12px 28px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
