* {
  box-sizing: border-box;
}

:root {
  --pink-50: #fff3f9;
  --pink-100: #ffe4f0;
  --pink-200: #ffc8df;
  --blue-50: #eff8ff;
  --blue-100: #dff1ff;
  --blue-200: #bfe4ff;
  --blue-900: #17235f;
  --gold-100: #fff1b8;
  --gold-400: #d9aa4f;
  --text: #263153;
  --muted: #68708a;
  --paper: rgba(255, 255, 255, 0.94);
  --radius-xl: 30px;
  --radius-lg: 24px;
  --radius-pill: 999px;
  --shadow-card: 0 20px 58px rgba(47, 52, 118, 0.18);
  --shadow-soft: 0 10px 24px rgba(33, 45, 104, 0.11);
}

html,
body {
  margin: 0;
  width: 100%;
  min-height: 100%;
}

html {
  background: var(--blue-100);
}

body {
  font-family: Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 8%, rgba(255, 200, 223, 0.72), transparent 26%),
    radial-gradient(circle at 88% 12%, rgba(191, 228, 255, 0.82), transparent 28%),
    radial-gradient(circle at 52% 60%, rgba(255, 241, 184, 0.26), transparent 32%),
    linear-gradient(135deg, var(--pink-50), var(--blue-50) 52%, #eee7ff);
  overflow: hidden;
}

button {
  border: 0;
  cursor: pointer;
  font-family: inherit;
  font-weight: 950;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

button:active {
  transform: scale(0.97);
}

.hidden {
  display: none !important;
}

.app {
  width: 100vw;
  height: 100dvh;
}

/* START */
.start-screen {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  padding: 18px;
}

.start-card {
  width: min(760px, 94vw);
  min-height: min(520px, 84vh);
  border-radius: 38px;
  background:
    radial-gradient(circle at 18% 10%, rgba(255, 200, 223, 0.32), transparent 34%),
    radial-gradient(circle at 86% 18%, rgba(191, 228, 255, 0.38), transparent 36%),
    var(--paper);
  border: 2px solid rgba(217, 170, 79, 0.32);
  box-shadow: var(--shadow-card);
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
  padding: 30px;
}

.start-crown {
  font-size: clamp(38px, 7vw, 58px);
  line-height: 1;
  margin-bottom: 14px;
}

.start-card h1 {
  font-size: clamp(42px, 7vw, 72px);
  line-height: 0.94;
  margin: 0 0 18px;
  color: var(--blue-900);
  letter-spacing: -0.06em;
}

.start-card p {
  max-width: 620px;
  font-size: clamp(19px, 2.5vw, 28px);
  line-height: 1.25;
  margin: 0 0 32px;
  font-weight: 850;
}

#startBtn,
#finishRestartBtn {
  font-size: clamp(22px, 3vw, 32px);
  padding: 18px 42px;
  border-radius: var(--radius-pill);
  background:
    radial-gradient(circle at 28% 18%, rgba(255,255,255,.58), transparent 34%),
    linear-gradient(135deg, var(--gold-100), var(--pink-100));
  color: var(--blue-900);
  border: 2px solid rgba(217, 170, 79, 0.68);
  box-shadow: 0 7px 0 rgba(148, 96, 31, 0.42);
}

/* SPIEL */
.game-screen {
  width: 100%;
  height: 100%;
  padding: 12px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 10px;
}

.game-header {
  min-height: 74px;
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, rgba(255, 243, 249, 0.96), rgba(239, 248, 255, 0.96));
  border: 2px solid rgba(217, 170, 79, 0.28);
  box-shadow: var(--shadow-soft);
  padding: 10px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.game-title h1 {
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1;
  margin: 0;
  color: var(--blue-900);
  letter-spacing: -0.04em;
}

.game-title p {
  font-size: clamp(15px, 1.8vw, 20px);
  margin: 4px 0 0;
  font-weight: 850;
  color: var(--muted);
}

.stats {
  display: flex;
  gap: 10px;
}

.stat-box {
  min-width: 104px;
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255,228,240,.64), rgba(223,241,255,.70));
  padding: 8px 12px;
  text-align: center;
  border: 2px solid rgba(217, 170, 79, 0.30);
}

.stat-box span {
  display: block;
  font-size: 14px;
  font-weight: 950;
  color: #525a75;
}

.stat-box strong {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 3px;
  font-size: 31px;
  line-height: 1;
  color: #202020;
}

.stat-box small {
  font-size: 22px;
}

.game-layout {
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 0.92fr;
  gap: 10px;
}

