:root {
  --bg-cream: #fff7ef;
  --bg-mint: #eaf7f3;
  --card: rgba(255, 255, 255, 0.82);
  --card-strong: rgba(255, 255, 255, 0.96);
  --ink: #173040;
  --ink-soft: #48616f;
  --coral: #f46d52;
  --coral-soft: rgba(244, 109, 82, 0.16);
  --mint: #2a9d8f;
  --mint-soft: rgba(42, 157, 143, 0.16);
  --sand: #e6b85c;
  --sand-soft: rgba(230, 184, 92, 0.2);
  --ink-accent: #25485f;
  --ink-soft-fill: rgba(37, 72, 95, 0.1);
  --danger: #d1495b;
  --danger-soft: rgba(209, 73, 91, 0.12);
  --shadow: 0 24px 60px rgba(52, 81, 102, 0.14);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --border: rgba(23, 48, 64, 0.08);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family: "Trebuchet MS", "Gill Sans", "Verdana", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(244, 109, 82, 0.18), transparent 32%),
    radial-gradient(circle at right 15% top 20%, rgba(42, 157, 143, 0.18), transparent 28%),
    linear-gradient(145deg, var(--bg-cream), var(--bg-mint));
  overflow-x: hidden;
}

button,
input,
table {
  font: inherit;
}

.background-orb,
.background-grid {
  position: fixed;
  inset: auto;
  pointer-events: none;
}

.background-orb {
  width: 28rem;
  height: 28rem;
  border-radius: 999px;
  filter: blur(42px);
  opacity: 0.38;
}

.orb-a {
  top: -10rem;
  right: -7rem;
  background: rgba(244, 109, 82, 0.36);
}

.orb-b {
  bottom: -10rem;
  left: -6rem;
  background: rgba(42, 157, 143, 0.25);
}

.background-grid {
  inset: 0;
  background-image:
    linear-gradient(rgba(23, 48, 64, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 48, 64, 0.04) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.5), transparent 90%);
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1240px, calc(100% - 32px));
  margin: 28px auto 44px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
  border-radius: var(--radius-lg);
}

.reveal {
  animation: rise-in 0.7s ease both;
}

.reveal:nth-child(2) {
  animation-delay: 0.08s;
}

.reveal:nth-child(3) {
  animation-delay: 0.16s;
}

.hero {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 24px;
  padding: 30px;
  margin-bottom: 24px;
}

.eyebrow,
.section-label {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  color: var(--ink-soft);
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Palatino Linotype", "Book Antiqua", "Georgia", serif;
  letter-spacing: -0.03em;
}

h1 {
  font-size: clamp(2.2rem, 4vw, 3.6rem);
  line-height: 0.96;
}

h2 {
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  line-height: 1;
}

h3 {
  font-size: 1.2rem;
}

.hero-text,
.metric-detail,
.focus-caption,
.tile-foot,
.feedback-message,
.layout-hint {
  color: var(--ink-soft);
}

