:root {
  color-scheme: dark;
  font-family: "Pretendard", "Malgun Gothic", "Apple SD Gothic Neo", system-ui, sans-serif;
  background: #080504;
  color: #fff8e9;
}

* { box-sizing: border-box; }

html, body { min-width: 900px; min-height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 50% -10%, rgba(189, 65, 20, .27), transparent 43%),
    linear-gradient(180deg, #160c08, #050303 76%);
}

button { font: inherit; }

.app-shell {
  width: min(1500px, 97vw);
  margin: 0 auto;
  padding: 14px 0 18px;
}

.topbar, .footerbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.topbar { padding: 0 4px 12px; }

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 2px solid #e85b23;
  border-radius: 50%;
  color: #ffb340;
  font: 1000 12px/1 Arial;
  box-shadow: inset 0 0 18px rgba(255,74,17,.25), 0 0 18px rgba(255,74,17,.16);
}
.brand p { margin: 0 0 2px; color: #d9985e; font-size: 9px; font-weight: 900; letter-spacing: .24em; }
.brand h1 { margin: 0; font-size: clamp(23px, 2.5vw, 38px); letter-spacing: -.06em; }
.brand h1 em { color: #ff5626; font-style: normal; font-weight: 1000; }

.actions { display: flex; align-items: center; gap: 8px; }
button {
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 8px;
  color: #fff5e6;
  cursor: pointer;
  transition: transform .16s ease, filter .16s ease, border-color .16s ease;
}
button:hover { filter: brightness(1.15); border-color: rgba(255,172,90,.58); }
button:active { transform: translateY(1px); }
button:disabled { cursor: wait; opacity: .65; }
.secondary { padding: 9px 13px; background: linear-gradient(#2d201a, #17100d); font-size: 12px; font-weight: 800; }
.icon-button { width: 38px; height: 36px; background: #1b120f; font-size: 18px; }
.status { margin-right: 5px; color: #cfbdae; font-size: 11px; font-weight: 800; }
.status::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: #70d883; box-shadow: 0 0 9px #70d883; }
.status.camera { color: #77e8ff; }
.status.camera::before { background: #32d9ff; box-shadow: 0 0 10px #32d9ff; }

.game-wrap {
  position: relative;
  overflow: hidden;
  border: 2px solid #64402a;
  border-radius: 15px;
  background: #100907;
  box-shadow: 0 24px 80px rgba(0,0,0,.68), inset 0 0 50px rgba(255,80,18,.08);
}

#gameCanvas { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; }

.camera-panel {
  position: absolute;
  right: 18px;
  bottom: 18px;
  width: min(22vw, 320px);
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 2px solid rgba(74,225,255,.7);
  border-radius: 11px;
  background: #071317;
  box-shadow: 0 10px 35px rgba(0,0,0,.55), 0 0 24px rgba(49,217,255,.15);
  transition: opacity .2s ease;
}
.camera-panel.hidden { display: none; }
.camera-panel video, .camera-panel canvas { position: absolute; inset: 0; width: 100%; height: 100%; transform: scaleX(-1); object-fit: cover; }
.camera-panel video { opacity: .52; }
.camera-topline {
  position: absolute;
  inset: 0 0 auto;
  display: flex;
  justify-content: space-between;
  padding: 7px 9px;
  background: linear-gradient(rgba(2,15,18,.88), transparent);
  color: #80efff;
  font: 900 9px/1 Arial;
  letter-spacing: .12em;
}
.camera-topline b { color: #d6fbff; font-weight: 700; letter-spacing: 0; }
.calibration-message {
  position: absolute;
  inset: auto 8px 8px;
  padding: 7px;
  border-radius: 6px;
  background: rgba(4,14,16,.82);
  color: #e5fdff;
  text-align: center;
  font-size: 10px;
  font-weight: 800;
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 30px;
  background: radial-gradient(circle at 36% 48%, rgba(139,43,13,.4), transparent 30%), rgba(9,5,4,.88);
  backdrop-filter: blur(3px);
  transition: opacity .25s ease;
}
.overlay.hidden { opacity: 0; pointer-events: none; }

.intro-card {
  display: grid;
  grid-template-columns: minmax(260px, 390px) minmax(390px, 530px);
  align-items: center;
  gap: clamp(28px, 5vw, 76px);
  width: min(1020px, 91%);
}
.boss-card { position: relative; height: 470px; display: grid; place-items: end center; }
.boss-card img { position: relative; z-index: 2; max-width: 100%; max-height: 100%; object-fit: contain; filter: contrast(1.05) saturate(1.08) drop-shadow(0 26px 22px rgba(0,0,0,.6)); }
.boss-card span { position: absolute; z-index: 3; top: 25px; left: 0; padding: 6px 12px; border: 1px solid #ff8a34; color: #ffc258; font: 1000 11px/1 Arial; letter-spacing: .18em; transform: rotate(-4deg); }
.boss-glow { position: absolute; inset: 16% 3% 5%; border-radius: 50%; background: radial-gradient(circle, rgba(255,91,25,.45), rgba(110,28,10,.1) 52%, transparent 72%); filter: blur(14px); }

.kicker { margin: 0 0 10px; color: #ff8d39; font-size: 13px; font-weight: 1000; letter-spacing: .12em; }
.intro-copy h2 { margin: 0; font-size: clamp(34px, 4vw, 58px); line-height: 1.13; letter-spacing: -.075em; }
.intro-copy h2 strong { color: #ff5627; }
.how-to { display: flex; gap: 9px; margin: 24px 0 12px; }
.how-to div { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 7px; padding: 8px 11px 8px 8px; border: 1px solid rgba(255,255,255,.13); border-radius: 9px; background: rgba(255,255,255,.055); font-size: 11px; font-weight: 800; }
kbd { min-width: 30px; padding: 5px 7px; border: 1px solid #7a5137; border-bottom-width: 3px; border-radius: 6px; background: #2b1911; color: #fff4de; text-align: center; font: 900 13px/1 Arial; }
.hint { margin: 0 0 20px; color: #cbb9aa; font-size: 12px; }
.start-button { padding: 13px 24px; border-color: #d75428; background: linear-gradient(180deg, #c74620, #7d1f10); font-size: 16px; font-weight: 1000; box-shadow: inset 0 1px rgba(255,255,255,.22), 0 9px 25px rgba(150,38,11,.38); }
.start-button small { margin-left: 10px; color: #ffccad; font-size: 9px; letter-spacing: .08em; }

.result-overlay { background: rgba(8,4,3,.82); }
.result-card { width: min(560px, 86%); padding: 31px 38px; border: 1px solid #a35a32; border-radius: 16px; background: linear-gradient(145deg, rgba(63,30,18,.96), rgba(16,9,7,.97)); text-align: center; box-shadow: 0 25px 80px rgba(0,0,0,.7), inset 0 0 50px rgba(255,102,32,.08); }
.result-card > p { margin: 0; color: #e79550; font: 900 10px/1 Arial; letter-spacing: .22em; }
.result-card h2 { margin: 10px 0 17px; color: #ffcb5b; font-size: 36px; }
.result-score { display: grid; margin-bottom: 18px; }
.result-score span { color: #bfa896; font: 900 10px/1 Arial; letter-spacing: .18em; }
.result-score strong { margin-top: 3px; font: 1000 58px/1 Arial; }
.result-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 23px; }
.result-grid div { display: grid; gap: 5px; padding: 10px 5px; border: 1px solid rgba(255,255,255,.1); border-radius: 8px; background: rgba(255,255,255,.04); }
.result-grid span { color: #bda99a; font-size: 9px; }
.result-grid b { font: 900 21px/1 Arial; }

.footerbar { padding: 11px 5px 0; color: #a99587; font-size: 10px; }
.footerbar p { margin: 0; text-align: center; }
.key-guide { display: flex; align-items: center; gap: 4px; }
.key-guide span { margin-left: 4px; }
.key-guide kbd { min-width: 24px; padding: 4px; font-size: 10px; }
.signal-guide { display: flex; align-items: center; gap: 5px; font: 800 9px/1 Arial; }
.signal-guide i { width: 7px; height: 7px; margin-left: 6px; border-radius: 50%; }
.signal-guide .green { background: #68e786; box-shadow: 0 0 7px #68e786; }
.signal-guide .amber { background: #ffc14c; box-shadow: 0 0 7px #ffc14c; }
.signal-guide .red { background: #ff4d31; box-shadow: 0 0 7px #ff4d31; }

@media (max-width: 1100px) {
  .boss-card { height: 360px; }
  .intro-card { grid-template-columns: 290px 1fr; }
  .actions .status { display: none; }
}

body:fullscreen .app-shell { width: 100vw; padding: 0; }
body:fullscreen .topbar, body:fullscreen .footerbar { display: none; }
body:fullscreen .game-wrap { height: 100vh; border: 0; border-radius: 0; }
body:fullscreen #gameCanvas { width: 100vw; height: 100vh; object-fit: contain; }
