/* 무인도 생존 시뮬레이터 — 스타일 */
:root {
  --bg: #04121b;
  --bg2: #082330;
  --panel: rgba(11, 32, 43, 0.78);
  --line: rgba(126, 190, 208, 0.16);
  --txt: #e6f2f6;
  --sub: #9fc0cc;
  --muted: #6f8f9c;
  --teal: #5fe3b6;
  --teal-dim: #2ba98a;
  --sand: #e8d9a8;
  --red: #ef8a8a;
  --blue: #6fc8ee;
  --gold: #f2cf7a;
  --radius: 18px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--txt);
  font-family: "Pretendard", "Pretendard Variable", -apple-system, BlinkMacSystemFont,
    "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", "Noto Sans CJK KR", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body {
  min-height: 100dvh;
  background:
    radial-gradient(120% 70% at 50% -10%, #0d3a4a 0%, rgba(13, 58, 74, 0) 60%),
    radial-gradient(90% 60% at 100% 100%, #071f2a 0%, rgba(7, 31, 42, 0) 55%),
    linear-gradient(180deg, #061a24 0%, #04121b 45%, #020c12 100%);
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(1px 1px at 20% 18%, rgba(255, 255, 255, 0.55), transparent),
    radial-gradient(1px 1px at 72% 8%, rgba(255, 255, 255, 0.4), transparent),
    radial-gradient(1.4px 1.4px at 44% 32%, rgba(255, 255, 255, 0.35), transparent),
    radial-gradient(1px 1px at 88% 26%, rgba(255, 255, 255, 0.3), transparent),
    radial-gradient(1px 1px at 8% 40%, rgba(255, 255, 255, 0.25), transparent);
  opacity: 0.7;
  z-index: 0;
}

#app { position: relative; z-index: 1; }

.screen { display: none; min-height: 100dvh; }
.screen.active { display: flex; flex-direction: column; }

button {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
  cursor: pointer;
}
button:disabled { cursor: default; }

/* ── 공통 버튼 ─────────────────────────────────────── */
.primary {
  background: linear-gradient(135deg, #6ff0c4, #33b795 60%, #2a9c85);
  color: #04231d;
  font-weight: 800;
  border-radius: 16px;
  padding: 15px 20px;
  letter-spacing: -0.01em;
  box-shadow: 0 10px 26px rgba(63, 214, 175, 0.22);
  transition: transform 0.12s ease, box-shadow 0.2s ease, filter 0.2s;
}
.primary:hover { box-shadow: 0 14px 32px rgba(63, 214, 175, 0.32); }
.primary:active { transform: translateY(1px) scale(0.995); }
.primary.big { font-size: 18px; padding: 18px 26px; width: 100%; }

.ghost {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--sub);
  border-radius: 14px;
  padding: 13px 18px;
  font-weight: 600;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.ghost:hover { background: rgba(255, 255, 255, 0.07); color: var(--txt); border-color: rgba(126, 190, 208, 0.32); }

.icon-btn {
  width: 34px; height: 34px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 15px;
  border: 1px solid transparent;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.06); color: var(--txt); }

/* ── 시작 화면 ─────────────────────────────────────── */
#screen-start { align-items: center; justify-content: center; padding: 28px 20px 40px; }

.start-wrap {
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: fadeUp 0.6s ease both;
}

.start-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.badge-proto {
  font-size: 11px; font-weight: 800; letter-spacing: 0.12em;
  color: #7ff0cd;
  background: rgba(95, 227, 182, 0.1);
  border: 1px solid rgba(95, 227, 182, 0.28);
  padding: 5px 10px; border-radius: 999px;
}
.badge-live { font-size: 12px; color: var(--muted); }

.logo {
  margin: 8px 0 0;
  font-size: clamp(38px, 11vw, 58px);
  line-height: 1.06;
  letter-spacing: -0.045em;
  font-weight: 900;
}
.logo-line { display: block; }
.logo-line.accent {
  background: linear-gradient(100deg, #9ff7d8 0%, #5fe3b6 40%, #5bc6e8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lead {
  margin: 4px 0 6px;
  color: var(--sub);
  font-size: 15.5px;
  line-height: 1.7;
  letter-spacing: -0.01em;
}

.start-card {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(15, 45, 58, 0.65), rgba(8, 27, 36, 0.5));
  border-radius: var(--radius);
  padding: 6px 16px;
  backdrop-filter: blur(8px);
}
.sc-row {
  display: flex; align-items: baseline; gap: 14px;
  padding: 11px 0;
  border-bottom: 1px dashed rgba(126, 190, 208, 0.12);
  font-size: 13.5px;
}
.sc-row:last-child { border-bottom: 0; }
.sc-row span { color: var(--muted); flex: 0 0 54px; font-weight: 600; }
.sc-row b { color: #cfe3ea; font-weight: 600; }

#btn-start { margin-top: 6px; }

.history {
  margin-top: 8px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.history-head {
  display: flex; justify-content: space-between;
  font-size: 12px; color: var(--muted); font-weight: 700;
  letter-spacing: 0.04em; margin-bottom: 8px;
}
.history-best { color: var(--teal); }
.history-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; padding: 7px 0;
  border-bottom: 1px solid rgba(126, 190, 208, 0.07);
  color: var(--sub);
}
.hr-icon { width: 20px; }
.hr-main { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hr-day { color: var(--txt); font-weight: 700; font-variant-numeric: tabular-nums; }
.hr-end { color: var(--muted); font-size: 12px; }
.history-empty { color: var(--muted); font-size: 13px; margin: 4px 0 0; }

/* 이어하기 */
#continueWrap { display: flex; flex-direction: column; gap: 6px; }
#continueWrap[hidden] { display: none; }
.continue-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; padding: 14px 18px; border-radius: 16px;
  background: linear-gradient(135deg, rgba(95, 227, 182, 0.16), rgba(91, 198, 232, 0.12));
  border: 1px solid rgba(95, 227, 182, 0.42);
  color: #d8fbf0; font-weight: 800; font-size: 15px;
  transition: background 0.2s, border-color 0.2s, transform 0.12s;
}
.continue-btn:hover { background: linear-gradient(135deg, rgba(95, 227, 182, 0.24), rgba(91, 198, 232, 0.18)); }
.continue-btn:active { transform: translateY(1px) scale(0.995); }
.cb-meta { font-size: 12.5px; font-weight: 600; color: #9adfcb; }
.continue-note { margin: 0; font-size: 11.5px; color: var(--muted); text-align: center; }

/* 엔딩 도감 */
.ending-dex { margin-top: 6px; border-top: 1px solid var(--line); padding-top: 14px; }
.dex-head {
  display: flex; justify-content: space-between;
  font-size: 12px; color: var(--muted); font-weight: 700;
  letter-spacing: 0.04em; margin-bottom: 8px;
}
.dex-count { color: var(--teal); font-variant-numeric: tabular-nums; }
.dex-list { display: flex; flex-wrap: wrap; gap: 6px; }
.dex-chip {
  font-size: 11.5px; font-weight: 600; padding: 4px 9px; border-radius: 8px;
  background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); color: var(--muted);
}
.dex-chip.got {
  color: #a6f0d6; border-color: rgba(95, 227, 182, 0.32); background: rgba(95, 227, 182, 0.08);
}
.dex-done { margin: 8px 0 0; font-size: 11.5px; color: #e8d59f; }

/* ── 게임 화면 ─────────────────────────────────────── */
#screen-game { height: 100dvh; max-height: 100dvh; overflow: hidden; position: relative; }

.skip-hint {
  position: absolute; left: 50%; bottom: 104px;
  transform: translateX(-50%);
  font-size: 11px; color: var(--muted);
  opacity: 0; transition: opacity 0.2s; pointer-events: none;
}
.skip-hint.on { opacity: 0.85; }

.hud {
  flex: 0 0 auto;
  padding: 10px 14px 10px;
  background: linear-gradient(180deg, rgba(6, 26, 36, 0.96), rgba(6, 26, 36, 0.82));
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  z-index: 3;
}
.hud-line { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.day-chip {
  font-size: 11px; font-weight: 800; letter-spacing: 0.14em;
  color: #04231d;
  background: linear-gradient(135deg, #7ff0cd, #3fc3a0);
  padding: 4px 10px; border-radius: 8px;
  font-variant-numeric: tabular-nums;
}
.day-chip b { font-size: 14px; letter-spacing: 0; margin-left: 2px; }
.island-chip { font-size: 13px; color: var(--sub); font-weight: 600; flex: 1; }
.hud-line .icon-btn { margin-left: auto; }

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px 14px;
  margin-bottom: 7px;
}
.stat { display: flex; align-items: center; gap: 6px; font-size: 11px; }
.s-ico { font-size: 12px; width: 15px; text-align: center; }
.bar {
  flex: 1; height: 7px; border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.bar i {
  display: block; height: 100%; border-radius: 6px;
  background: #5fe3b6;
  transition: width 0.5s cubic-bezier(0.3, 0.9, 0.3, 1), background 0.4s;
}
.stat:nth-child(1) .bar i { background: linear-gradient(90deg, #f08787, #ef6f6f); }
.stat:nth-child(2) .bar i { background: linear-gradient(90deg, #7fd8f5, #4bb8e6); }
.stat:nth-child(3) .bar i { background: linear-gradient(90deg, #f5c981, #eda84f); }
.stat:nth-child(4) .bar i { background: linear-gradient(90deg, #c3aefc, #9d84ea); }
.stat.warn .bar i { filter: saturate(1.2); }
.stat.danger .bar i { animation: pulseBar 1.2s infinite; }
.s-val {
  width: 26px; text-align: right; font-weight: 700;
  font-variant-numeric: tabular-nums; color: #cfe3ea; font-size: 11.5px;
}
.stat.danger .s-val { color: var(--red); }

.inv {
  display: flex; flex-wrap: wrap; gap: 5px;
  max-height: 58px; overflow-y: auto;
  scrollbar-width: none;
}
.inv::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600;
  padding: 3px 8px; border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--sub);
  white-space: nowrap;
}
.chip.item { color: #d8ecf2; border-color: rgba(95, 227, 182, 0.22); background: rgba(95, 227, 182, 0.06); }
.chip.res { color: #cbb98d; }
.chip.badge { color: #a9e9d4; border-color: rgba(95, 227, 182, 0.18); }
.chip.item, .chip.res { cursor: pointer; -webkit-tap-highlight-color: rgba(95, 227, 182, 0.18); }
.chip.item:active, .chip.res:active { transform: translateY(1px); }
.chip:focus-visible { outline: 2px solid rgba(95, 227, 182, 0.6); outline-offset: 2px; }
.c-ico { font-size: 12px; }

.log {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 14px 16px 8px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.log-day {
  display: flex; align-items: center; gap: 10px;
  margin: 18px 0 10px;
  color: var(--muted);
}
.log-day:first-child { margin-top: 2px; }
.log-day::after {
  content: ""; flex: 1; height: 1px;
  background: linear-gradient(90deg, rgba(126, 190, 208, 0.28), transparent);
}
.d-num {
  font-size: 11px; font-weight: 800; letter-spacing: 0.16em;
  color: var(--teal);
}
.d-txt { font-size: 11px; color: var(--muted); }

.log-item {
  font-size: 14.5px;
  line-height: 1.68;
  margin: 0 0 7px;
  padding-left: 12px;
  border-left: 2px solid transparent;
  color: #c8dde5;
  animation: fadeUp 0.35s ease both;
  word-break: keep-all;
}
.log-item.t-story { color: #a9c6d1; font-size: 14.5px; margin-bottom: 11px; }
.log-item.t-info { color: #b6cfd9; font-size: 13.5px; }
.log-item.t-good {
  color: #a6f0d6;
  border-left-color: rgba(95, 227, 182, 0.55);
  background: linear-gradient(90deg, rgba(95, 227, 182, 0.07), transparent 70%);
  padding: 4px 10px 4px 12px;
  border-radius: 0 8px 8px 0;
  font-size: 13.5px;
}
.log-item.t-bad {
  color: #f2b3b3;
  border-left-color: rgba(239, 122, 122, 0.55);
  background: linear-gradient(90deg, rgba(239, 110, 110, 0.08), transparent 70%);
  padding: 4px 10px 4px 12px;
  border-radius: 0 8px 8px 0;
  font-size: 13.5px;
}
.log-item.t-event {
  color: var(--gold);
  font-weight: 700;
  font-size: 14px;
  border-left-color: rgba(242, 207, 122, 0.5);
  margin-top: 12px;
}
.log-item.t-delta {
  color: #93bccb;
  font-size: 12.5px;
  border-left-color: rgba(126, 190, 208, 0.28);
  margin-bottom: 4px;
  font-variant-numeric: tabular-nums;
}
.log-item.t-night {
  color: var(--muted);
  font-size: 12.5px;
  border-top: 1px dashed rgba(126, 190, 208, 0.16);
  padding-top: 9px;
  margin-top: 14px;
}
.log-item.t-title {
  color: #ffe6a8;
  font-weight: 800;
  font-size: 16px;
  text-align: center;
  border: 0;
  padding: 14px 8px;
  margin: 10px 0;
  background: linear-gradient(90deg, transparent, rgba(242, 207, 122, 0.1), transparent);
}

.actions {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  padding: 10px 12px calc(10px + var(--safe-b));
  background: linear-gradient(180deg, rgba(4, 18, 27, 0.82), rgba(4, 18, 27, 0.98));
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  z-index: 3;
}
.act-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 9px 4px 8px;
  border-radius: 13px;
  border: 1px solid rgba(126, 190, 208, 0.15);
  background: linear-gradient(180deg, rgba(20, 55, 68, 0.55), rgba(10, 32, 42, 0.5));
  transition: transform 0.1s, background 0.2s, border-color 0.2s;
  min-height: 62px;
}
.act-btn:hover:not(:disabled) { background: linear-gradient(180deg, rgba(28, 74, 90, 0.7), rgba(12, 40, 52, 0.6)); border-color: rgba(95, 227, 182, 0.36); }
.act-btn:active:not(:disabled) { transform: scale(0.97); }
.act-btn.disabled, .act-btn:disabled { opacity: 0.38; filter: grayscale(0.5); }
.a-ico { font-size: 18px; line-height: 1.1; }
.a-name { font-size: 12px; font-weight: 700; color: #dceef4; letter-spacing: -0.02em; }
.a-hint { font-size: 9.5px; color: var(--muted); }
#screen-game.thinking .act-btn { pointer-events: none; }

/* ── 모달 ──────────────────────────────────────────── */
.modal {
  position: fixed; inset: 0; z-index: 40;
  display: flex; align-items: center; justify-content: center;
  padding: 18px;
  background: rgba(2, 9, 13, 0.74);
  backdrop-filter: blur(10px);
  animation: fadeIn 0.18s ease both;
}
.modal.hidden { display: none; }
.modal-card {
  width: 100%;
  max-width: 460px;
  max-height: 86dvh;
  overflow-y: auto;
  padding: 22px 20px 20px;
  border-radius: 22px;
  border: 1px solid rgba(126, 190, 208, 0.22);
  background: linear-gradient(180deg, #0d2a37 0%, #081c25 100%);
  box-shadow: var(--shadow);
  animation: popIn 0.26s cubic-bezier(0.2, 1.1, 0.4, 1) both;
}
.event-card { text-align: center; }
.ev-icon { font-size: 42px; line-height: 1; margin-bottom: 6px; animation: floaty 3s ease-in-out infinite; }
.ev-title { margin: 0 0 10px; font-size: 20px; letter-spacing: -0.03em; color: #fff; }
.ev-text { margin: 0 0 18px; color: #bdd6df; font-size: 14.5px; line-height: 1.75; word-break: keep-all; }
.choices { display: flex; flex-direction: column; gap: 8px; text-align: left; }
.choice {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 13px 14px;
  border-radius: 13px;
  border: 1px solid rgba(126, 190, 208, 0.2);
  background: rgba(255, 255, 255, 0.04);
  color: #e2f0f5;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.18s, border-color 0.18s, transform 0.1s;
  line-height: 1.45;
}
.choice:hover { background: rgba(95, 227, 182, 0.1); border-color: rgba(95, 227, 182, 0.45); }
.choice:active { transform: scale(0.99); }
.ch-num {
  flex: 0 0 22px; height: 22px;
  display: grid; place-items: center;
  border-radius: 7px;
  background: rgba(126, 190, 208, 0.14);
  color: #9fd9cb; font-size: 11px; font-weight: 800;
}
.ch-label { flex: 1; text-align: left; }

.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.modal-head h2 { margin: 0; font-size: 19px; letter-spacing: -0.03em; }
.modal-sub { margin: 4px 0 14px; color: var(--muted); font-size: 12.5px; }
.how-body p { margin: 0 0 11px; font-size: 13.5px; color: #bdd6df; line-height: 1.7; word-break: keep-all; }
.how-body b { color: #8fe3c8; }

.recipes { display: flex; flex-direction: column; gap: 9px; }
.recipe {
  padding: 12px 13px;
  border-radius: 14px;
  border: 1px solid rgba(126, 190, 208, 0.16);
  background: rgba(255, 255, 255, 0.03);
}
.recipe.disabled { opacity: 0.62; }
.r-head { display: flex; align-items: center; gap: 8px; }
.r-ico { font-size: 17px; }
.r-name { font-weight: 700; font-size: 14.5px; }
.r-res { margin-left: auto; font-size: 10.5px; color: var(--teal); border: 1px solid rgba(95, 227, 182, 0.25); padding: 2px 7px; border-radius: 999px; }
.r-desc { margin: 5px 0 8px; font-size: 12px; color: var(--muted); line-height: 1.5; }
.r-cost { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 9px; }
.cost-chip {
  font-size: 11px; font-weight: 600;
  padding: 3px 8px; border-radius: 7px;
  background: rgba(255, 255, 255, 0.05);
  color: #b8d3dc;
  border: 1px solid transparent;
}
.cost-chip.lack { color: #f0a3a3; background: rgba(239, 110, 110, 0.09); border-color: rgba(239, 110, 110, 0.22); }
.cost-hint { font-size: 11px; color: #f0a3a3; align-self: center; }
.r-btn {
  width: 100%;
  padding: 9px;
  border-radius: 10px;
  background: rgba(95, 227, 182, 0.14);
  border: 1px solid rgba(95, 227, 182, 0.3);
  color: #a6f0d6;
  font-weight: 700;
  font-size: 13px;
}
.r-btn:disabled { background: rgba(255, 255, 255, 0.04); border-color: transparent; color: var(--muted); }

/* ── 엔딩 ──────────────────────────────────────────── */
#screen-end { align-items: center; padding: 24px 16px 44px; }
.end-wrap {
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: fadeUp 0.5s ease both;
}
.card-holder { display: flex; justify-content: center; }
.share-canvas {
  width: 100%;
  height: auto;
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(126, 190, 208, 0.18);
  display: block;
}
.share-img {
  width: 100%;
  height: auto;
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(126, 190, 208, 0.18);
  display: block;
  -webkit-touch-callout: default;
  user-select: none;
  -webkit-user-select: none;
}
.card-hint { margin: -6px 0 0; font-size: 12px; color: #9fc6d2; text-align: center; line-height: 1.6; }
.end-info { display: flex; flex-direction: column; gap: 10px; }
.end-badge {
  align-self: flex-start;
  font-size: 13px; font-weight: 800;
  padding: 6px 13px; border-radius: 999px;
  background: rgba(95, 227, 182, 0.12);
  border: 1px solid rgba(95, 227, 182, 0.32);
  color: #a6f0d6;
}
.end-badge.death { background: rgba(239, 110, 110, 0.11); border-color: rgba(239, 110, 110, 0.32); color: #f2b3b3; }
.end-title { margin: 2px 0 0; font-size: 24px; letter-spacing: -0.035em; }
.end-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 4px;
}
.end-cell {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex; flex-direction: column; gap: 2px;
}
.ec-k { font-size: 11px; color: var(--muted); font-weight: 700; }
.ec-v { font-size: 13.5px; color: #e0eff4; font-weight: 600; }
.end-ach { display: flex; flex-wrap: wrap; gap: 6px; }
.ach-chip {
  font-size: 11.5px; font-weight: 600;
  padding: 4px 9px; border-radius: 8px;
  background: rgba(242, 207, 122, 0.08);
  border: 1px solid rgba(242, 207, 122, 0.22);
  color: #e8d59f;
}
.end-summary { margin: 2px 0 0; color: #b9d4de; font-size: 14px; line-height: 1.7; word-break: keep-all; }
.end-actions { display: flex; flex-direction: column; gap: 9px; }
.end-note { margin: 0; font-size: 11.5px; color: var(--muted); text-align: center; }

/* ── 토스트 ────────────────────────────────────────── */
#toast {
  position: fixed;
  left: 50%; bottom: calc(28px + var(--safe-b));
  transform: translate(-50%, 16px);
  padding: 11px 18px;
  border-radius: 12px;
  background: rgba(20, 55, 68, 0.96);
  border: 1px solid rgba(95, 227, 182, 0.3);
  color: #d7f5eb;
  font-size: 13px; font-weight: 600;
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 80;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
  max-width: min(88vw, 420px);
  text-align: center;
  line-height: 1.55;
}
#toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ── 애니메이션 ────────────────────────────────────── */
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: scale(0.94) translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes pulseBar { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ── 넓은 화면 ─────────────────────────────────────── */
@media (min-width: 620px) {
  .stats { grid-template-columns: repeat(4, 1fr); }
  .actions { grid-template-columns: repeat(6, 1fr); }
  #screen-game {
    max-width: 760px;
    margin: 0 auto;
    border-left: 1px solid rgba(126, 190, 208, 0.1);
    border-right: 1px solid rgba(126, 190, 208, 0.1);
  }
  body { background-color: #020c12; }
}

/* ══ 2단계: 언어 전환 · 시드 챌린지 · 가이드 · 등급 ══════ */

/* 언어 전환 */
.start-top { align-items: center; }
.lang-switch {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 800; letter-spacing: 0.04em;
  color: var(--muted);
}
.lang-switch a {
  color: var(--muted); text-decoration: none;
  padding: 4px 8px; border-radius: 8px; border: 1px solid transparent;
}
.lang-switch a:hover { color: var(--txt); background: rgba(255, 255, 255, 0.05); }
.lang-switch a.on {
  color: #a6f0d6; border-color: rgba(95, 227, 182, 0.32);
  background: rgba(95, 227, 182, 0.08);
}
.lang-switch span { opacity: 0.4; }

/* 시드 / 오늘의 챌린지 */
.seed-box {
  border: 1px solid rgba(242, 207, 122, 0.22);
  background: linear-gradient(180deg, rgba(46, 38, 18, 0.35), rgba(10, 26, 34, 0.5));
  border-radius: var(--radius);
  padding: 12px 14px 10px;
  display: flex; flex-direction: column; gap: 8px;
}
.sd-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sd-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.sd-k { font-size: 13px; font-weight: 800; color: #f2cf7a; letter-spacing: -0.01em; }
.sd-sub { font-size: 11.5px; color: var(--sub); line-height: 1.45; }
.sd-code-row { display: flex; align-items: center; gap: 8px; font-size: 11px; }
.sd-code-label { color: var(--muted); font-weight: 700; letter-spacing: 0.05em; }
.sd-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px; letter-spacing: 0.06em; color: #e8d59f;
  background: rgba(242, 207, 122, 0.08);
  border: 1px solid rgba(242, 207, 122, 0.2);
  padding: 2px 8px; border-radius: 7px;
}
.ghost.small { padding: 8px 12px; font-size: 12px; border-radius: 11px; white-space: nowrap; }
.primary.small { padding: 10px 14px; font-size: 13px; border-radius: 11px; white-space: nowrap; }

.seed-more { border-top: 1px dashed rgba(242, 207, 122, 0.18); padding-top: 8px; }
.seed-more > summary {
  cursor: pointer; list-style: none;
  font-size: 11.5px; font-weight: 700; color: var(--muted);
  display: flex; align-items: center; gap: 6px;
}
.seed-more > summary::-webkit-details-marker { display: none; }
.seed-more > summary::before { content: '＋'; color: #c9b06a; font-weight: 800; }
.seed-more[open] > summary::before { content: '－'; }
.seed-desc { margin: 7px 0 9px; font-size: 11.5px; color: var(--sub); line-height: 1.6; }
.seed-form { display: flex; gap: 7px; }
.seed-form input {
  flex: 1; min-width: 0;
  font: inherit; font-size: 13px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--txt);
  background: rgba(4, 18, 27, 0.7);
  border: 1px solid rgba(126, 190, 208, 0.24);
  border-radius: 11px; padding: 10px 12px;
}
.seed-form input::placeholder { color: #5b7783; letter-spacing: 0.02em; font-weight: 500; }
.seed-form input:focus { outline: none; border-color: rgba(95, 227, 182, 0.55); }
.seed-note { margin: 8px 0 0; font-size: 11.5px; color: #f0d79a; line-height: 1.5; }

/* 가이드 아코디언 */
.guide-box {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.02);
  padding: 12px 16px;
}
.guide-box > summary {
  cursor: pointer; list-style: none;
  font-size: 13px; font-weight: 800; color: var(--sub);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.guide-box > summary::-webkit-details-marker { display: none; }
.guide-box > summary::after { content: '▾'; color: var(--muted); font-size: 12px; transition: transform 0.2s; }
.guide-box[open] > summary::after { transform: rotate(180deg); }
.guide-body { padding-top: 10px; }
.guide-intro { margin: 0 0 6px; font-size: 12.5px; color: #bdd6df; line-height: 1.7; word-break: keep-all; }
.guide-h { margin: 14px 0 4px; font-size: 13px; color: #8fe3c8; letter-spacing: -0.01em; }
.guide-p { margin: 0; font-size: 12.5px; color: #a9c6d1; line-height: 1.72; word-break: keep-all; }
.guide-ends { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.guide-end {
  display: flex; flex-direction: column; gap: 1px;
  font-size: 12px; color: #9fbcc6; line-height: 1.55;
  padding-left: 10px; border-left: 2px solid rgba(242, 207, 122, 0.25);
}
.guide-end b { color: #e8d59f; font-size: 12.5px; }

/* 푸터 */
.foot {
  margin-top: 14px; padding-top: 12px;
  border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 6px 12px;
  font-size: 11px; color: var(--muted);
}
.foot a { color: var(--sub); text-decoration: none; border-bottom: 1px solid rgba(126, 190, 208, 0.3); }
.foot a:hover { color: var(--txt); }
.foot-note { flex: 1 1 180px; text-align: right; line-height: 1.5; }

/* 게임 HUD 시드 */
.seed-chip {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 9.5px; letter-spacing: 0.04em;
  color: #c9b06a;
  border: 1px solid rgba(242, 207, 122, 0.24);
  background: rgba(242, 207, 122, 0.06);
  padding: 2px 7px; border-radius: 7px;
  white-space: nowrap;
}

/* 엔딩: 등급 · 사인 */
.end-rank {
  display: flex; align-items: center; gap: 10px;
  margin-top: 2px;
}
.er-label { font-size: 10px; font-weight: 800; letter-spacing: 0.16em; color: var(--muted); }
.er-letter {
  display: grid; place-items: center;
  width: 42px; height: 42px; border-radius: 13px;
  font-size: 23px; font-weight: 900;
  color: #04231d;
  background: linear-gradient(135deg, #7ff0cd, #3fc3a0);
  box-shadow: 0 8px 20px rgba(63, 214, 175, 0.22);
}
.er-letter.rank-S { background: linear-gradient(135deg, #ffe6a8, #f2cf7a 60%, #d9a94a); box-shadow: 0 8px 22px rgba(242, 207, 122, 0.3); }
.er-letter.rank-A { background: linear-gradient(135deg, #a6f0d6, #5fe3b6 60%, #2ba98a); }
.er-letter.rank-B { background: linear-gradient(135deg, #9fe0f6, #5cc8f0 60%, #2f92b8); }
.er-letter.rank-C { background: linear-gradient(135deg, #cfe3ea, #9fc0cc 60%, #6f8f9c); }
.er-letter.rank-D { background: linear-gradient(135deg, #e8d9a8, #cbb98d 60%, #9a8657); }
.er-letter.rank-F { background: linear-gradient(135deg, #f2b3b3, #e28a8a 60%, #b25f5f); color: #2a0d0d; }
.end-epitaph {
  margin: 4px 0 0; font-size: 14px; color: #e8d59f;
  line-height: 1.7; word-break: keep-all;
  padding-left: 12px; border-left: 3px solid rgba(242, 207, 122, 0.4);
}

/* 문서(개인정보) */
.doc-wrap { max-width: 680px; margin: 0 auto; padding: 32px 20px 60px; position: relative; z-index: 1; }
.doc h1 { font-size: 26px; letter-spacing: -0.03em; margin: 6px 0 4px; }
.doc .doc-sub { color: var(--muted); font-size: 12.5px; margin: 0 0 20px; }
.doc h2 { font-size: 16px; color: #8fe3c8; margin: 24px 0 6px; letter-spacing: -0.02em; }
.doc p, .doc li { font-size: 13.5px; color: #b9d4de; line-height: 1.75; word-break: keep-all; }
.doc ul { padding-left: 18px; margin: 6px 0; }
.doc li { margin-bottom: 4px; }
.doc code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px; color: #e8d59f;
  background: rgba(242, 207, 122, 0.08);
  border: 1px solid rgba(242, 207, 122, 0.18);
  padding: 1px 6px; border-radius: 6px;
}
.doc-back {
  display: inline-block; margin-bottom: 14px;
  font-size: 12.5px; color: var(--sub); text-decoration: none;
  border-bottom: 1px solid rgba(126, 190, 208, 0.3);
}
.doc-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }

/* 좁은 화면 보정 */
.doc a { color: #8fe3c8; }
.doc a:hover { color: #c8f7e6; }
@media (max-width: 380px) {
  .badge-proto { font-size: 9.5px; letter-spacing: 0.07em; padding: 4px 8px; }
  .logo { font-size: clamp(32px, 11.5vw, 46px); }
  .sd-sub { font-size: 11px; }
  .ghost.small { padding: 7px 10px; }
  .seed-form { flex-direction: column; }
  .seed-form .primary.small { width: 100%; }
}
