* {
  box-sizing: border-box;
}

:root {
  --pink-50: #fff3f9;
  --pink-100: #ffe4f0;
  --pink-200: #ffc8df;
  --pink-400: #e979a6;
  --pink-600: #b83f74;

  --blue-50: #eff8ff;
  --blue-100: #dff1ff;
  --blue-200: #bfe4ff;
  --blue-700: #243f9f;
  --blue-900: #17235f;

  --gold-100: #fff1b8;
  --gold-400: #d9aa4f;

  --text: #263153;
  --muted: #68708a;
  --paper-strong: rgba(255, 255, 255, 0.96);
  --shadow-soft: 0 14px 34px rgba(33, 45, 104, 0.12);
  --shadow-card: 0 24px 70px rgba(47, 52, 118, 0.18);
}

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.74), transparent 26%),
    radial-gradient(circle at 88% 12%, rgba(191, 228, 255, 0.84), transparent 28%),
    radial-gradient(circle at 52% 42%, rgba(255, 241, 184, 0.30), transparent 33%),
    linear-gradient(135deg, var(--pink-50), var(--blue-50) 48%, #eee7ff);
  overflow: hidden;
}

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

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

.hidden {
  display: none !important;
}

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

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

.start-card {
  width: min(850px, 94vw);
  min-height: min(560px, 86vh);
  border-radius: 34px;
  background:
    radial-gradient(circle at 18% 10%, rgba(255, 200, 223, 0.42), transparent 32%),
    radial-gradient(circle at 82% 18%, rgba(191, 228, 255, 0.48), transparent 34%),
    var(--paper-strong);
  border: 2px solid rgba(217, 170, 79, 0.34);
  box-shadow: var(--shadow-card);
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
  padding: 32px;
  overflow: hidden;
  position: relative;
}

.start-card::before {
  content: "👑 ⚜️ 🏰";
  font-size: clamp(1.8rem, 6vw, 3rem);
  line-height: 1;
  margin-bottom: 4px;
}

.start-symbol {
  font-size: clamp(74px, 12vw, 130px);
  line-height: 1;
}

.start-card h1 {
  font-size: clamp(31px, 6vw, 66px);
  line-height: 0.98;
  margin: 8px 0;
  color: var(--blue-900);
  letter-spacing: -0.05em;
}

.start-card p {
  max-width: 700px;
  font-size: clamp(17px, 2.6vw, 28px);
  line-height: 1.25;
  margin: 8px 0 30px;
  color: #414a68;
  font-weight: 800;
}

#startBtn {
  font-size: clamp(21px, 3.5vw, 34px);
  padding: 16px 42px;
  border-radius: 999px;
  color: var(--blue-900);
  background:
    radial-gradient(circle at 28% 18%, rgba(255,255,255,.58), transparent 34%),
    linear-gradient(135deg, var(--pink-100), var(--blue-100));
  border: 2px solid rgba(217, 170, 79, 0.62);
  box-shadow:
    inset 0 2px 0 rgba(255,255,255,.46),
    0 8px 0 rgba(23, 35, 95, 0.16);
}

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

.game-header {
  min-height: 76px;
  border-radius: 26px;
  background:
    radial-gradient(circle at 18% 10%, rgba(255, 200, 223, 0.38), transparent 32%),
    radial-gradient(circle at 82% 18%, rgba(191, 228, 255, 0.42), transparent 34%),
    var(--paper-strong);
  border: 2px solid rgba(217, 170, 79, 0.26);
  box-shadow: var(--shadow-soft);
  padding: 10px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

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

.game-header p {
  font-size: clamp(15px, 2vw, 22px);
  margin: 5px 0 0;
  font-weight: 800;
  color: var(--muted);
}

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

.stat-box {
  min-width: 104px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--pink-100), var(--blue-100));
  padding: 8px 12px;
  text-align: center;
  border: 2px solid rgba(217, 170, 79, 0.34);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.52);
}