.left-panel,
.right-panel {
  min-height: 0;
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at 16% 8%, rgba(255, 200, 223, 0.25), transparent 32%),
    radial-gradient(circle at 88% 14%, rgba(191, 228, 255, 0.30), transparent 34%),
    var(--paper);
  border: 2px solid rgba(217, 170, 79, 0.24);
  box-shadow: var(--shadow-card);
  padding: 12px;
}

.left-panel {
  display: grid;
  grid-template-rows: 1fr auto auto auto;
  gap: 10px;
}

.dot-card {
  min-height: 0;
  border-radius: 28px;
  background:
    radial-gradient(circle at 30% 14%, rgba(255,255,255,.70), transparent 36%),
    linear-gradient(145deg, var(--pink-100), var(--blue-100));
  border: 4px solid rgba(217, 170, 79, 0.58);
  display: grid;
  grid-template-rows: auto 1fr;
  align-items: center;
  justify-items: center;
  gap: 8px;
  padding: 16px;
}

.dot-label {
  min-height: 34px;
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  background: rgba(255,255,255,.76);
  border: 2px solid rgba(217, 170, 79, 0.32);
  color: var(--blue-900);
  font-size: clamp(18px, 2.2vw, 26px);
  font-weight: 950;
}

.dot-display {
  width: min(100%, 620px);
  min-height: 150px;
  display: grid;
  grid-template-columns: repeat(5, minmax(34px, 1fr));
  gap: clamp(8px, 1.4vw, 16px);
  justify-content: center;
  align-content: center;
}

.dot {
  aspect-ratio: 1 / 1;
  border-radius: 999px;
  background:
    radial-gradient(circle at 32% 26%, rgba(255,255,255,.82), transparent 30%),
    linear-gradient(145deg, var(--pink-200), var(--blue-200));
  border: 3px solid rgba(217, 170, 79, 0.72);
  box-shadow:
    inset 0 2px 0 rgba(255,255,255,.62),
    0 5px 0 rgba(23, 35, 95, 0.13);
}

.empty-zero {
  width: min(100%, 420px);
  min-height: 130px;
  border-radius: 26px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: clamp(36px, 6vw, 72px);
  font-weight: 950;
  background: rgba(255,255,255,.58);
  border: 3px dashed rgba(217, 170, 79, 0.46);
}

.task-card {
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(255,228,240,.75), rgba(223,241,255,.75));
  border: 3px solid rgba(217, 170, 79, 0.36);
  padding: 12px;
  text-align: center;
}

.task-label {
  font-size: clamp(19px, 2.3vw, 28px);
  font-weight: 950;
  color: var(--blue-900);
}

.hint-number {
  margin-top: 3px;
  font-size: clamp(16px, 1.8vw, 22px);
  font-weight: 900;
  color: #4e5564;
}

.feedback {
  min-height: 52px;
  border-radius: 20px;
  background: rgba(255,255,255,.78);
  border: 3px solid rgba(0,0,0,.08);
  display: grid;
  place-items: center;
  text-align: center;
  padding: 7px 14px;
  font-size: clamp(20px, 2.3vw, 30px);
  font-weight: 950;
}

.feedback.good {
  color: #138a1d;
  background: #e7ffe3;
  border-color: #87db7b;
}

.feedback.try {
  color: #a96800;
  background: #fff1cc;
  border-color: #ffc95c;
}

.restart-btn {
  justify-self: center;
  font-size: 18px;
  padding: 10px 24px;
  border-radius: var(--radius-pill);
  color: var(--blue-900);
  background: #f3f3f3;
  box-shadow: 0 5px 0 #c9c9c9;
}

.right-panel {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 10px;
}

.pad-title {
  text-align: center;
  font-size: clamp(30px, 3.5vw, 43px);
  font-weight: 950;
  line-height: 1;
  color: var(--blue-900);
}

.number-pad {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.number-pad button {
  min-width: 0;
  min-height: 0;
  border-radius: 22px;
  background: #ffffff;
  border: 3px solid rgba(0,0,0,.08);
  box-shadow: 0 5px 0 rgba(0,0,0,.18);
  font-size: clamp(40px, 6vw, 78px);
  color: #202020;
  line-height: 1;
}

.number-pad button.correct-flash {
  background: #a4ff91;
  border-color: #5ad64a;
  box-shadow: 0 5px 0 #3ca331;
}

.number-pad button.wrong-flash {
  background: #ffd47c;
  border-color: #ffb02e;
  box-shadow: 0 5px 0 #c47d00;
}

.hint-box {
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255,255,255,.78), rgba(223,241,255,.62));
  border: 2px solid rgba(191, 228, 255, 0.88);
  padding: 10px;
  font-size: clamp(15px, 1.6vw, 19px);
  line-height: 1.25;
  text-align: center;
  font-weight: 850;
  color: #34425c;
}

