:root {
  --bg: #111118;
  --surface: #1b1b25;
  --surface-light: #242430;
  --border: rgba(255, 255, 255, 0.09);
  --text: #f7f7fb;
  --muted: #9999aa;
  --accent: #9b7cff;
  --accent-light: #b59cff;
  --success: #72d6a0;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 50% -10%, rgba(155, 124, 255, 0.13), transparent 38%),
    var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  display: flex;
  justify-content: center;
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
}

.app {
  width: 100%;
  max-width: 760px;
  min-height: 100vh;
  padding: 28px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.screen {
  width: 100%;
  animation: appear 0.3s ease;
}

.hidden {
  display: none !important;
}

/* Start */

.start-screen,
.finish-screen {
  text-align: center;
  max-width: 620px;
  margin: auto;
}

.logo {
  width: 76px;
  height: 76px;
  margin: 0 auto 26px;
  border-radius: 24px;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 42px;
  font-weight: 800;
  box-shadow: 0 16px 45px rgba(155, 124, 255, 0.25);
  transform: rotate(-4deg);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-light);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: -0.045em;
}

h1 {
  font-size: clamp(52px, 11vw, 82px);
  line-height: 0.95;
}

h1 span {
  color: var(--accent-light);
}

h2 {
  font-size: clamp(36px, 7vw, 54px);
}

.subtitle {
  max-width: 560px;
  margin: 20px auto 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.55;
}

.example {
  max-width: 480px;
  margin: 34px auto;
  padding: 18px 22px;
  display: flex;
  align-items: center;
  gap: 18px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
}

.example-letter {
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: rgba(155, 124, 255, 0.16);
  color: var(--accent-light);
  font-size: 25px;
  font-weight: 850;
}

.example-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.example-text strong {
  font-size: 14px;
  letter-spacing: 0.06em;
}

.example-text span {
  color: var(--muted);
  font-size: 14px;
}

.hint {
  margin: 15px 0 0;
  color: #666676;
  font-size: 12px;
}

/* Buttons */

.primary-button,
.secondary-button {
  min-height: 54px;
  border-radius: 15px;
  padding: 0 24px;
  border: 0;
  cursor: pointer;
  font-weight: 750;
  transition:
    transform 0.15s ease,
    background 0.15s ease,
    opacity 0.15s ease;
}

.primary-button {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 12px 30px rgba(155, 124, 255, 0.2);
}

.primary-button:hover {
  background: var(--accent-light);
  transform: translateY(-2px);
}

.primary-button:active,
.secondary-button:active {
  transform: translateY(0);
}

.primary-button span {
  margin-left: 8px;
  font-size: 20px;
}

.secondary-button {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

.secondary-button:hover {
  background: var(--surface);
  color: var(--text);
}

/* Game */

.game-screen {
  max-width: 680px;
  margin: auto;
}

.game-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.letter {
  width: 94px;
  height: 94px;
  margin-top: 7px;
  display: grid;
  place-items: center;
  border-radius: 24px;
  background: var(--accent);
  font-size: 54px;
  line-height: 1;
  font-weight: 850;
  box-shadow: 0 14px 35px rgba(155, 124, 255, 0.2);
}

.progress {
  width: 180px;
  padding-bottom: 4px;
  text-align: right;
}

.progress > span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.progress-track {
  height: 6px;
  margin-top: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-light);
}

.progress-bar {
  width: 20%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.25s ease;
}

.rule-card {
  min-height: 60px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
}

.rule-icon {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(155, 124, 255, 0.15);
  color: var(--accent-light);
  font-weight: 900;
}

.rule-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

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

.word-area {
  min-height: 330px;
  margin: 20px 0;
  padding: 45px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  border-radius: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.word-label {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.word {
  max-width: 100%;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: clamp(42px, 10vw, 76px);
  line-height: 1;
  font-weight: 900;
  letter-spacing: -0.055em;
  text-transform: uppercase;
}

.word-number {
  margin: 22px 0 0;
  color: #676778;
  font-size: 13px;
}

.game-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

/* Finish */

.finish-icon {
  width: 88px;
  height: 88px;
  margin: 0 auto 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(114, 214, 160, 0.14);
  color: var(--success);
  font-size: 44px;
  font-weight: 700;
}

.finish-screen .primary-button {
  margin-top: 30px;
}

/* Focus */

button:focus-visible {
  outline: 3px solid rgba(181, 156, 255, 0.55);
  outline-offset: 3px;
}

/* Mobile */

@media (max-width: 560px) {
  .app {
    padding: 18px 14px;
    align-items: stretch;
  }

  .screen {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: calc(100vh - 36px);
  }

  .logo {
    width: 64px;
    height: 64px;
    margin-bottom: 22px;
    border-radius: 20px;
    font-size: 36px;
  }

  .subtitle {
    font-size: 15px;
  }

  .example {
    margin: 28px auto;
    padding: 15px;
    gap: 13px;
  }

  .example-letter {
    width: 46px;
    height: 46px;
    font-size: 22px;
  }

  .example-text span {
    font-size: 13px;
  }

  .game-header {
    align-items: flex-end;
  }

  .letter {
    width: 76px;
    height: 76px;
    border-radius: 20px;
    font-size: 43px;
  }

  .progress {
    width: 145px;
  }

  .word-area {
    min-height: 330px;
  }

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

  .secondary-button {
    min-height: 48px;
  }
}

@media (max-height: 700px) and (min-width: 561px) {
  .word-area {
    min-height: 250px;
  }
}

/* Animations */

@keyframes appear {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