.hero-text {
  max-width: 50ch;
  font-size: 1.05rem;
  line-height: 1.55;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

.button {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 700;
  cursor: pointer;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:active {
  transform: translateY(1px);
}

.button:disabled {
  cursor: not-allowed;
  transform: none;
  opacity: 0.5;
  box-shadow: none;
}

.button-primary {
  background: linear-gradient(135deg, var(--coral), #ff9068);
  color: white;
  box-shadow: 0 14px 28px rgba(244, 109, 82, 0.26);
}

.button-secondary {
  background: linear-gradient(135deg, var(--mint), #52b7ab);
  color: white;
  box-shadow: 0 14px 28px rgba(42, 157, 143, 0.24);
}

.button-ghost {
  background: rgba(255, 255, 255, 0.8);
  color: var(--ink);
}

.button-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.hero-metrics {
  display: grid;
  gap: 16px;
}

.metric-block {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  padding: 22px;
  border-radius: var(--radius-md);
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.84), rgba(255, 255, 255, 0.58)),
    rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(23, 48, 64, 0.08);
}

.metric-block strong {
  font-size: 1.35rem;
}

.metric-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.top-grid,
.bottom-grid {
  display: grid;
  gap: 24px;
  margin-bottom: 24px;
}

.top-grid {
  grid-template-columns: 1.06fr 0.94fr;
}

.bottom-grid {
  grid-template-columns: 1fr;
}

.practice,
.session,
.keyboard,
.leaderboard {
  padding: 28px;
}

.practice-header,
.session-header,
.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.status-pill,
.session-badge {
  align-self: center;
  padding: 9px 14px;
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.status-pill.idle {
  background: rgba(37, 72, 95, 0.12);
  color: var(--ink-accent);
}

.status-pill.live {
  background: var(--mint-soft);
  color: var(--mint);
}

.status-pill.flash-correct {
  background: rgba(42, 157, 143, 0.24);
  color: var(--mint);
}

.status-pill.flash-wrong {
  background: var(--danger-soft);
  color: var(--danger);
}

.session-badge {
  background: var(--sand-soft);
  color: #9f6915;
}

.target-display {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 300px;
  margin: 26px 0 24px;
  border-radius: 30px;
  background:
    radial-gradient(circle at top, rgba(244, 109, 82, 0.22), transparent 35%),
    radial-gradient(circle at bottom right, rgba(42, 157, 143, 0.18), transparent 36%),
    linear-gradient(155deg, var(--card-strong), rgba(255, 255, 255, 0.72));
  border: 1px solid rgba(23, 48, 64, 0.08);
  overflow: hidden;
}

.target-display::after {
  content: "";
  position: absolute;
  inset: 18px;
  border-radius: 24px;
  border: 1px dashed rgba(23, 48, 64, 0.12);
}

.target-display span {
  position: relative;
  z-index: 1;
  font-family: "Palatino Linotype", "Book Antiqua", "Georgia", serif;
  font-size: clamp(7rem, 20vw, 10.5rem);
  line-height: 1;
  letter-spacing: 0.02em;
  text-shadow: 0 10px 30px rgba(23, 48, 64, 0.12);
}

.target-display.live {
  animation: target-pulse 1.9s ease-in-out infinite;
}

.target-display.idle span {
  opacity: 0.55;
}

.target-display.correct {
  animation: success-flash 0.45s ease;
}

.target-display.wrong {
  animation: wrong-shift 0.35s ease;
}

.attempt-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.attempt-stat {
  padding: 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(23, 48, 64, 0.07);
}

.attempt-label {
  display: block;
  font-size: 0.82rem;
  color: var(--ink-soft);
  margin-bottom: 8px;
}

.attempt-stat strong {
  font-size: 1.3rem;
}

.practice-feedback {
  margin-top: 18px;
}

.feedback-message,
.layout-hint {
  margin: 0;
  font-size: 0.98rem;
  min-height: 1.6em;
}

.layout-hint {
  color: var(--danger);
  margin-top: 8px;
}

.hidden {
  visibility: hidden;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 22px;
}

.stat-tile {
  padding: 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(23, 48, 64, 0.06);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tile-label {
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.stat-tile strong {
  font-size: 1.55rem;
}

.accent-coral {
  box-shadow: inset 0 0 0 1px rgba(244, 109, 82, 0.12);
  background:
    linear-gradient(180deg, rgba(244, 109, 82, 0.12), transparent 55%),
    rgba(255, 255, 255, 0.86);
}

.accent-mint {
  box-shadow: inset 0 0 0 1px rgba(42, 157, 143, 0.12);
  background:
    linear-gradient(180deg, rgba(42, 157, 143, 0.12), transparent 55%),
    rgba(255, 255, 255, 0.86);
}

.accent-sand {
  box-shadow: inset 0 0 0 1px rgba(230, 184, 92, 0.12);
  background:
    linear-gradient(180deg, rgba(230, 184, 92, 0.18), transparent 55%),
    rgba(255, 255, 255, 0.86);
}

.accent-ink {
  box-shadow: inset 0 0 0 1px rgba(37, 72, 95, 0.12);
  background:
    linear-gradient(180deg, rgba(37, 72, 95, 0.12), transparent 55%),
    rgba(255, 255, 255, 0.86);
}

.focus-panel {
  margin-top: 20px;
}

.focus-letters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.focus-chip {
  padding: 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(23, 48, 64, 0.07);
}

.focus-chip strong {
  display: block;
  font-family: "Palatino Linotype", "Book Antiqua", "Georgia", serif;
  font-size: 2rem;
  line-height: 1;
  margin-bottom: 8px;
}

.focus-chip p {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.4;
}

.keyboard-map {
  display: grid;
  gap: 12px;
  margin-top: 24px;
}

.keyboard-row {
  display: flex;
  gap: 12px;
  flex-wrap: nowrap;
}

.keyboard-key {
  position: relative;
  min-width: 54px;
  min-height: 64px;
  border-radius: 18px;
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(23, 48, 64, 0.07);
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;
}

.keyboard-key:hover {
  transform: translateY(-2px);
}

.keyboard-key .letter {
  font-family: "Palatino Linotype", "Book Antiqua", "Georgia", serif;
  font-size: 1.65rem;
  line-height: 1;
}

.keyboard-key .meta {
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.keyboard-key.target {
  transform: translateY(-3px);
  box-shadow: 0 18px 32px rgba(42, 157, 143, 0.18);
  border-color: rgba(42, 157, 143, 0.38);
  animation: target-key 1.35s ease-in-out infinite;
}

.keyboard-key.untouched {
  background:
    linear-gradient(180deg, rgba(37, 72, 95, 0.06), transparent 50%),
    rgba(255, 255, 255, 0.68);
}

.leaderboard table {
  width: 100%;
  border-collapse: collapse;
}

.leaderboard-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.leaderboard-pill {
  position: relative;
  overflow: hidden;
  padding: 18px 20px 20px;
  border-radius: 22px;
  border: 1px solid rgba(23, 48, 64, 0.07);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(255, 255, 255, 0.82));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.58),
    0 12px 28px rgba(52, 81, 102, 0.08);
}

.leaderboard-pill::after {
  content: "";
  position: absolute;
  inset: auto -2rem -2.8rem auto;
  width: 8rem;
  height: 8rem;
  border-radius: 999px;
  opacity: 0.9;
}

.leaderboard-pill-attempts {
  background:
    radial-gradient(circle at top right, rgba(244, 109, 82, 0.16), transparent 36%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(255, 255, 255, 0.82));
}

.leaderboard-pill-attempts::after {
  background: rgba(244, 109, 82, 0.12);
}

.leaderboard-pill-study {
  background:
    radial-gradient(circle at top right, rgba(42, 157, 143, 0.16), transparent 36%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(255, 255, 255, 0.82));
}

.leaderboard-pill-study::after {
  background: rgba(42, 157, 143, 0.12);
}

.leaderboard-pill-label {
  display: block;
  position: relative;
  z-index: 1;
  margin-bottom: 10px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.leaderboard-pill strong {
  position: relative;
  z-index: 1;
  display: block;
  margin-bottom: 6px;
  font-family: "Palatino Linotype", "Book Antiqua", "Georgia", serif;
  font-size: clamp(2rem, 3vw, 2.55rem);
  line-height: 0.95;
  letter-spacing: -0.03em;
}

.leaderboard-pill-note {
  position: relative;
  z-index: 1;
  display: block;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.table-wrap {
  margin-top: 20px;
  overflow-x: auto;
}

th,
td {
  text-align: left;
  padding: 14px 12px;
  border-bottom: 1px solid rgba(23, 48, 64, 0.08);
  white-space: nowrap;
}

th {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}

td strong {
  font-family: "Palatino Linotype", "Book Antiqua", "Georgia", serif;
  font-size: 1.55rem;
  line-height: 1;
}

.trend-up {
  color: var(--danger);
  font-weight: 700;
}

.trend-down {
  color: var(--mint);
  font-weight: 700;
}

.trend-flat {
  color: var(--ink-soft);
  font-weight: 700;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes target-pulse {
  0%,
  100% {
    box-shadow: inset 0 0 0 1px rgba(23, 48, 64, 0.08);
  }

  50% {
    box-shadow:
      inset 0 0 0 1px rgba(42, 157, 143, 0.18),
      0 0 0 12px rgba(42, 157, 143, 0.06);
  }
}

@keyframes success-flash {
  0% {
    transform: scale(0.99);
  }

  45% {
    transform: scale(1.02);
    box-shadow: 0 26px 44px rgba(42, 157, 143, 0.2);
  }

  100% {
    transform: scale(1);
  }
}

@keyframes wrong-shift {
  0%,
  100% {
    transform: translateX(0);
  }

  20% {
    transform: translateX(-4px);
  }

  60% {
    transform: translateX(6px);
  }
}

@keyframes target-key {
  0%,
  100% {
    box-shadow: 0 18px 32px rgba(42, 157, 143, 0.18);
  }

  50% {
    box-shadow: 0 20px 34px rgba(244, 109, 82, 0.2);
  }
}

@media (max-width: 1080px) {
  .hero,
  .top-grid {
    grid-template-columns: 1fr;
  }

  .focus-letters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .app-shell {
    width: min(100% - 18px, 1240px);
    margin: 18px auto 28px;
  }

  .hero,
  .practice,
  .session,
  .keyboard,
  .leaderboard {
    padding: 22px;
  }

  .stats-grid,
  .attempt-strip,
  .focus-letters,
  .leaderboard-summary {
    grid-template-columns: 1fr;
  }

  .keyboard-key {
    min-width: 44px;
    min-height: 58px;
    padding: 10px;
  }
}

@media (max-width: 640px) {
  .hero-actions {
    flex-direction: column;
  }

  .button {
    width: 100%;
  }

  .practice-header,
  .session-header,
  .panel-header {
    flex-direction: column;
  }

  .target-display {
    min-height: 220px;
  }

  .keyboard-row {
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .keyboard-key {
    flex: 0 0 58px;
  }
}
