@font-face {
  font-family: "Magyar Script";
  src:
    local("Magyar Script"),
    url("https://cdn.jsdelivr.net/gh/krisztina-nk/betukartya@f3acaacffcc959bdaace7480555ef8f197324d10/magyar-script-basic.woff") format("woff"),
    url("https://raw.githubusercontent.com/krisztina-nk/betukartya/f3acaacffcc959bdaace7480555ef8f197324d10/magyar-script-basic.woff") format("woff");
  font-display: swap;
}

:root {
  --bg: #eff6ff;
  --card: #ffffff;
  --card-soft: #f8fbff;
  --text: #10233e;
  --muted: #58708f;
  --line: rgba(47, 128, 237, 0.12);
  --line-strong: rgba(47, 128, 237, 0.2);
  --primary: #2f80ed;
  --primary-strong: #1f6fe0;
  --secondary: #8ebcf7;
  --success: #1ba97f;
  --danger: #d95d5d;
  --shadow: 0 18px 44px rgba(47, 128, 237, 0.12);
  --shadow-soft: 0 10px 28px rgba(16, 35, 62, 0.08);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --base-font-size: 16px;
  --ui-font: "Avenir Next", "Trebuchet MS", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  font-family: var(--ui-font);
  background:
    radial-gradient(circle at top left, rgba(145, 196, 255, 0.3), transparent 24%),
    radial-gradient(circle at 90% 8%, rgba(47, 128, 237, 0.12), transparent 18%),
    linear-gradient(180deg, color-mix(in srgb, white 72%, var(--bg)) 0%, var(--bg) 100%);
}

body {
  font-size: var(--base-font-size);
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(47, 128, 237, 0.22);
  outline-offset: 3px;
}

#app {
  min-height: 100vh;
  padding: 22px 16px 28px;
}

.shell {
  width: min(1120px, 100%);
  margin: 0 auto;
}

.hero {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
}

.hero-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.hero-copy {
  display: grid;
  gap: 8px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
  box-shadow: var(--shadow-soft);
}

.title {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.1rem);
  line-height: 1.03;
  letter-spacing: -0.03em;
}

.microcopy {
  margin: 0;
  max-width: 44rem;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.55;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 12px;
}

.stat-pill {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(245, 250, 255, 0.92));
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}

.stat-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stat-value {
  display: block;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
}

.setup-layout {
  display: grid;
  gap: 18px;
}

.panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 251, 255, 0.94));
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.panel-inner {
  padding: 20px;
}

.control-stack {
  display: grid;
  gap: 14px;
}

.control-card {
  padding: 16px;
  border-radius: var(--radius-lg);
  background: var(--card-soft);
  border: 1px solid var(--line);
}

.section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.section-index {
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #5da6ff, var(--primary));
  color: #fff;
  font-size: 0.82rem;
  font-weight: 800;
  box-shadow: 0 10px 18px rgba(47, 128, 237, 0.2);
}

.section-title {
  margin: 0;
  font-size: 1.03rem;
  font-weight: 800;
}

.section-hint {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.5;
}

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

.chip-button,
.primary-button,
.secondary-button,
.ghost-button {
  min-height: 46px;
  padding: 0 16px;
  border-radius: 999px;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.chip-button {
  color: var(--text);
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line-strong);
  box-shadow: none;
  font-weight: 700;
}

.chip-button:hover,
.secondary-button:hover,
.ghost-button:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
}