.stat-box span {
  display: block;
  font-size: 15px;
  font-weight: 900;
  color: var(--muted);
}

.stat-box strong {
  display: block;
  font-size: 32px;
  line-height: 1;
  color: var(--blue-900);
}

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

.left-panel,
.right-panel {
  min-height: 0;
  border-radius: 30px;
  background: linear-gradient(145deg, rgba(255,255,255,.94), rgba(239,248,255,.72));
  border: 2px solid rgba(217, 170, 79, 0.22);
  box-shadow: var(--shadow-card);
  padding: 12px;
}

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

.picture-card {
  min-height: 0;
  border-radius: 28px;
  background:
    radial-gradient(circle at 30% 16%, rgba(255,255,255,.56), transparent 38%),
    linear-gradient(145deg, var(--pink-100), var(--blue-100));
  border: 4px solid rgba(217, 170, 79, 0.50);
  display: grid;
  place-items: center;
  align-content: center;
  padding: 10px;
  overflow: hidden;
}

.task-image {
  width: min(66%, 280px);
  max-height: 55%;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 10px 14px rgba(23, 35, 95, 0.18));
}

.item-name {
  font-size: clamp(26px, 3.2vw, 40px);
  font-weight: 950;
  margin-top: 6px;
  color: var(--blue-900);
  letter-spacing: -0.03em;
  text-align: center;
}

.task-card {
  border-radius: 26px;
  background:
    radial-gradient(circle at 28% 18%, rgba(255,255,255,.56), transparent 35%),
    linear-gradient(145deg, #ffffff, var(--pink-100));
  border: 4px solid rgba(233, 121, 166, 0.46);
  padding: 10px;
  text-align: center;
}

.task-label {
  font-size: clamp(17px, 2.1vw, 28px);
  font-weight: 950;
  color: var(--muted);
}

.big-word {
  font-size: clamp(32px, 4.6vw, 68px);
  line-height: 1;
  font-weight: 950;
  letter-spacing: -0.035em;
  color: var(--blue-900);
  text-shadow: 0 3px 0 rgba(255,255,255,.86);
  word-break: break-word;
  overflow-wrap: anywhere;
  padding-top: 5px;
}

.feedback {
  min-height: 52px;
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(255,255,255,.86), rgba(223,241,255,.64));
  border: 3px solid rgba(191, 228, 255, 0.74);
  display: grid;
  place-items: center;
  text-align: center;
  padding: 7px 14px;
  font-size: clamp(17px, 2vw, 29px);
  font-weight: 950;
  color: var(--blue-900);
}

