:root {
  --bg: #fff7f3;
  --bg-soft: #fffdf8;
  --ink: #372f35;
  --muted: #7b6f77;
  --rose: #f4a7b9;
  --rose-deep: #cf667f;
  --mint: #bfe8d4;
  --sky: #b8d8f6;
  --lavender: #d6c7f2;
  --lemon: #f8e6a5;
  --line: rgba(91, 71, 82, 0.16);
  --shadow: 0 20px 50px rgba(88, 55, 69, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 12%, rgba(248, 230, 165, 0.55), transparent 28rem),
    radial-gradient(circle at 92% 4%, rgba(191, 232, 212, 0.55), transparent 24rem),
    linear-gradient(135deg, #fff7f3 0%, #f8fbff 50%, #fffdf8 100%);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

body.locked {
  overflow: hidden;
}

a {
  color: inherit;
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 48px;
}

.locked .app-shell {
  display: none;
}

.auth-screen {
  display: none;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.locked .auth-screen {
  display: grid;
}

.auth-card {
  width: min(520px, 100%);
  border: 1px solid var(--line);
  border-radius: 32px;
  padding: clamp(24px, 5vw, 48px);
  background: rgba(255, 253, 248, 0.86);
  box-shadow: var(--shadow);
}

.auth-card h1 {
  margin-bottom: 12px;
}

.auth-card .button {
  width: 100%;
  margin-top: 16px;
}

.auth-error {
  min-height: 24px;
  margin: 14px 0 0;
  color: var(--rose-deep);
  font-weight: 750;
}

.topbar {
  position: sticky;
  top: 12px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 253, 248, 0.86);
  box-shadow: 0 12px 28px rgba(88, 55, 69, 0.08);
  backdrop-filter: blur(16px);
}

main {
  overflow: hidden;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--rose), var(--lavender));
  color: #fff;
  font-size: 1.35rem;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: var(--muted);
  font-size: 0.78rem;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  min-width: 0;
}

.nav a {
  padding: 10px 14px;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
}

.nav a.active,
.nav a:hover {
  background: #fff;
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line);
}

.view {
  display: none;
  padding-top: 38px;
}

.view.active {
  display: block;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 26px;
  align-items: stretch;
}

.hero-copy,
.status-board,
.feature,
.game-list,
.game-panel,
.composer,
.gallery-card,
.memory-card {
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.78);
  box-shadow: var(--shadow);
}

.hero-copy {
  min-height: 330px;
  padding: clamp(24px, 4vw, 48px);
  border-radius: 32px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--rose-deep);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 640px;
  margin-bottom: 16px;
  font-size: clamp(2rem, 4.2vw, 3.85rem);
  line-height: 1.04;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 10px;
  font-size: clamp(1.8rem, 4vw, 3.3rem);
  line-height: 1.05;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 1.35rem;
}

.lead {
  max-width: 580px;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.58;
}

.hero-actions,
.panel-header,
.hangman-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  color: var(--ink);
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--line);
  cursor: pointer;
  font-weight: 750;
  text-decoration: none;
  touch-action: manipulation;
}

.button.primary {
  color: #fff;
  background: linear-gradient(135deg, var(--rose-deep), #a978d8);
  box-shadow: 0 14px 24px rgba(207, 102, 127, 0.24);
}

.button.ghost {
  background: rgba(255, 255, 255, 0.68);
}

.button.small {
  min-height: 38px;
  padding: 9px 14px;
}

.status-board {
  display: grid;
  gap: 14px;
  align-content: center;
  border-radius: 32px;
  padding: 24px;
}

.status-board div {
  border-radius: 22px;
  padding: 22px;
  background: rgba(255, 255, 255, 0.72);
}

.metric {
  display: block;
  font-size: 2.4rem;
  font-weight: 850;
}

.status-board span:last-child {
  color: var(--muted);
}

.section-heading {
  max-width: 820px;
  margin: 48px 0 22px;
}

.section-heading p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.65;
}

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

.links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.quick-link {
  display: flex;
  min-height: 116px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 18px;
  background: rgba(255, 253, 248, 0.78);
  box-shadow: var(--shadow);
  text-decoration: none;
}

.quick-link strong,
.quick-link span {
  display: block;
}

.quick-link span {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.4;
}

.quick-link-icon {
  flex: 0 0 auto;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 15px;
  background: linear-gradient(135deg, var(--lemon), var(--mint));
  font-weight: 850;
}

.quick-link:hover {
  transform: translateY(-2px);
}

.feature {
  min-height: 210px;
  border-radius: 26px;
  padding: 24px;
}

.feature-icon {
  display: inline-flex;
  margin-bottom: 28px;
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--mint);
  font-size: 0.82rem;
  font-weight: 800;
}

.feature:nth-child(2) .feature-icon {
  background: var(--lemon);
}

.feature:nth-child(3) .feature-icon {
  background: var(--sky);
}

.feature p,
.hint,
.result {
  color: var(--muted);
  line-height: 1.55;
}

