:root {
  --bg-1: #08151f;
  --bg-2: #142b3a;
  --card: rgba(10, 19, 27, 0.84);
  --line: rgba(255, 220, 173, 0.2);
  --text: #fff5df;
  --sub: #ffc97f;
  --ok: #8ae08f;
  --warn: #ff9873;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 10%, rgba(255, 150, 68, 0.2), transparent 40%),
    radial-gradient(circle at 82% 85%, rgba(95, 172, 255, 0.22), transparent 43%),
    linear-gradient(145deg, var(--bg-1), var(--bg-2));
  color: var(--text);
  font-family: "SUIT", sans-serif;
  overflow-x: hidden;
}

.bg-shape {
  position: fixed;
  border-radius: 999px;
  filter: blur(10px);
  pointer-events: none;
}

.bg-shape-a {
  width: 340px;
  height: 340px;
  background: rgba(255, 152, 82, 0.18);
  top: -120px;
  right: -80px;
  animation: drift 8s ease-in-out infinite;
}

.bg-shape-b {
  width: 290px;
  height: 290px;
  background: rgba(106, 182, 255, 0.16);
  bottom: -110px;
  left: -70px;
  animation: drift 10s ease-in-out infinite reverse;
}

@keyframes drift {
  0% { transform: translate(0, 0); }
  50% { transform: translate(0, -20px); }
  100% { transform: translate(0, 0); }
}

.app {
  width: min(1280px, 96vw);
  margin: 20px auto 28px;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3rem);
  font-family: "Black Han Sans", sans-serif;
  letter-spacing: 1px;
}

.hero p {
  margin: 10px 0 14px;
  color: #ffd7a3;
  font-size: 1rem;
}

.api-error {
  background: rgba(255, 91, 60, 0.18);
  border: 1px solid rgba(255, 161, 128, 0.45);
  color: #ffd8c9;
  padding: 14px;
  border-radius: 12px;
  margin-bottom: 14px;
  font-weight: 700;
}

.hidden {
  display: none !important;
}

.game-layout {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 14px;
  align-items: start;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  backdrop-filter: blur(8px);
}

.panel h2 {
  margin: 0 0 10px;
  font-size: 1.05rem;
  color: var(--sub);
}

.stat {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px dashed rgba(255, 218, 170, 0.15);
  padding: 8px 0;
  font-size: 0.96rem;
}

.status-text {
  margin-top: 10px;
  color: #ffd6ba;
  min-height: 38px;
}

.day-guide-bar {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 56px;
  z-index: 4;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(169, 240, 255, 0.42);
  background: rgba(13, 36, 53, 0.65);
  color: #d9f6ff;
  font-weight: 700;
  line-height: 1.45;
  pointer-events: none;
}

.action-guide-bar {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 108px;
  z-index: 4;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 212, 140, 0.45);
  background: rgba(49, 34, 16, 0.62);
  color: #ffe6bd;
  font-weight: 700;
  line-height: 1.4;
  pointer-events: none;
}

.tutorial-step {
  margin: 0;
  color: #d9ecff;
  font-weight: 600;
  min-height: 44px;
}

.game-area {
  position: relative;
}

.tutorial-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 52px;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  pointer-events: none;
  padding: 0 10px;
  z-index: 3;
}

.tutorial-holo {
  width: min(880px, 98%);
  border-radius: 12px;
  padding: 10px 14px;
  border: 1px solid rgba(152, 241, 255, 0.48);
  background: linear-gradient(160deg, rgba(12, 28, 42, 0.5), rgba(11, 22, 36, 0.36));
  box-shadow:
    0 0 0 1px rgba(161, 245, 255, 0.1) inset,
    0 0 18px rgba(111, 226, 255, 0.12);
}

.tutorial-holo h3 {
  margin: 0 0 4px;
  color: #9af4ff;
  font-size: 1rem;
}

.tutorial-holo p {
  margin: 0;
  color: #e0f8ff;
  font-weight: 600;
}

.tutorial-progress {
  margin-top: 4px !important;
  color: #b6f3ff !important;
  font-size: 0.88rem;
}

#gameCanvas {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(36, 71, 38, 0.95), rgba(25, 49, 28, 0.95));
}

