:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1f2430;
  --text: #e9ecf1;
  --muted: #aeb6c2;
  --accent: #5da9ff;
  --accent-2: #7bde8b;
  --danger: #ff6a6a;

  --btn-size: 120px;        /* target button min size */
  --btn-radius: 18px;       /* rounded, not circular */
  --gap: 18px;
  --font-big: 22px;
  --font-med: 18px;
  --font-small: 14px;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  background: radial-gradient(1200px 800px at 20% -20%, #151923 0%, #0f1115 55%) fixed;
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--panel);
  border-bottom: 1px solid #222836;
}

.app-title {
  margin: 0;
  font-size: 26px;
  letter-spacing: 0.3px;
}

.controls {
  display: flex;
  align-items: center;
  gap: var(--gap);
  flex-wrap: wrap;
}

.control {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--font-med);
  background: var(--panel-2);
  padding: 8px 12px;
  border-radius: 12px;
}

.control select,
.control input[type="number"] {
  background: #0d1016;
  color: var(--text);
  border: 1px solid #2a3142;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: var(--font-med);
  min-width: 150px;
}

.dwell-time {
  display: none; /* shown when dwell is on */
}

.btn {
  font-size: var(--font-med);
  padding: 12px 18px;
  border-radius: 12px;
  border: 1px solid #2a3142;
  background: #0d1016;
  color: var(--text);
  cursor: pointer;
  transition: transform 0.05s ease, background 0.2s ease, border-color 0.2s ease;
  min-width: 140px;
}

.btn:hover,
.btn:focus-visible {
  background: #131822;
  border-color: var(--accent);
  outline: none;
}

.btn.primary {
  background: linear-gradient(180deg, #1d66ff, #0f4dd5);
  border: none;
}

.btn.primary:hover,
.btn.primary:focus-visible {
  filter: brightness(1.05);
}

.layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
  padding: var(--gap);
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }
}

.clock-wrap {
  background: var(--panel);
  border: 1px solid #20283a;
  border-radius: 24px;
  padding: 18px;
  display: grid;
  place-items: center;
  gap: 10px;
}

#clock {
  width: min(92%, 540px);
  height: auto;
  display: block;
  filter: drop-shadow(0 15px 30px rgba(0,0,0,0.35));
}

.face-outline {
  fill: #0b0e14;
  stroke: #2a3142;
  stroke-width: 6;
}

.tick-minute {
  stroke: #3a4359;
  stroke-width: 2;
}

.tick-hour {
  stroke: #93a1c1;
  stroke-width: 4;
}

.clock-number {
  fill: var(--text);
  font-size: 22px;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0,0,0,0.35);
}

.hand {
  stroke-linecap: round;
  /* Do not set transform-origin here; JS uses the SVG transform attribute. */
  vector-effect: non-scaling-stroke; /* keeps line width consistent when scaled */
}


.hand.hour {
  stroke: #ffffff;
  stroke-width: 8;
}

.hand.minute {
  stroke: var(--accent);
  stroke-width: 6;
}

.hand-pin {
  fill: #ffffff;
  stroke: #000000;
  stroke-width: 1;
}

.feedback {
  min-height: 28px;
  font-size: var(--font-big);
  font-weight: 700;
  text-align: center;
}

.score {
  color: var(--muted);
  font-size: var(--font-med);
}

.answers {
  background: var(--panel);
  border: 1px solid #20283a;
  border-radius: 24px;
  padding: 18px;
  display: grid;
  grid-template-columns: repeat(2, minmax(200px, 1fr));
  gap: var(--gap);
  align-content: start;
}

@media (max-width: 640px) {
  .answers {
    grid-template-columns: 1fr;
  }
}

.answer-btn {
  min-height: var(--btn-size);
  font-size: 28px;
  font-weight: 800;
  border-radius: var(--btn-radius);
  border: 2px solid #2a3142;
  background: linear-gradient(180deg, #121723 0%, #0c0f17 100%);
  color: var(--text);
  cursor: pointer;
  position: relative;
  outline: none;
}

.answer-btn:hover,
.answer-btn:focus-visible {
  border-color: var(--accent);
}

.answer-btn.correct {
  outline: 0;
  border-color: #2f8f5b;
  background: linear-gradient(180deg, #1a3e2c, #0e261b);
}

.answer-btn.wrong {
  outline: 0;
  border-color: var(--danger);
  animation: wobble 180ms ease 0s 2;
}

@keyframes wobble {
  0%   { transform: translateX(0); }
  25%  { transform: translateX(-6px); }
  50%  { transform: translateX(6px); }
  75%  { transform: translateX(-4px); }
  100% { transform: translateX(0); }
}

/* Dwell progress bar inside each answer */
.answer-btn .dwell-bar {
  position: absolute;
  left: 0;
  top: 0;
  height: 6px;
  width: 0%;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-2) 100%);
  border-radius: var(--btn-radius) var(--btn-radius) 0 0;
  pointer-events: none;
}

/* Footer */
.footer {
  color: var(--muted);
  padding: 10px 18px 28px;
  text-align: center;
}

/* Accessibility focus */
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .answer-btn.wrong {
    animation: none;
  }
}