.chip-button.active {
  color: #fff;
  background: linear-gradient(135deg, #59a4ff, var(--primary));
  border-color: transparent;
  box-shadow: 0 12px 22px rgba(47, 128, 237, 0.22);
}

.primary-button {
  color: #fff;
  background: linear-gradient(135deg, #59a4ff, var(--primary));
  box-shadow: 0 14px 26px rgba(47, 128, 237, 0.22);
  font-weight: 800;
}

.primary-button:hover {
  transform: translateY(-1px) scale(1.01);
  background: linear-gradient(135deg, #5aa9ff, var(--primary-strong));
}

.primary-button[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.secondary-button {
  color: #fff;
  background: linear-gradient(135deg, #7eb7ff, #5f9ef5);
  box-shadow: 0 12px 20px rgba(47, 128, 237, 0.16);
  font-weight: 800;
}

.ghost-button {
  color: var(--text);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line-strong);
  font-weight: 700;
}

.preview-note {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.82);
  color: var(--muted);
  border: 1px solid var(--line);
  min-height: 50px;
}

.start-panel {
  display: grid;
  gap: 12px;
}

.start-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.meta-box {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
}

.meta-label {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.meta-value {
  display: block;
  margin-top: 6px;
  font-size: 1rem;
  font-weight: 800;
}

.letters-panel {
  overflow: hidden;
}

.letters-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.letters-headline {
  display: grid;
  gap: 6px;
}

.letters-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 800;
}

.letters-subtitle {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.letters-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.letters-grid-wrap {
  padding: 8px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(241, 247, 255, 0.95), rgba(255, 255, 255, 0.9));
  border: 1px solid var(--line);
}

.letters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(68px, 1fr));
  gap: 10px;
  max-height: 420px;
  overflow: auto;
  padding: 4px;
}

.letter-option {
  min-height: 66px;
  display: grid;
  place-items: center;
  padding: 10px 8px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff 0%, #f4f9ff 100%);
  color: var(--text);
  font-size: 1.15rem;
  font-family: "Times New Roman", "Palatino Linotype", Georgia, serif;
  font-weight: 400;
  letter-spacing: 0;
  box-shadow: 0 8px 18px rgba(47, 128, 237, 0.08);
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.letter-option:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(47, 128, 237, 0.12);
}

.letter-option.selected {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, #5da6ff, var(--primary));
  box-shadow: 0 14px 24px rgba(47, 128, 237, 0.22);
}

.game-layout {
  display: grid;
  gap: 18px;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.topbar-copy {
  display: grid;
  gap: 8px;
}

.game-stage {
  display: grid;
  gap: 16px;
  justify-items: center;
}

.letter-stage {
  width: min(760px, 100%);
  min-height: 360px;
  display: grid;
  place-items: center;
  padding: 28px;
  border-radius: 34px;
  background:
    radial-gradient(circle at top, rgba(145, 196, 255, 0.2), transparent 40%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 251, 255, 0.96));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.current-letter {
  font-size: clamp(8rem, 25vw, 14rem);
  line-height: 1;
  color: var(--primary);
  text-align: center;
  animation: letter-in 260ms ease;
}

.counter {
  color: var(--muted);
  font-weight: 800;
  font-size: 1rem;
}

.game-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.speed-card {
  width: min(520px, 100%);
  padding: 16px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}

.speed-label {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-weight: 700;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--primary);
}

.toast {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  padding: 11px 16px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 12px 28px rgba(217, 93, 93, 0.24);
}

@keyframes letter-in {
  from {
    opacity: 0;
    transform: scale(0.92);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@media (min-width: 900px) {
  #app {
    padding: 28px 24px 36px;
  }

  .setup-layout {
    grid-template-columns: 340px minmax(0, 1fr);
    align-items: start;
  }

  .control-column {
    position: sticky;
    top: 22px;
  }
}

@media (max-width: 899px) {
  .hero-stats {
    grid-template-columns: 1fr;
  }

  .letters-grid {
    max-height: 340px;
  }
}

@media (max-width: 640px) {
  .title {
    font-size: 1.9rem;
  }

  .hero-top,
  .topbar {
    align-items: flex-start;
  }

  .panel-inner {
    padding: 16px;
  }

  .letters-grid {
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 8px;
  }

  .letter-stage {
    min-height: 280px;
    border-radius: 24px;
  }
}
