/* Direction Challenge — premium dark navigation arcade theme */
.dc-game-root {
  --dc-bg: #07111F;
  --dc-bg-2: #0B1628;
  --dc-card: #101C2E;
  --dc-text: #F8FAFC;
  --dc-text-2: #94A3B8;
  --dc-cyan: #22D3EE;
  --dc-purple: #8B5CF6;
  --dc-green: #34D399;
  --dc-orange: #F59E0B;
  --dc-error: #FB7185;
  --dc-radius: 16px;
  --dc-anim: 1;
  box-sizing: border-box;
  max-width: 1180px;
  margin: 0 auto;
  background: var(--dc-bg);
  color: var(--dc-text);
  border-radius: 20px;
  padding: clamp(12px, 3vw, 28px);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.dc-game-root *, .dc-game-root *::before, .dc-game-root *::after { box-sizing: border-box; }
.dc-game-root button { font-family: inherit; }

@media (prefers-reduced-motion: reduce) {
  .dc-game-root { --dc-anim: 0; }
}

.dc-boot-loading { text-align: center; padding: 60px 20px; color: var(--dc-text-2); }
.dc-boot-spinner {
  width: 40px; height: 40px; margin: 0 auto 16px;
  border: 3px solid rgba(34,211,238,0.2);
  border-top-color: var(--dc-cyan);
  border-radius: 50%;
  animation: dc-spin 0.9s linear infinite;
}
@keyframes dc-spin { to { transform: rotate(360deg); } }

.dc-hidden { display: none !important; }
.dc-screen { animation: dc-fade-in 0.35s ease; }
@keyframes dc-fade-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Generic card ---------- */
.dc-card {
  background: linear-gradient(180deg, var(--dc-card), var(--dc-bg-2));
  border: 1px solid rgba(148,163,184,0.12);
  border-radius: var(--dc-radius);
  box-shadow: 0 8px 24px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.03);
  padding: 18px;
}