.games-layout {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.game-list,
.game-panel,
.composer {
  border-radius: 26px;
  padding: 18px;
}

.hangman-setup {
  display: grid;
  grid-template-columns: 1fr 1fr 1.4fr auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.58);
}

.round-owner {
  margin-bottom: 18px;
  color: var(--rose-deep);
  font-weight: 750;
}

.game-list {
  display: grid;
  gap: 10px;
}

.game-tile {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px;
  text-align: left;
  background: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  touch-action: manipulation;
}

.game-tile strong,
.game-tile span {
  display: block;
}

.game-tile span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.92rem;
}

.game-tile.active {
  border-color: rgba(207, 102, 127, 0.5);
  background: #fff3f6;
}

.panel-header {
  justify-content: space-between;
  margin-bottom: 26px;
}

.hangman-word {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 72px;
  align-items: center;
  margin-bottom: 14px;
}

.word-cell {
  display: grid;
  width: clamp(38px, 7vw, 58px);
  height: clamp(48px, 8vw, 66px);
  place-items: center;
  border-radius: 16px;
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: 1.55rem;
  font-weight: 850;
  text-transform: uppercase;
}

.hangman-status {
  justify-content: space-between;
  margin: 18px 0;
  color: var(--muted);
}

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

.letter {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
  font-weight: 800;
  text-transform: uppercase;
}

.letter:disabled {
  cursor: default;
  opacity: 0.45;
}

.result {
  min-height: 28px;
  margin: 18px 0 0;
  font-weight: 750;
}

.hidden {
  display: none;
}

.composer {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 14px;
  align-items: end;
  margin-bottom: 20px;
}

label span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 750;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 13px 14px;
  color: var(--ink);
  background: #fff;
  outline: none;
  min-height: 46px;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(207, 102, 127, 0.58);
  box-shadow: 0 0 0 4px rgba(244, 167, 185, 0.22);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.gallery-card {
  overflow: hidden;
  border-radius: 24px;
}

.gallery-card img,
.placeholder-art {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
}

.placeholder-art {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--mint), var(--sky));
  color: rgba(55, 47, 53, 0.76);
  font-weight: 850;
}

.gallery-card div {
  padding: 14px;
}

.gallery-card-body {
  display: grid;
  gap: 12px;
}

.gallery-card p {
  margin: 0;
  line-height: 1.45;
}

.gallery-delete {
  justify-self: start;
  border: 1px solid rgba(207, 102, 127, 0.32);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--rose-deep);
  background: #fff;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 750;
}

.gallery-delete:hover {
  background: #fff3f6;
}

.timeline {
  display: grid;
  gap: 14px;
}

.memory-card {
  border-radius: 24px;
  padding: 18px;
}

.memory-card time {
  display: block;
  margin-bottom: 8px;
  color: var(--rose-deep);
  font-size: 0.82rem;
  font-weight: 800;
}

.memory-card p {
  margin-bottom: 0;
  line-height: 1.6;
}

@media (max-width: 860px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .nav {
    width: 100%;
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .nav::-webkit-scrollbar {
    display: none;
  }

  .hero,
  .games-layout,
  .hangman-setup,
  .composer {
    grid-template-columns: 1fr;
  }

  .hero-copy {
    min-height: auto;
  }

  .status-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

@media (max-width: 520px) {
  .app-shell {
    width: min(100% - 16px, 1180px);
    padding-top: 9px;
  }

  .topbar {
    top: 8px;
    border-radius: 20px;
  }

  .nav a {
    flex: 0 0 auto;
    min-height: 42px;
    padding: 10px 12px;
    font-size: 0.9rem;
  }

  .brand small {
    display: none;
  }

  .hero-copy,
  .status-board,
  .feature,
  .game-list,
  .game-panel,
  .composer,
  .hangman-setup {
    border-radius: 22px;
  }

  h1 {
    font-size: 2rem;
    line-height: 1.08;
  }

  h2 {
    font-size: 2rem;
  }

  .view {
    padding-top: 24px;
  }

  .hero-copy,
  .status-board,
  .feature,
  .game-panel,
  .game-list,
  .composer,
  .hangman-setup {
    padding: 16px;
  }

  .lead {
    font-size: 1rem;
  }

  .hero-actions .button,
  .composer .button,
  .hangman-setup .button {
    width: 100%;
  }

  .status-board {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .status-board div {
    padding: 16px;
  }

  .games-layout {
    gap: 12px;
  }

  .hangman-status {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .hangman-word {
    gap: 7px;
    min-height: 58px;
  }

  .word-cell {
    width: 36px;
    height: 46px;
    border-radius: 13px;
    font-size: 1.25rem;
  }

  .letters {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 6px;
  }

  .letter {
    min-width: 0;
    min-height: 40px;
    border-radius: 12px;
    padding: 0;
  }

  .section-heading {
    margin: 34px 0 16px;
  }

  .quick-link {
    min-height: 98px;
    border-radius: 20px;
    padding: 16px;
  }

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