.finish-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(23, 35, 95, 0.42);
  backdrop-filter: blur(8px);
}

.finish-card {
  width: min(620px, 94vw);
  border-radius: 34px;
  background:
    radial-gradient(circle at 18% 10%, rgba(255, 200, 223, 0.38), transparent 34%),
    radial-gradient(circle at 86% 18%, rgba(191, 228, 255, 0.44), transparent 36%),
    #ffffff;
  border: 3px solid rgba(217, 170, 79, 0.58);
  box-shadow: var(--shadow-card);
  text-align: center;
  padding: 28px;
}

.finish-icon {
  font-size: 44px;
  margin-bottom: 8px;
}

.finish-card h2 {
  margin: 0 0 10px;
  color: var(--blue-900);
  font-size: clamp(30px, 5vw, 48px);
  line-height: 1;
}

.finish-card p {
  font-size: clamp(17px, 2vw, 22px);
  font-weight: 850;
  margin: 0 0 18px;
}

.finish-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 22px;
}

.finish-stats div {
  border-radius: 20px;
  background: linear-gradient(135deg, var(--pink-100), var(--blue-100));
  border: 2px solid rgba(217, 170, 79, 0.32);
  padding: 12px;
}

.finish-stats span {
  display: block;
  font-size: 14px;
  font-weight: 950;
  color: #525a75;
}

.finish-stats strong {
  display: block;
  font-size: 32px;
  color: #202020;
}

.dot-success {
  animation: dotBounce 0.5s ease;
}

@keyframes dotBounce {
  0% { transform: scale(1); }
  35% { transform: scale(1.05); }
  70% { transform: scale(0.97); }
  100% { transform: scale(1); }
}

@media (max-width: 1100px), (max-height: 820px) {
  .game-screen { padding: 8px; gap: 8px; }
  .game-header { min-height: 62px; padding: 7px 14px; border-radius: 20px; }
  .game-title h1 { font-size: 31px; }
  .game-title p { font-size: 15px; }
  .stat-box { min-width: 88px; padding: 6px 9px; border-radius: 15px; }
  .stat-box span { font-size: 12px; }
  .stat-box strong { font-size: 25px; }
  .game-layout { gap: 8px; }
  .left-panel, .right-panel { padding: 9px; border-radius: 22px; gap: 8px; }
  .dot-card { border-radius: 22px; padding: 10px; gap: 6px; }
  .dot-display { min-height: 116px; grid-template-columns: repeat(5, minmax(28px, 1fr)); gap: 8px; }
  .empty-zero { min-height: 92px; font-size: 42px; border-radius: 20px; }
  .task-card { border-radius: 20px; padding: 9px; }
  .task-label { font-size: 21px; }
  .hint-number { font-size: 16px; }
  .feedback { min-height: 44px; font-size: 21px; }
  .pad-title { font-size: 31px; }
  .number-pad { gap: 8px; }
  .number-pad button { border-radius: 18px; font-size: clamp(35px, 5.2vw, 64px); }
  .hint-box { font-size: 14px; padding: 8px; }
}

@media (max-width: 850px) {
  body { overflow: auto; }
  .app { height: auto; min-height: 100dvh; }
  .game-screen { height: auto; min-height: 100dvh; }
  .game-header { flex-direction: column; text-align: center; }
  .stats { width: 100%; justify-content: center; }
  .game-layout { grid-template-columns: 1fr; }
  .left-panel, .right-panel { min-height: auto; }
  .dot-card { min-height: 210px; }
  .number-pad button { min-height: 72px; }
}

@media (max-width: 520px) {
  .start-screen { padding: 8px; }
  .start-card { min-height: calc(100dvh - 16px); border-radius: 28px; padding: 22px 14px; }
  .start-crown { font-size: 34px; }
  .start-card h1 { font-size: clamp(36px, 11vw, 52px); margin-bottom: 13px; }
  .start-card p { font-size: 18px; margin-bottom: 24px; }
  #startBtn { width: min(100%, 420px); font-size: 26px; padding: 16px 26px; }
  .game-screen { padding: 7px; }
  .game-title h1 { font-size: 26px; }
  .game-title p { font-size: 13px; }
  .stats { gap: 8px; }
  .stat-box { min-width: 96px; }
  .dot-card { min-height: 165px; }
  .dot-display { min-height: 92px; grid-template-columns: repeat(5, minmax(22px, 1fr)); gap: 6px; }
  .dot { border-width: 2px; }
  .empty-zero { min-height: 74px; font-size: 32px; }
  .dot-label { min-height: 30px; font-size: 16px; }
  .task-label { font-size: 19px; }
  .feedback { min-height: 42px; font-size: 19px; }
  .restart-btn { font-size: 16px; padding: 8px 18px; }
  .pad-title { font-size: 28px; }
  .number-pad { gap: 7px; }
  .number-pad button { min-height: 58px; border-radius: 15px; font-size: 31px; }
  .hint-box { font-size: 13px; }
}