.dc-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid rgba(148,163,184,0.18);
  background: linear-gradient(180deg, #17273f, #0e1a2c);
  color: var(--dc-text);
  border-radius: 12px;
  padding: 12px 20px;
  min-height: 44px;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(0,0,0,0.35), 0 6px 14px rgba(0,0,0,0.25);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.dc-btn:hover { transform: translateY(-2px); }
.dc-btn:active { transform: translateY(1px); box-shadow: 0 1px 0 rgba(0,0,0,0.35); }
.dc-btn:focus-visible { outline: 2px solid var(--dc-cyan); outline-offset: 2px; }
.dc-btn-primary { background: linear-gradient(180deg, #2fe3ff, #17b8d6); color: #04202a; box-shadow: 0 4px 0 #0e8ba3, 0 6px 16px rgba(34,211,238,0.35); }
.dc-btn-primary:active { box-shadow: 0 1px 0 #0e8ba3; }
.dc-btn-ghost { background: transparent; box-shadow: none; }
.dc-btn-danger { color: var(--dc-error); border-color: rgba(251,113,133,0.4); }
.dc-btn[disabled] { opacity: 0.4; cursor: not-allowed; transform: none; }

/* ---------- Dashboard ---------- */
.dc-dash-header { text-align: center; margin-bottom: 18px; }
.dc-title { font-size: clamp(22px, 4vw, 30px); font-weight: 800; letter-spacing: 0.5px;
  background: linear-gradient(90deg, var(--dc-cyan), var(--dc-purple));
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.dc-subtitle { color: var(--dc-text-2); font-size: 14px; margin-top: 4px; }

.dc-stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px,1fr)); gap: 12px; margin: 18px 0; }
.dc-stat { text-align: center; padding: 14px 8px; }
.dc-stat-value { font-size: 22px; font-weight: 800; color: var(--dc-cyan); }
.dc-stat-label { font-size: 12px; color: var(--dc-text-2); margin-top: 2px; text-transform: uppercase; letter-spacing: 0.4px; }

.dc-progress-bar { height: 12px; border-radius: 8px; background: rgba(148,163,184,0.12); overflow: hidden; margin: 8px 0 4px; }
.dc-progress-fill { height: 100%; background: linear-gradient(90deg, var(--dc-cyan), var(--dc-purple)); border-radius: 8px; transition: width 0.4s ease; }

.dc-dash-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 12px; margin-top: 18px; }

/* ---------- Level map ---------- */
.dc-map-group { margin-bottom: 22px; }
.dc-map-group-title { font-size: 13px; color: var(--dc-text-2); text-transform: uppercase; letter-spacing: 0.6px; margin-bottom: 10px; }
.dc-level-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); gap: 10px; }
.dc-level-node {
  aspect-ratio: 1; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; cursor: pointer; border: none; position: relative;
  background: radial-gradient(circle at 30% 30%, #1a2c46, #0c1728);
  color: var(--dc-text); box-shadow: 0 4px 10px rgba(0,0,0,0.4), inset 0 1px 2px rgba(255,255,255,0.06);
  transition: transform 0.15s ease;
}
.dc-level-node:hover { transform: translateY(-3px) scale(1.04); }
.dc-level-node.dc-locked { cursor: not-allowed; opacity: 0.45; }
.dc-level-node.dc-completed { background: radial-gradient(circle at 30% 30%, #1d5c47, #0c1e18); box-shadow: 0 4px 12px rgba(52,211,153,0.35), inset 0 1px 2px rgba(255,255,255,0.08); }
.dc-level-node.dc-current { box-shadow: 0 0 0 3px var(--dc-cyan), 0 0 18px rgba(34,211,238,0.6); animation: dc-pulse-glow calc(1.6s / var(--dc-anim, 1)) ease-in-out infinite; }
@keyframes dc-pulse-glow { 0%,100% { box-shadow: 0 0 0 3px var(--dc-cyan), 0 0 10px rgba(34,211,238,0.5);} 50% { box-shadow: 0 0 0 3px var(--dc-cyan), 0 0 22px rgba(34,211,238,0.9);} }

/* ---------- Game layout ---------- */
/* Single-line header up top (exit, title, hearts/streak, hint/skip/pause icons,
   timer) with a clean two-column body below on desktop: question detail on the
   left, answer controls on the right. Stacks to one column on mobile. */
.dc-game-layout {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr;
}
@media (min-width: 900px) {
  .dc-game-layout { grid-template-columns: 1.25fr 1fr; align-items: start; gap: 14px; }
}
.dc-area-question { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.dc-area-answer { display: flex; flex-direction: column; gap: 8px; }

.dc-topbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: nowrap;
  margin-bottom: 6px; overflow-x: auto; padding-bottom: 2px;
}
.dc-topbar-title { flex: 1 1 auto; min-width: 0; text-align: center; }
.dc-topbar-title strong { font-size: 14px; white-space: nowrap; }
.dc-topbar-title div { font-size: 11px; color: var(--dc-text-2); white-space: nowrap; }
.dc-topbar-group { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.dc-icon-btn { min-height: 36px; min-width: 36px; padding: 6px 9px; font-size: 14px; flex: 0 0 auto; white-space: nowrap; }
.dc-mini-mascot { width: 26px; height: 26px; flex: 0 0 auto; }
.dc-mini-hearts { font-size: 13px; letter-spacing: 1px; white-space: nowrap; }
.dc-mini-streak { font-size: 12px; color: var(--dc-orange); white-space: nowrap; }
@media (max-width: 640px) {
  .dc-topbar { gap: 6px; }
  .dc-topbar-title strong { font-size: 12px; }
  .dc-mini-streak { display: none; }
}

.dc-hearts { font-size: 16px; letter-spacing: 2px; }
.dc-timer-wrap { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.dc-timer-ring { width: 38px; height: 38px; }
.dc-timer-ring circle { fill: none; stroke-width: 5; }
.dc-timer-track { stroke: rgba(148,163,184,0.18); }
.dc-timer-progress { stroke: var(--dc-cyan); stroke-linecap: round; transition: stroke-dashoffset 1s linear, stroke 0.3s ease; transform: rotate(-90deg); transform-origin: 50% 50%; }
.dc-timer-progress.dc-timer-warn { stroke: var(--dc-orange); }
.dc-timer-progress.dc-timer-danger { stroke: var(--dc-error); }

.dc-instruction { font-size: 14px; line-height: 1.5; padding: 12px; }
.dc-instruction-lines { margin: 6px 0 0; padding-left: 0; list-style: none; max-height: 118px; overflow-y: auto; }
.dc-instruction-lines li { padding: 5px 9px; margin-bottom: 3px; border-left: 3px solid var(--dc-purple); background: rgba(139,92,246,0.08); border-radius: 6px; opacity: 0.55; font-size: 13px; }
.dc-instruction-lines li.dc-step-active { opacity: 1; border-left-color: var(--dc-cyan); background: rgba(34,211,238,0.1); }
.dc-instruction-lines li.dc-step-done { opacity: 0.85; border-left-color: var(--dc-green); }

.dc-question-text { font-weight: 700; font-size: 15px; margin-top: 8px; }
.dc-hint-inline { font-size: 12px; color: var(--dc-text-2); margin-top: 8px; min-height: 16px; }

/* ---------- Map / grid ---------- */
.dc-mapwrap { display: flex; justify-content: center; padding: 6px; }
.dc-grid-outer { position: relative; overflow: auto; max-width: 100%; max-height: 190px; padding: 14px; }
.dc-grid {
  position: relative;
  background-image:
    linear-gradient(rgba(148,163,184,0.14) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148,163,184,0.14) 1px, transparent 1px);
  background-size: 30px 30px;
  border: 1px solid rgba(148,163,184,0.2);
  border-radius: 12px;
  box-shadow: inset 0 0 40px rgba(0,0,0,0.5), 0 10px 30px rgba(0,0,0,0.5);
  transform: perspective(700px) rotateX(6deg);
}
.dc-marker { position: absolute; width: 30px; height: 30px; margin-left: -15px; margin-top: -15px; display: flex; align-items: center; justify-content: center; font-size: 18px; transition: left 0.5s ease, top 0.5s ease; z-index: 2; }
.dc-marker-start { font-size: 12px; color: var(--dc-text-2); }
.dc-marker-start::before { content: "●"; color: var(--dc-cyan); }
.dc-marker-dest { animation: dc-dest-pulse calc(1.4s / var(--dc-anim,1)) ease-in-out infinite; }
@keyframes dc-dest-pulse { 0%,100% { transform: scale(1);} 50% { transform: scale(1.25);} }
.dc-marker-player { filter: drop-shadow(0 2px 6px rgba(34,211,238,0.6)); z-index: 3; }
.dc-compass-n { text-align: center; font-size: 12px; color: var(--dc-text-2); letter-spacing: 2px; margin-bottom: 4px; }

/* ---------- Mascot ---------- */
.dc-mascot { width: 28px; height: 28px; transition: transform 0.25s ease; flex: 0 0 auto; }
.dc-mascot.dc-m-correct { animation: dc-bounce calc(0.6s / var(--dc-anim,1)) ease; }
.dc-mascot.dc-m-wrong { animation: dc-shake calc(0.5s / var(--dc-anim,1)) ease; }
.dc-mascot.dc-m-celebrate { animation: dc-bounce calc(0.9s / var(--dc-anim,1)) ease infinite; }
@keyframes dc-bounce { 0%,100%{transform:translateY(0);} 50%{transform:translateY(-10px);} }
@keyframes dc-shake { 0%,100%{transform:translateX(0);} 25%{transform:translateX(-6px);} 75%{transform:translateX(6px);} }
.dc-mascot-msg { display: none; }

/* ---------- Compass ---------- */
.dc-compass { width: 100%; max-width: 260px; margin: 0 auto; display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.dc-compass-btn {
  aspect-ratio: 1; border-radius: 14px; border: 1px solid rgba(148,163,184,0.18);
  background: linear-gradient(180deg, #16263c, #0d1826);
  color: var(--dc-text); font-weight: 700; font-size: 12px; cursor: pointer;
  box-shadow: 0 3px 0 rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.05);
  display: flex; align-items: center; justify-content: center;
  min-height: 44px; min-width: 44px;
  transition: transform 0.12s ease;
}
.dc-compass-btn:hover { transform: translateY(-2px); }
.dc-compass-btn:active { transform: translateY(1px); box-shadow: 0 1px 0 rgba(0,0,0,0.4); }
.dc-compass-center { background: radial-gradient(circle, var(--dc-purple), #1a1030); font-size: 16px; }
.dc-compass-btn.dc-correct-flash { background: linear-gradient(180deg, var(--dc-green), #0f6b4f); }
.dc-compass-btn.dc-wrong-flash { background: linear-gradient(180deg, var(--dc-error), #7a1f2e); }

/* ---------- Answer buttons (mode 1) ---------- */
.dc-answers { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px,1fr)); gap: 10px; }
.dc-answer-btn {
  padding: 12px 8px; border-radius: 12px; border: 1px solid rgba(148,163,184,0.18);
  background: linear-gradient(180deg, #16263c, #0d1826); color: var(--dc-text);
  font-weight: 700; font-size: 13px; cursor: pointer; min-height: 44px;
  box-shadow: 0 4px 0 rgba(0,0,0,0.4);
  transition: transform 0.12s ease;
}
.dc-answer-btn:hover { transform: translateY(-2px); }
.dc-answer-btn:active { transform: translateY(1px); box-shadow: 0 1px 0 rgba(0,0,0,0.4); }
.dc-answer-btn.dc-correct-flash { background: linear-gradient(180deg, var(--dc-green), #0f6b4f); }
.dc-answer-btn.dc-wrong-flash { background: linear-gradient(180deg, var(--dc-error), #7a1f2e); }
.dc-answer-btn[disabled] { opacity: 0.55; cursor: not-allowed; }

/* ---------- Feedback popup ---------- */
.dc-feedback-pop {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(4,10,20,0.72); backdrop-filter: blur(2px); z-index: 20; border-radius: 20px;
  animation: dc-fade-in 0.2s ease;
}
.dc-feedback-card { max-width: 360px; width: 90%; text-align: center; }
.dc-feedback-title { font-size: 20px; font-weight: 800; margin-bottom: 6px; }
.dc-feedback-title.dc-good { color: var(--dc-green); }
.dc-feedback-title.dc-bad { color: var(--dc-error); }
.dc-feedback-row { display: flex; justify-content: space-between; font-size: 13px; color: var(--dc-text-2); margin: 4px 0; }
.dc-feedback-explain { font-size: 13px; color: var(--dc-text-2); margin-top: 10px; text-align: left; background: rgba(148,163,184,0.08); padding: 10px; border-radius: 10px; max-height: 160px; overflow-y: auto; }

/* ---------- Modal ---------- */
.dc-modal-backdrop { position: absolute; inset: 0; background: rgba(3,8,16,0.8); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.dc-modal { max-width: 440px; width: 100%; max-height: 85vh; overflow-y: auto; }
.dc-modal h3 { margin-top: 0; }
.dc-modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }

.dc-xp-pill { display: inline-block; background: rgba(34,211,238,0.12); color: var(--dc-cyan); padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.dc-streak-pill { display: inline-block; background: rgba(245,158,11,0.14); color: var(--dc-orange); padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }

.dc-footer-row { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; font-size: 12px; color: var(--dc-text-2); flex-wrap: wrap; gap: 8px;}
.dc-link-btn { background: none; border: none; color: var(--dc-cyan); cursor: pointer; text-decoration: underline; font-size: 12px; padding: 4px; min-height: 32px; }

/* ---------- Countdown (Go!) overlay ---------- */
.dc-countdown-card {
  width: min(92%, 460px);
  min-height: 220px;
  display: flex; align-items: center; justify-content: center;
  padding: 40px;
  background: radial-gradient(circle at 32% 28%, rgba(139,92,246,0.4), var(--dc-bg) 72%);
  border: 1px solid rgba(148,163,184,0.15);
}
.dc-countdown-number {
  font-size: clamp(72px, 20vw, 130px);
  font-weight: 900;
  line-height: 1;
  text-align: center;
  color: var(--dc-cyan);
  text-shadow: 0 0 28px rgba(34,211,238,0.85), 0 0 56px rgba(34,211,238,0.45);
  animation: dc-countdown-pop calc(0.5s / var(--dc-anim,1)) ease;
}
@keyframes dc-countdown-pop { 0% { transform: scale(0.6); opacity: 0; } 60% { transform: scale(1.08); opacity: 1; } 100% { transform: scale(1); } }

/* ---------- Pause overlay ---------- */
.dc-pause-card { max-width: 320px; text-align: center; }
.dc-pause-card h3 { margin-bottom: 4px; }

/* ---------- Settings ---------- */
.dc-settings-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid rgba(148,163,184,0.12); }
.dc-settings-row:last-of-type { border-bottom: none; }
.dc-settings-label { font-size: 14px; }
.dc-settings-sub { font-size: 12px; color: var(--dc-text-2); margin-top: 2px; }
.dc-toggle-btn { min-width: 84px; }
.dc-select {
  background: linear-gradient(180deg, #16263c, #0d1826);
  color: var(--dc-text); border: 1px solid rgba(148,163,184,0.25);
  border-radius: 10px; padding: 8px 10px; font-size: 13px; min-height: 40px;
}

@media (max-width: 640px) {
  .dc-stat-grid { grid-template-columns: repeat(2,1fr); }
  .dc-dash-actions { grid-template-columns: 1fr 1fr; }
  .dc-game-root { padding: 8px; }
  .dc-card { padding: 10px; }
  .dc-mini-mascot { display: none; }
  .dc-grid-outer { max-height: 130px; padding: 8px; }
  .dc-instruction { padding: 8px 10px; }
  .dc-instruction-lines { max-height: 84px; }
  .dc-compass { max-width: 220px; }
  .dc-countdown-card { padding: 28px 16px; min-height: 180px; }
  .dc-btn { padding: 10px 14px; font-size: 14px; }
  .dc-icon-btn { min-height: 34px; min-width: 34px; padding: 5px 8px; font-size: 13px; }
}
