:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #6fc9f7;
  color: #172033;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 0;
  min-height: 100vh;
  margin: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 16%, rgba(255, 247, 174, 0.88) 0 78px, transparent 80px),
    linear-gradient(#76d5ff 0%, #c6f0ff 52%, #8fda72 52%, #4ea04b 100%);
}

.game-shell {
  position: relative;
  width: min(100vw, calc(100vh * 16 / 9), 1280px);
  aspect-ratio: 16 / 9;
  height: auto;
  display: grid;
  place-items: center;
  background: #7fd7ff;
  box-shadow: 0 20px 70px rgba(23, 32, 51, 0.22);
  overflow: hidden;
}

canvas {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: auto;
  background: #7fd7ff;
}

.hud {
  position: absolute;
  z-index: 5;
  top: 18px;
  left: 22px;
  display: flex;
  gap: 10px;
  align-items: center;
  pointer-events: none;
}

.hud-group {
  min-width: 104px;
  height: 52px;
  padding: 7px 14px;
  border: 2px solid rgba(255, 255, 255, 0.8);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 8px 18px rgba(31, 72, 98, 0.18);
  backdrop-filter: blur(4px);
}

.hud-label {
  display: block;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  color: #426072;
  text-transform: uppercase;
}

.hud strong {
  display: block;
  margin-top: 4px;
  font-size: 23px;
  line-height: 1;
  color: #162239;
}

.hearts {
  display: flex !important;
  gap: 5px;
  align-items: center;
  min-height: 25px;
}

.heart {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  display: grid;
  place-items: center;
  filter: drop-shadow(0 2px 0 rgba(116, 24, 42, 0.16));
}

.heart::before {
  content: "\2665";
  color: #e7354f;
  font-size: 25px;
  line-height: 1;
}

.heart.empty::before {
  color: #c6ced5;
}

.shield-pill.active {
  background: rgba(210, 247, 255, 0.92);
  border-color: #47c9df;
}

.controls {
  position: absolute;
  z-index: 5;
  right: 22px;
  bottom: 18px;
  display: flex;
  gap: 8px;
  align-items: center;
  color: rgba(22, 34, 57, 0.82);
  pointer-events: none;
}

.controls span {
  height: 34px;
  min-width: 76px;
  padding: 8px 11px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(255, 255, 255, 0.78);
  box-shadow: 0 6px 12px rgba(35, 67, 94, 0.12);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.question-dialog {
  width: 420px;
  max-width: calc(100vw - 40px);
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: #fffdf4;
  color: #172033;
  box-shadow: 0 26px 90px rgba(21, 31, 47, 0.32);
}

.game-over-dialog {
  width: 380px;
  max-width: calc(100vw - 40px);
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: #fffdf4;
  color: #172033;
  box-shadow: 0 26px 90px rgba(21, 31, 47, 0.32);
}

.question-dialog::backdrop {
  background: rgba(34, 47, 73, 0.38);
  backdrop-filter: blur(2px);
}

.game-over-dialog::backdrop {
  background: rgba(34, 47, 73, 0.45);
  backdrop-filter: blur(2px);
}

.question-dialog form,
.game-over-dialog form {
  padding: 28px;
}

.dialog-kicker {
  display: inline-block;
  color: #30757f;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.question-dialog h1 {
  margin: 6px 0 14px;
  font-size: 54px;
  line-height: 1;
  letter-spacing: 0;
}

.question-timer {
  width: 100%;
  height: 12px;
  overflow: hidden;
  border-radius: 8px;
  background: #d8e4e8;
  border: 1px solid rgba(49, 82, 98, 0.16);
}

#questionTimerFill {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #36c57c, #ffd044, #ef4d5d);
  transform-origin: left center;
  transition: width 120ms linear;
}

.question-time-text {
  display: block;
  margin: 6px 0 14px;
  color: #3e5268;
  font-size: 13px;
  font-weight: 900;
  text-align: right;
}

.game-over-dialog h1 {
  margin: 8px 0 4px;
  font-size: 32px;
  line-height: 1;
  letter-spacing: 0;
}