.start-box {
  position: absolute;
  inset: 22% 24%;
  z-index: 2;
  background: rgba(12, 25, 35, 0.9);
  border: 1px solid rgba(255, 206, 146, 0.4);
  border-radius: 16px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.start-box h2 {
  margin: 0;
  color: var(--sub);
}

.start-box input,
.start-box button {
  border: none;
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 1rem;
}

.start-box input {
  background: rgba(255, 245, 227, 0.96);
}

.start-box button {
  cursor: pointer;
  font-weight: 700;
  background: linear-gradient(90deg, #ff934f, #ffc34d);
  color: #2b1904;
}

.bottom-actions {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
}

.guide-btn {
  border: 1px solid rgba(140, 231, 255, 0.5);
  border-radius: 999px;
  padding: 10px 16px;
  cursor: pointer;
  color: #d7f5ff;
  background:
    linear-gradient(90deg, rgba(85, 174, 255, 0.25), rgba(114, 255, 231, 0.24));
  box-shadow: 0 0 14px rgba(119, 219, 255, 0.26);
}

.leaderboard {
  margin: 0;
  padding-left: 20px;
}

.quiz-modal {
  position: fixed;
  inset: 0;
  background: rgba(2, 8, 13, 0.7);
  display: grid;
  place-items: center;
  z-index: 10;
}

.quiz-card {
  width: min(560px, 92vw);
  background: #102130;
  border: 1px solid rgba(255, 200, 121, 0.5);
  border-radius: 16px;
  padding: 18px;
}

.quiz-card h2 {
  margin: 0 0 10px;
  color: #ffc278;
}

.quiz-options {
  display: grid;
  gap: 9px;
}

.quiz-options button {
  border: 1px solid rgba(255, 214, 161, 0.4);
  border-radius: 10px;
  background: rgba(255, 236, 205, 0.08);
  color: #fff5df;
  padding: 10px;
  text-align: left;
  cursor: pointer;
}

.quiz-options button:hover {
  background: rgba(255, 206, 144, 0.2);
}

.quiz-feedback {
  min-height: 24px;
  font-weight: 700;
}

.guide-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 8, 14, 0.6);
  display: grid;
  place-items: center;
  z-index: 11;
}

.guide-card {
  width: min(620px, 92vw);
  border-radius: 18px;
  padding: 20px;
  border: 1px solid rgba(148, 231, 255, 0.7);
  background:
    linear-gradient(160deg, rgba(20, 40, 66, 0.86), rgba(12, 21, 38, 0.88));
  box-shadow:
    0 0 0 1px rgba(157, 246, 255, 0.18) inset,
    0 0 28px rgba(95, 204, 255, 0.36);
  animation: hologramPop 0.22s ease-out;
}

.guide-card h2 {
  margin: 0 0 12px;
  color: #95f5ff;
}

.guide-card p {
  margin: 8px 0;
  color: #ddf6ff;
}

.guide-card button {
  margin-top: 12px;
  border: 1px solid rgba(173, 243, 255, 0.7);
  border-radius: 10px;
  padding: 9px 14px;
  cursor: pointer;
  color: #072235;
  background: linear-gradient(90deg, #92efff, #d5ffff);
}

.story-modal {
  position: fixed;
  inset: 0;
  background: rgba(4, 9, 15, 0.66);
  display: grid;
  place-items: center;
  z-index: 12;
}

.story-card {
  width: min(760px, 92vw);
  border-radius: 18px;
  padding: 22px;
  border: 1px solid rgba(255, 210, 144, 0.56);
  background: linear-gradient(160deg, rgba(25, 39, 56, 0.92), rgba(14, 25, 37, 0.94));
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

.story-card h2 {
  margin: 0 0 12px;
  color: #ffd295;
}

.story-card p {
  margin: 0;
  color: #f8e8cd;
  line-height: 1.55;
  font-size: 1.05rem;
}

.story-start {
  margin-top: 14px !important;
  color: #a8f8ff !important;
  font-weight: 800;
}

.day-banner {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 13;
  pointer-events: none;
}

.day-banner-text {
  font-family: "Black Han Sans", sans-serif;
  font-size: clamp(2.2rem, 8vw, 4.5rem);
  color: #ffe8bb;
  text-shadow:
    0 0 14px rgba(255, 220, 157, 0.55),
    0 0 40px rgba(255, 132, 64, 0.35);
  animation: dayPop 0.95s ease;
}

@keyframes dayPop {
  0% {
    transform: scale(0.84);
    opacity: 0;
  }
  20% {
    transform: scale(1.03);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 0.95;
  }
}

@keyframes hologramPop {
  from {
    transform: scale(0.96) translateY(7px);
    opacity: 0;
  }
  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

@media (max-width: 1120px) {
  .game-layout {
    grid-template-columns: 1fr;
  }

  .start-box {
    inset: 26% 12%;
  }
}
