@import url("https://fonts.googleapis.com/css2?family=Public+Sans:wght@400;500;600;700;800&family=IBM+Plex+Mono:wght@500&display=swap");

:root {
  --bg: #e7e2d8;
  --bg-alt: #dde3e7;
  --panel: #fbfaf7;
  --panel-soft: #f1ede5;
  --line: #d6cfc2;
  --line-strong: #b7ad9c;
  --text: #17181c;
  --muted: #68645c;
  --focus: #385f84;
  --accent: #1e3a52;
  --accent-hover: #162c3f;
  --shadow: 0 18px 42px rgba(28, 24, 18, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  font-family: "Public Sans", "Segoe UI", system-ui, sans-serif;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.35), transparent 24%),
    linear-gradient(135deg, var(--bg) 0%, #efebe4 52%, var(--bg-alt) 100%);
}

body {
  display: grid;
  place-items: center;
  padding: 28px;
}

.app {
  width: min(760px, 100%);
  padding: 28px 30px 30px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  animation: panelIn 220ms ease;
}

@keyframes panelIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.995);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 28px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

h1 {
  margin: 0;
  font-size: clamp(1.3rem, 2.4vw, 1.55rem);
  font-weight: 800;
  letter-spacing: -0.04em;
}

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

.pill {
  min-width: 92px;
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  text-align: left;
  background: var(--panel-soft);
}

.pill-label {
  color: var(--muted);
  font-family: "IBM Plex Mono", "Consolas", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pill-value {
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.screen {
  width: 100%;
  min-height: 360px;
  display: none;
  align-content: center;
  gap: 18px;
  animation: screenIn 180ms ease;
}

.screen.active {
  display: grid;
}

@keyframes screenIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

h2,
p {
  margin: 0;
}

h2 {
  font-size: clamp(1.4rem, 2.8vw, 1.95rem);
  font-weight: 800;
  letter-spacing: -0.04em;
}

.subtitle {
  max-width: 50ch;
  color: var(--muted);
  line-height: 1.6;
  font-size: 1rem;
}

.subtitle strong {
  color: var(--text);
}

#start-screen,
#end-screen {
  justify-items: start;
  text-align: left;
  max-width: 560px;
}

#game-screen {
  justify-items: center;
  text-align: center;
  min-height: 340px;
}

.word-wrap {
  width: 100%;
  padding: 40px 0 24px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.word {
  margin: 0;
  font-size: clamp(2.4rem, 9vw, 4.7rem);
  font-weight: 800;
  letter-spacing: -0.05em;
  word-break: break-word;
  color: var(--text);
}

.actions {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 8px;
}

button {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
  font-family: inherit;
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  background: #ffffff;
  cursor: pointer;
  transition: border-color 140ms ease, background-color 140ms ease, color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

button:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  background: #f7f4ee;
}

button:active {
  transform: translateY(0);
}

button:focus-visible {
  outline: 0;
  border-color: var(--focus);
  box-shadow: 0 0 0 4px rgba(56, 95, 132, 0.12);
}

.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #f7f8fa;
}

.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.secondary {
  background: var(--panel-soft);
}

.secondary:hover {
  background: #ebe6dc;
}

#start-screen button,
#end-screen button {
  min-width: 170px;
}

@media (max-width: 680px) {
  body {
    padding: 16px;
  }

  .app {
    padding: 22px 18px 20px;
    border-radius: 18px;
  }

  .header {
    align-items: flex-start;
    margin-bottom: 22px;
    padding-bottom: 16px;
  }

  .screen {
    min-height: 320px;
  }

  .word {
    font-size: clamp(2.2rem, 16vw, 4rem);
  }

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

  button {
    padding: 16px;
  }
}
