/* 오디펜스 — 첫 화면 시안. 백지에서 새로 쓴 UI: 클론의 트레이·플라크를 쓰지 않는다. */

:root {
  --ink: #f4efe2;
  --gold: #e8c173;
  --deep: #071f2b;
  --glass: rgba(7, 31, 43, 0.62);
  --edge: rgba(232, 193, 115, 0.5);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

/* Keyboard path visible: every interactive control is reachable and shows focus. */
button:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid #ffe9a8;
  outline-offset: 2px;
}

html, body {
  margin: 0;
  height: 100%;
  background: #04141c;
  color: var(--ink);
  font-family: 'Noto Sans KR', system-ui, sans-serif;
  word-break: keep-all;
  -webkit-tap-highlight-color: transparent;
}

.app { position: relative; width: 100%; height: 100dvh; overflow: hidden; }

/* ---------- Title ---------- */
.title {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  isolation: isolate;
}

.title__art {
  position: absolute;
  inset: -4%;
  background:
    radial-gradient(120% 90% at 50% 8%, rgba(120, 196, 214, 0.35), transparent 60%),
    radial-gradient(80% 70% at 12% 92%, rgba(232, 193, 115, 0.18), transparent 65%),
    url("assets/stage1-terrain.png") center / cover no-repeat,
    linear-gradient(180deg, #0d3a4c, #061a24 70%);
  filter: saturate(0.9) brightness(0.55);
  z-index: -1;
}

.title__body {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: calc(28px + var(--safe-t)) 24px calc(28px + var(--safe-b));
  text-align: center;
}

.title__eyebrow {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.22em;
  color: rgba(244, 239, 226, 0.72);
}

.title__name {
  margin: 0;
  font-family: 'Noto Serif KR', serif;
  font-weight: 900;
  font-size: clamp(44px, 11vw, 92px);
  letter-spacing: 0.06em;
  color: #fbf3df;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.45), 0 18px 40px rgba(0, 0, 0, 0.55);
}

.title__lead { margin: 0; font-size: 14px; color: rgba(244, 239, 226, 0.82); }

.title__start {
  margin-top: 14px;
  min-height: 52px;
  padding: 0 44px;
  border: 1px solid var(--edge);
  border-radius: 999px;
  background: linear-gradient(180deg, #f0d089, #c99a4a);
  color: #23180a;
  font: 800 17px 'Noto Sans KR', sans-serif;
  letter-spacing: 0.04em;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.title__start:active { transform: translateY(1px); }

.title__foot { margin: 4px 0 0; font-size: 11px; color: rgba(244, 239, 226, 0.5); }

/* ---------- Battle ---------- */
.battle { position: absolute; inset: 0; display: grid; place-items: center; background: #04141c; }

#board {
  width: 100%;
  height: 100%;
  object-fit: contain;   /* the board keeps its own aspect; the frame letterboxes, never stretches */
  display: block;
}

.hud {
  position: absolute;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 calc(10px + var(--safe-l)) 0 calc(10px + var(--safe-r));
  pointer-events: none;
}

.hud > * { pointer-events: auto; }

.hud--top {
  top: calc(8px + var(--safe-t));
  justify-content: flex-start;
}

.hud--dock {
  bottom: calc(8px + var(--safe-b));
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

.plaque {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--edge);
  border-radius: 999px;
  background: var(--glass);
  backdrop-filter: blur(6px);
  font-size: 14px;
  font-weight: 700;
}
.plaque__icon { font-size: 12px; color: var(--gold); }
.plaque--hearts .plaque__icon { color: #ff7a6b; }

.wave {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  margin: 0 auto;
  border: 1px solid var(--edge);
  border-radius: 999px;
  background: var(--glass);
  backdrop-filter: blur(6px);
  font-size: 14px;
}
.wave__label { font-size: 11px; letter-spacing: 0.14em; color: rgba(244, 239, 226, 0.7); }
.wave b { font-size: 16px; color: var(--gold); }
.wave__of { color: rgba(244, 239, 226, 0.7); }

.hud__right { display: inline-flex; gap: 8px; }

.chip {
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--edge);
  border-radius: 14px;
  background: var(--glass);
  color: var(--ink);
  font: 700 14px 'Noto Sans KR', sans-serif;
  backdrop-filter: blur(6px);
}
.chip[aria-pressed="true"] { background: rgba(232, 193, 115, 0.9); color: #23180a; }

.dock {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--edge);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(7, 31, 43, 0.72), rgba(7, 31, 43, 0.86));
  backdrop-filter: blur(8px);
}

.card {
  display: grid;
  grid-template-rows: auto auto auto;
  justify-items: center;
  gap: 2px;
  min-height: 64px;
  padding: 6px 4px;
  border: 1px solid rgba(232, 193, 115, 0.35);
  border-radius: 14px;
  background: rgba(10, 42, 56, 0.7);
  color: var(--ink);
  font-family: inherit;
}
.card__art { font-size: 20px; }
.card__name { font-size: 12px; font-weight: 700; }
.card__cost { font-size: 11px; color: var(--gold); }
.card[aria-pressed="true"] { border-color: var(--gold); background: rgba(232, 193, 115, 0.22); }
.card[disabled] { opacity: 0.45; }

.hint {
  margin: 0;
  text-align: center;
  font-size: 12px;
  color: rgba(244, 239, 226, 0.78);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

@media (orientation: landscape) and (max-height: 430px) {
  .card { min-height: 56px; }
  .card__art { font-size: 18px; }
}