@media (max-height: 690px) and (min-width: 851px) {
  .dot-display { min-height: 86px; }
  .empty-zero { min-height: 70px; }
  .feedback { min-height: 38px; }
  .number-pad button { font-size: 34px; }
}


/* ==========================================================
   UPDATE: Zahlenwort + Eingabefeld
========================================================== */

.dot-card {
  grid-template-rows: 1fr auto;
}

.number-word {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  background:
    radial-gradient(circle at 28% 18%, rgba(255,255,255,.72), transparent 34%),
    linear-gradient(135deg, var(--gold-100), var(--pink-100));
  border: 2px solid rgba(217, 170, 79, 0.62);
  color: var(--blue-900);
  font-size: clamp(24px, 3vw, 42px);
  font-weight: 950;
  line-height: 1;
  box-shadow: 0 5px 0 rgba(23, 35, 95, 0.13);
}

.answer-form {
  width: min(100%, 480px);
  margin: 10px auto 0;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: end;
}

.answer-label {
  grid-column: 1 / -1;
  color: #4e5564;
  font-size: clamp(14px, 1.7vw, 18px);
  font-weight: 900;
}

.answer-input {
  min-width: 0;
  width: 100%;
  min-height: 58px;
  border-radius: 18px;
  border: 3px solid rgba(217, 170, 79, 0.52);
  background: rgba(255,255,255,.92);
  color: #202020;
  font-family: Arial, sans-serif;
  font-size: clamp(30px, 4vw, 48px);
  font-weight: 950;
  text-align: center;
  outline: none;
  box-shadow: inset 0 2px 0 rgba(255,255,255,.70);
}

.answer-input:focus {
  border-color: var(--blue-900);
  box-shadow:
    inset 0 2px 0 rgba(255,255,255,.70),
    0 0 0 4px rgba(191, 228, 255, 0.85);
}

.answer-submit {
  min-height: 58px;
  padding: 0 18px;
  border-radius: 18px;
  background:
    radial-gradient(circle at 28% 18%, rgba(255,255,255,.58), transparent 34%),
    linear-gradient(135deg, var(--blue-100), var(--pink-100));
  color: var(--blue-900);
  border: 3px solid rgba(217, 170, 79, 0.52);
  font-size: clamp(18px, 2vw, 24px);
  box-shadow: 0 5px 0 rgba(23, 35, 95, 0.14);
}

@media (max-width: 1100px), (max-height: 820px) {
  .number-word {
    min-height: 36px;
    font-size: clamp(20px, 2.5vw, 32px);
    padding: 6px 14px;
  }

  .answer-form {
    margin-top: 7px;
    gap: 6px;
  }

  .answer-input,
  .answer-submit {
    min-height: 48px;
    border-radius: 15px;
  }

  .answer-input {
    font-size: 32px;
  }
}

@media (max-width: 520px) {
  .number-word {
    min-height: 34px;
    font-size: 24px;
  }

  .answer-form {
    grid-template-columns: 1fr 64px;
  }

  .answer-input,
  .answer-submit {
    min-height: 46px;
  }

  .answer-input {
    font-size: 30px;
  }

  .answer-submit {
    font-size: 18px;
    padding: 0 12px;
  }
}


/* ==========================================================
   UPDATE: 10 neben 9 + normales Textfeld ohne Pfeile
========================================================== */

.number-pad {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.number-pad button {
  aspect-ratio: 2.1 / 1;
  min-height: 0;
}

.answer-input {
  appearance: textfield;
  -moz-appearance: textfield;
}

.answer-input::-webkit-outer-spin-button,
.answer-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

@media (max-width: 850px) {
  .number-pad {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .number-pad button {
    min-height: 62px;
    aspect-ratio: auto;
  }
}

@media (max-width: 520px) {
  .number-pad {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px;
  }

  .number-pad button {
    min-height: 50px;
    font-size: 27px;
  }
}

@media (max-width: 370px) {
  .number-pad button {
    min-height: 46px;
    font-size: 24px;
  }
}