.feedback.good {
  color: #136d38;
  background: linear-gradient(135deg, #e7fff0, #dff1ff);
  border-color: #83dfaa;
}

.feedback.try {
  color: #9b5c00;
  background: linear-gradient(135deg, #fff1b8, #ffe4f0);
  border-color: #d9aa4f;
}

.restart-btn {
  justify-self: center;
  font-size: 18px;
  padding: 10px 24px;
  border-radius: 999px;
  color: var(--blue-900);
  background: linear-gradient(135deg, var(--pink-100), var(--blue-100));
  border: 2px solid rgba(217, 170, 79, 0.42);
  box-shadow: 0 5px 0 rgba(23, 35, 95, 0.16);
}

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

.pad-title {
  text-align: center;
  font-size: clamp(27px, 3.4vw, 40px);
  font-weight: 950;
  line-height: 1;
  color: var(--blue-900);
  letter-spacing: -0.04em;
}

.letter-pad {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.letter-pad button {
  min-width: 0;
  min-height: 0;
  border-radius: 18px;
  background:
    radial-gradient(circle at 28% 18%, rgba(255,255,255,.66), transparent 36%),
    linear-gradient(145deg, #ffffff, var(--blue-50));
  border: 3px solid rgba(217, 170, 79, 0.24);
  box-shadow: 0 5px 0 rgba(23, 35, 95, 0.14);
  font-size: clamp(25px, 2.8vw, 46px);
  color: var(--blue-900);
  line-height: 1;
}

.letter-pad button:hover {
  background: linear-gradient(145deg, #ffffff, var(--pink-100));
}

.letter-pad button.correct-flash {
  background: linear-gradient(145deg, #e7fff0, #b9ffd0);
  border-color: #62cf92;
  box-shadow: 0 5px 0 #319562;
}

.letter-pad button.wrong-flash {
  background: linear-gradient(145deg, #fff1b8, #ffd89b);
  border-color: #d9aa4f;
  box-shadow: 0 5px 0 #94601f;
}

.hint-box {
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(255,255,255,.86), rgba(255,228,240,.54));
  border: 3px solid rgba(233, 121, 166, 0.34);
  padding: 10px;
  font-size: clamp(14px, 1.7vw, 19px);
  line-height: 1.25;
  text-align: center;
  font-weight: 850;
  color: #45345c;
}

.picture-success {
  animation: pictureBounce 0.5s ease;
}

@keyframes pictureBounce {
  0% { transform: scale(1); }
  35% { transform: scale(1.08) rotate(-2deg); }
  70% { transform: scale(0.96) rotate(2deg); }
  100% { transform: scale(1); }
}

@media (max-width: 1100px), (max-height: 820px) {
  .game-screen {
    padding: 8px;
    gap: 8px;
  }

  .game-header {
    min-height: 60px;
    padding: 8px 15px;
    border-radius: 22px;
  }

  .game-header h1 {
    font-size: 30px;
  }

  .game-header p {
    font-size: 16px;
    margin-top: 2px;
  }

  .stat-box {
    min-width: 84px;
    padding: 6px 10px;
    border-radius: 17px;
  }

  .stat-box span {
    font-size: 13px;
  }

  .stat-box strong {
    font-size: 27px;
  }

  .game-layout {
    grid-template-columns: 0.95fr 1.05fr;
    gap: 8px;
  }

  .left-panel,
  .right-panel {
    padding: 8px;
    border-radius: 23px;
  }

  .left-panel {
    gap: 7px;
  }

  .picture-card {
    border-radius: 21px;
    border-width: 3px;
    padding: 8px;
  }

  .task-image {
    width: min(58%, 210px);
  }

  .item-name {
    font-size: 25px;
  }

  .task-card {
    border-radius: 21px;
    border-width: 3px;
    padding: 8px;
  }

  .task-label {
    font-size: 19px;
  }

  .big-word {
    font-size: clamp(28px, 4vw, 52px);
  }

  .feedback {
    min-height: 42px;
    border-radius: 17px;
    font-size: 19px;
    border-width: 2px;
  }

  .restart-btn {
    font-size: 16px;
    padding: 7px 19px;
  }

  .pad-title {
    font-size: 28px;
  }

  .letter-pad {
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
  }

  .letter-pad button {
    border-radius: 14px;
    border-width: 2px;
    font-size: clamp(22px, 2.6vw, 38px);
    box-shadow: 0 4px 0 rgba(23, 35, 95, 0.14);
  }

  .hint-box {
    font-size: 13px;
    padding: 7px;
    border-width: 2px;
  }
}

@media (max-width: 850px) {
  body {
    overflow: auto;
  }

  .app {
    height: auto;
    min-height: 100dvh;
  }

  .game-screen {
    height: auto;
    min-height: 100dvh;
    padding: 7px;
    gap: 7px;
  }

  .game-header {
    flex-direction: row;
    align-items: center;
    text-align: left;
    min-height: 62px;
    border-radius: 21px;
    padding: 7px 9px;
  }

  .game-header h1 {
    font-size: clamp(22px, 6.5vw, 31px);
  }

  .game-header p {
    font-size: clamp(12px, 3.2vw, 15px);
    margin-top: 2px;
  }

  .stats {
    gap: 5px;
  }

  .stat-box {
    min-width: 52px;
    padding: 4px 5px;
    border-radius: 14px;
  }

  .stat-box span {
    font-size: 10px;
  }

  .stat-box strong {
    font-size: 19px;
  }

  .game-layout {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .left-panel,
  .right-panel {
    min-height: auto;
    padding: 7px;
    border-radius: 20px;
  }

  .left-panel {
    grid-template-rows: auto auto auto auto;
    gap: 6px;
  }

  .picture-card {
    min-height: 132px;
    border-radius: 19px;
    padding: 7px;
  }

  .task-image {
    width: min(44%, 150px);
    max-height: 82px;
  }

  .item-name {
    font-size: clamp(19px, 5.6vw, 25px);
    margin-top: 3px;
  }

  .task-card {
    border-radius: 19px;
    padding: 7px;
  }

  .task-label {
    font-size: clamp(14px, 4.1vw, 19px);
  }

  .big-word {
    font-size: clamp(28px, 8vw, 48px);
  }

  .feedback {
    min-height: 38px;
    font-size: clamp(14px, 4.3vw, 19px);
    padding: 5px 8px;
  }

  .restart-btn {
    font-size: 14px;
    padding: 6px 14px;
  }

  .right-panel {
    gap: 6px;
  }

  .pad-title {
    font-size: clamp(21px, 6.5vw, 28px);
  }

  .letter-pad {
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
  }

  .letter-pad button {
    min-height: 48px;
    font-size: clamp(23px, 7.2vw, 32px);
    border-radius: 13px;
    box-shadow: 0 4px 0 rgba(23, 35, 95, 0.14);
  }

  .hint-box {
    font-size: 12px;
    padding: 6px;
  }
}

@media (max-width: 520px) {
  .start-screen {
    padding: 7px;
  }

  .start-card {
    width: 100%;
    min-height: calc(100dvh - 14px);
    border-radius: 24px;
    padding: 18px 12px;
  }

  .start-symbol {
    font-size: 68px;
  }

  .start-card h1 {
    font-size: clamp(29px, 9vw, 42px);
  }

  .start-card p {
    font-size: clamp(15px, 4.7vw, 20px);
    margin-bottom: 20px;
  }

  #startBtn {
    width: min(100%, 310px);
    font-size: 21px;
    padding: 14px 22px;
  }

  .game-screen {
    padding: 5px;
    gap: 5px;
  }

  .game-header {
    padding: 6px 7px;
    gap: 6px;
  }

  .game-header h1 {
    font-size: 21px;
  }

  .game-header p {
    font-size: 11px;
  }

  .stat-box {
    min-width: 47px;
    padding: 4px;
  }

  .stat-box span {
    font-size: 9px;
  }

  .stat-box strong {
    font-size: 18px;
  }

  .left-panel,
  .right-panel {
    padding: 6px;
    border-radius: 18px;
  }

  .picture-card {
    min-height: 116px;
  }

  .task-image {
    width: min(42%, 128px);
    max-height: 70px;
  }

  .item-name {
    font-size: 19px;
  }

  .big-word {
    font-size: 29px;
  }

  .letter-pad {
    grid-template-columns: repeat(5, 1fr);
    gap: 5px;
  }

  .letter-pad button {
    min-height: 42px;
    font-size: 22px;
    border-radius: 12px;
  }

  .hint-box {
    font-size: 11px;
  }
}

@media (max-width: 370px) {
  .game-header h1 {
    font-size: 19px;
  }

  .game-header p {
    display: none;
  }

  .stat-box {
    min-width: 44px;
  }

  .picture-card {
    min-height: 104px;
  }

  .task-image {
    max-height: 60px;
  }

  .item-name {
    font-size: 17px;
  }

  .big-word {
    font-size: 25px;
  }

  .letter-pad button {
    min-height: 38px;
    font-size: 20px;
  }
}


/* ==========================================================
   UPDATE: IN DER AUFGABEN-KACHEL STEHT NUR DER ANFANGSBUCHSTABE
========================================================== */

.big-letter-alone {
  font-size: clamp(88px, 13vw, 160px);
  line-height: 0.86;
  font-weight: 950;
  color: var(--blue-900);
  text-shadow: 0 3px 0 rgba(255,255,255,.86);
  letter-spacing: 0;
  padding-top: 2px;
}

@media (max-width: 1100px), (max-height: 820px) {
  .big-letter-alone {
    font-size: clamp(76px, 11vw, 128px);
  }
}

@media (max-width: 850px) {
  .big-letter-alone {
    font-size: clamp(72px, 20vw, 112px);
    line-height: 0.88;
  }

  .task-label {
    font-size: clamp(15px, 4.2vw, 19px);
  }
}

@media (max-width: 520px) {
  .big-letter-alone {
    font-size: clamp(66px, 21vw, 96px);
  }
}


/* ==========================================================
   26-BUCHSTABEN-RUNDE + ABSCHLUSS-BELOHNUNG
========================================================== */

.stat-box strong {
  white-space: nowrap;
}

.finish-overlay {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 200, 223, 0.35), transparent 30%),
    radial-gradient(circle at 50% 80%, rgba(191, 228, 255, 0.28), transparent 32%),
    rgba(18, 24, 58, 0.68);
  backdrop-filter: blur(9px);
}

.finish-overlay.hidden {
  display: none !important;
}

.finish-card {
  width: min(560px, 100%);
  border-radius: 34px;
  padding: clamp(22px, 5vw, 38px);
  text-align: center;
  background:
    radial-gradient(circle at 20% 8%, rgba(255,255,255,.94), transparent 34%),
    radial-gradient(circle at 80% 16%, rgba(255,200,223,.45), transparent 34%),
    linear-gradient(145deg, #ffffff, var(--blue-50), var(--pink-100));
  border: 4px solid rgba(217, 170, 79, 0.70);
  box-shadow: 0 30px 90px rgba(12, 10, 25, 0.42);
  animation: finishPop .32s ease both;
}

.finish-crown {
  font-size: clamp(58px, 15vw, 100px);
  line-height: 1;
  filter: drop-shadow(0 10px 18px rgba(23, 35, 95, 0.16));
}

.finish-card h2 {
  margin: 10px 0 8px;
  font-size: clamp(32px, 8vw, 56px);
  line-height: 0.96;
  color: var(--blue-900);
  letter-spacing: -0.05em;
}

.finish-card p {
  margin: 0 auto 18px;
  max-width: 420px;
  color: #414a68;
  font-size: clamp(18px, 4.5vw, 24px);
  line-height: 1.28;
  font-weight: 850;
}

.finish-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 18px 0;
}

.finish-stats div {
  border-radius: 22px;
  padding: 12px;
  background: rgba(255,255,255,.72);
  border: 2px solid rgba(217, 170, 79, 0.34);
}

.finish-stats span {
  display: block;
  color: var(--muted);
  font-weight: 900;
  font-size: 14px;
}

.finish-stats strong {
  display: block;
  color: var(--blue-900);
  font-size: clamp(28px, 7vw, 40px);
  line-height: 1;
}

#finishRestartBtn {
  min-height: 54px;
  padding: 13px 24px;
  border-radius: 999px;
  color: var(--blue-900);
  background:
    radial-gradient(circle at 28% 18%, rgba(255,255,255,.58), transparent 34%),
    linear-gradient(135deg, var(--pink-100), var(--blue-100));
  border: 2px solid rgba(217, 170, 79, 0.62);
  box-shadow:
    inset 0 2px 0 rgba(255,255,255,.46),
    0 6px 0 rgba(23, 35, 95, 0.16);
  font-size: clamp(18px, 4.5vw, 24px);
  font-weight: 950;
}

@keyframes finishPop {
  from {
    opacity: 0;
    transform: scale(.92) translateY(12px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@media (max-width: 520px) {
  .finish-overlay {
    padding: 10px;
  }

  .finish-card {
    border-radius: 26px;
  }

  .finish-stats {
    gap: 8px;
  }
}