.game-over-dialog strong {
  display: block;
  margin-bottom: 14px;
  color: #172033;
  font-size: 64px;
  line-height: 1;
}

.question-dialog label,
.game-over-dialog label {
  display: block;
  margin-bottom: 8px;
  color: #3e5268;
  font-size: 13px;
  font-weight: 800;
}

.name-input {
  width: 100%;
  height: 44px;
  margin-bottom: 8px;
  border: 2px solid #9ac7d1;
  border-radius: 8px;
  padding: 0 12px;
  color: #172033;
  font-size: 20px;
  font-weight: 900;
  outline: 0;
}

.name-input:focus {
  border-color: #2fb7d0;
  box-shadow: 0 0 0 4px rgba(47, 183, 208, 0.18);
}

.saved-score-status {
  min-height: 18px;
  margin: 0 0 10px;
  color: #30757f;
  font-size: 12px;
  font-weight: 900;
}

.scoreboard {
  margin: 0 0 16px;
  padding: 12px;
  border: 1px solid rgba(48, 117, 127, 0.18);
  border-radius: 8px;
  background: rgba(232, 248, 251, 0.76);
}

.scoreboard h2 {
  margin: 0 0 8px;
  color: #30757f;
  font-size: 12px;
  line-height: 1;
  letter-spacing: 0;
  text-transform: uppercase;
}

.scoreboard ol {
  min-height: 24px;
  max-height: 128px;
  margin: 0;
  padding-left: 22px;
  overflow: auto;
}

.scoreboard li {
  margin: 2px 0;
  color: #172033;
  font-size: 13px;
  font-weight: 800;
}

.scoreboard .score-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.answer-row {
  display: flex;
  gap: 10px;
}

.answer-row input {
  width: 160px;
  height: 48px;
  border: 2px solid #9ac7d1;
  border-radius: 8px;
  padding: 0 12px;
  font-size: 26px;
  font-weight: 900;
  outline: 0;
}

.answer-row input:focus {
  border-color: #2fb7d0;
  box-shadow: 0 0 0 4px rgba(47, 183, 208, 0.18);
}

.answer-row button {
  height: 48px;
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  background: #ffb72b;
  color: #2e2100;
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: inset 0 -3px 0 rgba(108, 71, 0, 0.18);
}

.answer-row button:hover {
  background: #ffc44f;
}

.game-over-dialog button {
  width: 100%;
  height: 50px;
  border: 0;
  border-radius: 8px;
  background: #ffb72b;
  color: #2e2100;
  font-size: 16px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: inset 0 -3px 0 rgba(108, 71, 0, 0.18);
}

.game-over-dialog button:hover {
  background: #ffc44f;
}

#questionFeedback {
  min-height: 22px;
  margin: 14px 0 0;
  color: #4c5a66;
  font-weight: 800;
}

.toast {
  position: absolute;
  z-index: 4;
  left: 50%;
  top: 92px;
  min-width: 220px;
  padding: 12px 18px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  color: #172033;
  text-align: center;
  font-weight: 900;
  opacity: 0;
  transform: translate(-50%, -10px);
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ── Tablet dokunmatik kontroller ── */
.touch-controls {
  position: absolute;
  z-index: 10;
  bottom: 20px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0 24px;
  pointer-events: none;
}

.touch-dpad {
  display: flex;
  gap: 12px;
  pointer-events: none;
}

.touch-btn {
  pointer-events: all;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.35);
  color: rgba(22, 34, 57, 0.85);
  font-size: 32px;
  font-weight: 900;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  -webkit-tap-highlight-color: transparent;
  transition: background 80ms ease, transform 80ms ease;
}

.touch-btn:active {
  background: rgba(255, 255, 255, 0.55);
  transform: scale(0.92);
}

.touch-jump-btn {
  width: 96px;
  height: 96px;
  background: rgba(255, 183, 43, 0.55);
  border-color: rgba(255, 183, 43, 0.85);
}

.touch-jump-btn:active {
  background: rgba(255, 196, 79, 0.75);
}
