:root {
  color-scheme: light;
  --bg: #f4f1e9;
  --ink: #182028;
  --muted: #66717f;
  --panel: #ffffff;
  --paper: #fffdf8;
  --paper-line: rgba(47, 124, 246, 0.06);
  --margin-line: rgba(217, 73, 53, 0.18);
  --line: #ddd6c9;
  --blue: #2f7cf6;
  --green: #13795f;
  --red: #d94935;
  --yellow: #f6c445;
  --violet: #7457d8;
  --orange: #ff8a4c;
  --shadow: 0 18px 38px rgba(42, 31, 18, 0.12);
  --shadow-soft: 0 8px 20px rgba(42, 31, 18, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(rgba(23, 92, 75, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 92, 75, 0.055) 1px, transparent 1px),
    repeating-linear-gradient(0deg, transparent 0 31px, rgba(47, 124, 246, 0.045) 32px 33px),
    linear-gradient(135deg, #fffaf0 0%, var(--bg) 52%, #eaf3ef 100%);
  background-size: 34px 34px, 34px 34px, 100% 33px, auto;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.cookie-open {
  padding-bottom: 150px;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  border: 1px solid rgba(221, 214, 201, 0.9);
  border-left: 6px solid var(--green);
  border-radius: 8px;
  padding: 12px;
  background:
    linear-gradient(90deg, rgba(246, 196, 69, 0.16), transparent 42%),
    rgba(255, 255, 255, 0.84);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-soft);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.mark {
  display: grid;
  position: relative;
  width: 46px;
  height: 46px;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 8px;
  color: #12221d;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.36), transparent),
    var(--yellow);
  border: 2px solid rgba(24, 32, 40, 0.08);
  font-weight: 800;
  box-shadow: var(--shadow-soft);
  transform: rotate(-2deg);
}

.mark::after {
  content: "";
  position: absolute;
  inset: 7px 8px auto auto;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
}

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

h1 {
  font-size: clamp(1.75rem, 4vw, 3.4rem);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  font-size: clamp(1.4rem, 2.5vw, 2rem);
}

.subtitle {
  margin-top: 6px;
  color: var(--muted);
  font-weight: 600;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(310px, 0.55fr);
  gap: 20px;
  align-items: start;
}

.panel {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, transparent 0 17px, var(--margin-line) 18px, transparent 19px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.96) 0 31px, var(--paper-line) 32px),
    rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel:not(.join-card)::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 4px;
  left: 18px;
  width: 1px;
  background: var(--margin-line);
}

.panel::after {
  content: "";
  display: block;
  height: 4px;
  background: linear-gradient(90deg, var(--green), var(--yellow), var(--red), var(--blue));
  opacity: 0.85;
}

.panel-body {
  position: relative;
  z-index: 1;
  padding: 22px;
}

.home {
  display: grid;
  min-height: calc(100vh - 56px);
  align-items: start;
  gap: 26px;
}

.home-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 26px;
  align-items: center;
  min-width: 0;
  width: 100%;
}

.hero-copy {
  padding: 12px 0;
  min-width: 0;
}

.hero-copy h1 {
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.7);
}

.hero-copy .brand {
  align-items: flex-start;
}

.hero-copy p {
  max-width: 640px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1.6;
}

.home-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.home-stats span {
  border: 1px solid rgba(19, 121, 95, 0.22);
  border-radius: 999px;
  padding: 8px 11px;
  color: #175c4b;
  background:
    linear-gradient(135deg, rgba(246, 196, 69, 0.18), transparent 58%),
    rgba(255, 255, 255, 0.78);
  font-size: 0.88rem;
  font-weight: 800;
}

.home-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.letter-wall {
  display: grid;
  grid-template-columns: repeat(5, minmax(42px, 1fr));
  gap: 12px;
  margin-top: 28px;
  max-width: 460px;
  width: 100%;
  transform: rotate(-1.5deg);
}

.letter-wall span {
  display: grid;
  min-height: 54px;
  place-items: center;
  border: 1px solid rgba(24, 32, 40, 0.08);
  border-radius: 8px;
  background: var(--paper);
  font-weight: 800;
  font-size: 1.3rem;
  box-shadow: var(--shadow-soft);
  position: relative;
  transition: transform 0.16s, box-shadow 0.16s;
}

.letter-wall span::after {
  content: "";
  position: absolute;
  right: 7px;
  bottom: 6px;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
}

.letter-wall span:hover {
  transform: translateY(-2px) rotate(1deg);
  box-shadow: 0 12px 24px rgba(42, 31, 18, 0.12);
}

.letter-wall span:nth-child(2n) {
  transform: translateY(4px);
}

.letter-wall span:nth-child(4n + 1) {
  color: white;
  background: var(--blue);
}

.letter-wall span:nth-child(4n + 2) {
  color: white;
  background: var(--green);
}

.letter-wall span:nth-child(4n + 3) {
  color: #182028;
  background: var(--yellow);
}

.letter-wall span:nth-child(4n + 4) {
  color: white;
  background: var(--red);
}

.home-section,
.home-info-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.82), rgba(255, 253, 248, 0.9)),
    var(--paper);
  box-shadow: var(--shadow-soft);
}

.home-section {
  padding: clamp(18px, 3vw, 28px);
}

.section-heading {
  display: grid;
  gap: 10px;
  max-width: 760px;
}

.section-heading p,
.home-info-panel p {
  color: var(--muted);
  line-height: 1.6;
}

.feature-grid,
.home-info-grid {
  display: grid;
  gap: 14px;
}

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

.feature-card {
  border: 1px solid rgba(221, 214, 201, 0.86);
  border-radius: 8px;
  padding: 16px;
  background: white;
}

.feature-card strong {
  display: block;
  color: #175c4b;
  font-size: 1.05rem;
}

.feature-card p {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.55;
}

.home-info-grid {
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.95fr) minmax(0, 0.95fr);
}

.home-info-panel {
  padding: 18px;
}

.home-info-panel h2 {
  font-size: 1.35rem;
}

.rule-list {
  display: grid;
  gap: 10px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.rule-list li {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  border: 1px solid rgba(221, 214, 201, 0.86);
  border-radius: 8px;
  padding: 10px;
  background: white;
}

.rule-list strong {
  color: #175c4b;
}

.rule-list span {
  color: var(--muted);
  line-height: 1.4;
}

.category-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

.category-chips span {
  border: 1px solid rgba(47, 124, 246, 0.18);
  border-radius: 999px;
  padding: 7px 10px;
  color: #284a7f;
  background: rgba(47, 124, 246, 0.08);
  font-size: 0.9rem;
  font-weight: 800;
}

.home-link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.home-link-row a {
  color: var(--blue);
  font-weight: 800;
  text-decoration: none;
}

.join-card {
  position: relative;
  min-width: 0;
}

.join-card::before {
  content: "";
  display: block;
  height: 8px;
  background: linear-gradient(90deg, var(--green), var(--yellow), var(--red), var(--blue));
}

.score-sheet-preview {
  position: relative;
  width: min(520px, 100%);
  max-width: 100%;
  margin-top: 22px;
  border: 2px solid rgba(23, 92, 75, 0.2);
  border-radius: 8px;
  padding-left: 18px;
  background:
    linear-gradient(90deg, rgba(47, 124, 246, 0.07) 1px, transparent 1px),
    repeating-linear-gradient(0deg, var(--paper) 0 32px, var(--paper-line) 33px),
    linear-gradient(var(--paper), var(--paper));
  background-size: 22px 100%, auto;
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.score-sheet-preview::before {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 6px;
  width: 7px;
  background: radial-gradient(circle, rgba(24, 32, 40, 0.22) 0 2px, transparent 3px) top center / 7px 34px repeat-y;
}

.sheet-row {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr 1.2fr 0.8fr;
  border-top: 1px solid rgba(23, 92, 75, 0.14);
}

.sheet-row:first-child {
  border-top: 0;
}

.sheet-row span {
  min-width: 0;
  border-left: 1px solid rgba(23, 92, 75, 0.14);
  padding: 9px 10px;
  font-weight: 800;
}

.sheet-row span:first-child {
  border-left: 0;
  color: #175c4b;
}

.sheet-head {
  color: #175c4b;
  background: rgba(246, 196, 69, 0.25);
  font-size: 0.82rem;
  text-transform: uppercase;
}

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

.field {
  display: grid;
  gap: 7px;
}

.field label {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
  text-transform: uppercase;
}

.field-help {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.35;
}

.input,
.textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(0deg, rgba(255, 255, 255, 0.68), rgba(255, 255, 255, 0.68)),
    var(--paper);
  color: var(--ink);
  caret-color: var(--red);
  outline: 0;
  padding: 13px 14px;
  transition: border 0.18s, box-shadow 0.18s, transform 0.18s;
}

.textarea {
  min-height: 128px;
  resize: vertical;
}

.input:focus,
.textarea:focus {
  border-color: rgba(36, 107, 254, 0.65);
  box-shadow: 0 0 0 4px rgba(36, 107, 254, 0.13);
  transform: translateY(-1px);
}

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

.button-row.compact {
  gap: 8px;
}

.button-row.compact .btn {
  min-height: 40px;
}

.btn {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 8px;
  border: 1px solid rgba(24, 32, 40, 0.08);
  padding: 0 16px;
  color: var(--ink);
  background: #ece7dc;
  font-weight: 800;
  box-shadow: 0 3px 0 rgba(24, 32, 40, 0.1);
  transition: transform 0.14s, box-shadow 0.14s, filter 0.14s;
}

.btn:hover {
  filter: brightness(1.02);
  transform: translateY(-1px);
  box-shadow: 0 5px 0 rgba(24, 32, 40, 0.1);
}

.btn:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 rgba(24, 32, 40, 0.1);
}

.btn:focus-visible,
.mini-btn:focus-visible,
.icon-btn:focus-visible {
  outline: 3px solid rgba(47, 124, 246, 0.28);
  outline-offset: 2px;
}

.btn.primary {
  color: white;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.12), transparent),
    #175c4b;
}

.btn.green {
  color: white;
  background: var(--green);
}

.btn.red {
  color: white;
  background: var(--red);
}

.btn.ghost {
  border: 1px solid var(--line);
  background: white;
}

.btn[data-action="stop-round"] {
  color: white;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.16), transparent),
    var(--red);
}

.btn[data-action="stop-round"]:not(:disabled) {
  box-shadow: 0 4px 0 rgba(116, 28, 18, 0.24);
}

.status {
  margin-top: 12px;
  color: var(--red);
  font-weight: 700;
}

.notice {
  margin-top: 12px;
  color: var(--green);
  font-weight: 800;
}

.pill {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  border-radius: 999px;
  padding: 0 12px;
  border: 1px solid rgba(24, 32, 40, 0.06);
  background:
    linear-gradient(135deg, rgba(246, 196, 69, 0.22), transparent),
    #eee8dc;
  color: #526171;
  font-size: 0.88rem;
  font-weight: 800;
}

.room-code {
  font-size: 1.15rem;
  color: #175c4b;
  background: #dff1eb;
}

.scoreboard {
  display: grid;
  gap: 10px;
}

.score-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--paper);
  box-shadow: 0 2px 0 rgba(24, 32, 40, 0.04);
}

.score-row:nth-child(4n + 1) {
  box-shadow: inset 4px 0 var(--green), 0 2px 0 rgba(24, 32, 40, 0.04);
}

.score-row:nth-child(4n + 2) {
  box-shadow: inset 4px 0 var(--yellow), 0 2px 0 rgba(24, 32, 40, 0.04);
}

.score-row:nth-child(4n + 3) {
  box-shadow: inset 4px 0 var(--blue), 0 2px 0 rgba(24, 32, 40, 0.04);
}

.score-row:nth-child(4n + 4) {
  box-shadow: inset 4px 0 var(--red), 0 2px 0 rgba(24, 32, 40, 0.04);
}

.score-name {
  overflow: hidden;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score-points {
  display: inline-grid;
  min-width: 38px;
  min-height: 30px;
  place-items: center;
  border-radius: 8px;
  font-weight: 800;
  color: white;
  background: var(--blue);
}

.setup-grid {
  display: grid;
  grid-template-columns: 140px 120px minmax(0, 1fr);
  gap: 12px;
}

.invite-box,
.round-status,
.waiting-box {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--paper);
}

.invite-box strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px dashed rgba(19, 121, 95, 0.44);
  border-radius: 8px;
  padding: 0 14px;
  color: #175c4b;
  background: rgba(223, 241, 235, 0.8);
  font-size: 1.4rem;
  letter-spacing: 0;
}

.lobby-players {
  display: grid;
  gap: 8px;
}

.lobby-player {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--paper);
  box-shadow: 0 2px 0 rgba(24, 32, 40, 0.04);
  transition: transform 0.16s, border-color 0.16s;
}

.lobby-player:hover {
  border-color: rgba(47, 124, 246, 0.22);
  transform: translateY(-1px);
}

.lobby-player-actions {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.mini-btn {
  border-radius: 8px;
  padding: 7px 9px;
  color: var(--red);
  background: #ffecec;
  font-size: 0.78rem;
  font-weight: 800;
}

.mini-btn.neutral {
  color: var(--blue);
  background: #eaf0ff;
}

.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.lobby-player span:first-child {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.lobby-player small {
  color: var(--muted);
  font-weight: 800;
}

.ready-dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: var(--red);
}

.ready-dot.ready {
  background: var(--green);
}

.ready-dot.host {
  background: var(--blue);
}

.ready-dot.offline {
  background: #aab2bd;
}

.round-status {
  justify-content: flex-start;
  margin-bottom: 14px;
  color: var(--muted);
  font-weight: 800;
}

.round-status span:first-child {
  color: var(--green);
}

.round-status span {
  border: 1px solid rgba(102, 113, 127, 0.16);
  border-radius: 999px;
  padding: 7px 10px;
  background: rgba(255, 255, 255, 0.64);
}

.waiting-box {
  margin-bottom: 14px;
  border-color: rgba(243, 187, 40, 0.5);
  background: #fff8e4;
}

.waiting-box strong {
  color: #9a6800;
}

.waiting-box span {
  color: var(--muted);
  font-weight: 800;
}

.timer-strip {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  margin-bottom: 18px;
  border: 1px solid rgba(23, 92, 75, 0.18);
  border-radius: 8px;
  padding: 14px;
  background:
    linear-gradient(90deg, rgba(246, 196, 69, 0.14), transparent 48%),
    var(--paper);
  box-shadow: inset 0 -1px 0 rgba(24, 32, 40, 0.05);
}

.big-letter {
  display: grid;
  position: relative;
  width: 88px;
  height: 88px;
  place-items: center;
  border-radius: 8px;
  color: #182028;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.38), transparent),
    var(--yellow);
  border: 2px solid rgba(24, 32, 40, 0.08);
  box-shadow: 0 7px 0 rgba(24, 32, 40, 0.08);
  font-size: 3.1rem;
  font-weight: 800;
  transform: rotate(-2deg);
}

.big-letter::after {
  content: "";
  position: absolute;
  inset: 8px 8px auto auto;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.65);
}

.timer {
  position: relative;
  overflow: hidden;
  height: 24px;
  border-radius: 999px;
  background:
    repeating-linear-gradient(90deg, rgba(24, 32, 40, 0.08) 0 1px, transparent 1px 22px),
    #e7edf6;
}

.timer span {
  display: block;
  height: 100%;
  width: var(--progress);
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--yellow), var(--orange), var(--red));
  transition: width 0.3s linear;
}

.time-left {
  min-width: 72px;
  text-align: right;
  color: #175c4b;
  font-weight: 800;
}

.answers-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}

.category-input {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 126px;
  padding: 14px 14px 14px 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.68)),
    repeating-linear-gradient(0deg, transparent 0 36px, rgba(47, 124, 246, 0.08) 37px),
    var(--paper);
  box-shadow: 0 2px 0 rgba(24, 32, 40, 0.04);
  position: relative;
  transition: transform 0.16s, border-color 0.16s, box-shadow 0.16s;
}

.category-input::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  border-radius: 8px 0 0 8px;
  background: var(--yellow);
}

.category-input:nth-child(4n + 1)::before {
  background: var(--green);
}

.category-input:nth-child(4n + 2)::before {
  background: var(--yellow);
}

.category-input:nth-child(4n + 3)::before {
  background: var(--blue);
}

.category-input:nth-child(4n + 4)::before {
  background: var(--red);
}

.category-input:focus-within {
  border-color: rgba(47, 124, 246, 0.38);
  box-shadow: 0 10px 24px rgba(42, 31, 18, 0.09);
  transform: translateY(-2px);
}

.category-input label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-weight: 800;
}

.category-input .input {
  background: rgba(255, 255, 255, 0.72);
}

.review-table {
  overflow-x: auto;
}

.review-cards {
  display: none;
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 2px 0 rgba(24, 32, 40, 0.04);
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  background:
    linear-gradient(90deg, rgba(246, 196, 69, 0.18), transparent),
    #f4efe4;
}

.answer-cell {
  display: grid;
  gap: 7px;
}

.answer-word {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  border-radius: 8px;
  padding: 4px 7px;
  background: rgba(255, 255, 255, 0.76);
  font-weight: 800;
  word-break: break-word;
}

.answer-meta {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.suggestion {
  color: #536072;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.35;
}

.review-panel .review-summary {
  width: fit-content;
  border-radius: 8px;
  padding: 7px 10px;
  background: #fff3c4;
}

.points-edit {
  display: grid;
  grid-template-columns: 68px auto;
  gap: 6px;
  align-items: center;
}

.points-input {
  width: 68px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  font-weight: 800;
  background: white;
}

.points-input:focus {
  border-color: rgba(47, 124, 246, 0.55);
  outline: 3px solid rgba(47, 124, 246, 0.14);
}

.answer-category {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.review-summary {
  margin-top: 8px;
  color: #9a6800;
  font-weight: 800;
}

.review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.mini-actions {
  display: flex;
  gap: 6px;
}

.icon-btn {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  font-weight: 800;
  background: #eef2f7;
  box-shadow: 0 2px 0 rgba(24, 32, 40, 0.07);
}

.icon-btn.ok {
  color: white;
  background: var(--green);
}

.icon-btn.no {
  color: white;
  background: var(--red);
}

.history {
  display: grid;
  gap: 10px;
}

.history-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--paper);
  box-shadow: inset 4px 0 rgba(47, 124, 246, 0.52);
}

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

.final-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background:
    linear-gradient(90deg, rgba(47, 124, 246, 0.07), transparent 44%),
    var(--paper);
  box-shadow: 0 2px 0 rgba(24, 32, 40, 0.04);
}

.final-row.winner {
  border-color: rgba(10, 159, 106, 0.45);
  background:
    linear-gradient(90deg, rgba(19, 121, 95, 0.16), transparent 48%),
    #edf9f4;
  box-shadow: inset 5px 0 var(--green), 0 2px 0 rgba(24, 32, 40, 0.04);
}

.final-place {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  color: white;
  background: var(--blue);
  font-weight: 800;
  box-shadow: 0 2px 0 rgba(24, 32, 40, 0.12);
}

.final-row.winner .final-place {
  background: var(--green);
}

.muted {
  color: var(--muted);
}

.hidden {
  display: none !important;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  justify-content: center;
  padding: 24px 0 4px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.ad-slot {
  display: grid;
  gap: 4px;
  place-items: center;
  margin-top: 16px;
  border: 1px dashed rgba(102, 113, 127, 0.34);
  border-radius: 8px;
  min-height: 86px;
  padding: 14px;
  color: var(--muted);
  background:
    repeating-linear-gradient(90deg, rgba(102, 113, 127, 0.05) 0 1px, transparent 1px 18px),
    rgba(255, 253, 248, 0.64);
  text-align: center;
}

.ad-slot span {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.ad-slot strong {
  color: #175c4b;
}

.site-footer a,
.link-button,
.cookie-links a {
  color: var(--blue);
  text-decoration: none;
}

.link-button {
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  font-weight: 800;
}

.cookie-banner {
  position: fixed;
  right: 18px;
  bottom: 18px;
  left: 18px;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  width: min(920px, calc(100% - 36px));
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background:
    linear-gradient(90deg, rgba(246, 196, 69, 0.18), transparent 54%),
    white;
  box-shadow: var(--shadow);
}

.cookie-banner p {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.45;
}

.cookie-links,
.cookie-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.cookie-links {
  margin-top: 8px;
}

.legal-page {
  width: min(920px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.legal-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: clamp(20px, 4vw, 38px);
  background: white;
  box-shadow: var(--shadow);
}

.legal-card h1 {
  margin-top: 18px;
}

.legal-card h2 {
  margin-top: 26px;
  font-size: 1.25rem;
}

.legal-card p {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.65;
}

.legal-list,
.legal-steps {
  display: grid;
  gap: 10px;
  margin: 14px 0 0;
  padding-left: 22px;
  color: var(--muted);
  line-height: 1.6;
}

.legal-list li,
.legal-steps li {
  padding-left: 4px;
}

.legal-list strong {
  color: #175c4b;
}

.legal-card a,
.back-link {
  color: var(--blue);
  font-weight: 800;
  text-decoration: none;
}

.print-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.download-grid,
.word-nav,
.word-grid,
.word-category-grid {
  display: grid;
  gap: 14px;
}

.download-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 18px;
}

.download-card,
.word-card,
.word-block {
  border: 1px solid rgba(221, 214, 201, 0.9);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 2px 0 rgba(24, 32, 40, 0.04);
}

.download-card,
.word-card {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.download-card strong,
.word-card strong,
.word-block h2 {
  color: #175c4b;
}

.download-card p,
.word-card p,
.word-block p {
  margin-top: 0;
}

.letter-index {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.letter-index a,
.letter-index span {
  display: grid;
  min-width: 34px;
  min-height: 34px;
  place-items: center;
  border: 1px solid rgba(23, 92, 75, 0.18);
  border-radius: 8px;
  color: #175c4b;
  background: rgba(255, 253, 248, 0.92);
  font-weight: 900;
  text-decoration: none;
}

.letter-index span {
  opacity: 0.42;
}

.word-nav {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 20px;
}

.word-card {
  text-decoration: none;
}

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

.word-category-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 20px;
}

.word-block {
  padding: 16px;
  scroll-margin-top: 20px;
}

.word-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.word-cloud span {
  border: 1px solid rgba(47, 124, 246, 0.14);
  border-radius: 999px;
  padding: 7px 10px;
  color: #284a7f;
  background:
    linear-gradient(135deg, rgba(246, 196, 69, 0.12), transparent),
    rgba(47, 124, 246, 0.06);
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.2;
}

.related-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.related-grid a {
  border: 1px solid rgba(19, 121, 95, 0.2);
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(19, 121, 95, 0.07);
  color: #175c4b;
  font-weight: 800;
  text-decoration: none;
}

.letter-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.letter-list div {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.letter-list strong {
  color: var(--red);
}

.letter-list span {
  color: var(--muted);
  line-height: 1.45;
}

.print-sheet {
  margin-top: 22px;
  border: 2px solid rgba(23, 92, 75, 0.22);
  border-radius: 8px;
  overflow: hidden;
}

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

.print-sheet th,
.print-sheet td {
  border: 1px solid rgba(23, 92, 75, 0.18);
  height: 42px;
  padding: 8px;
  text-align: left;
}

.print-sheet th {
  color: #175c4b;
  background: rgba(246, 196, 69, 0.22);
}

.print-sheet td:first-child,
.print-sheet th:first-child {
  width: 78px;
  font-weight: 800;
}

@media (max-width: 860px) {
  .home-layout,
  .grid,
  .setup-grid,
  .answers-grid,
  .feature-grid,
  .home-info-grid,
  .download-grid,
  .word-nav,
  .word-grid,
  .word-category-grid {
    grid-template-columns: 1fr;
  }

  .panel:not(.join-card)::before {
    left: 14px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .home {
    align-items: start;
  }

  .letter-wall {
    width: 100%;
    max-width: none;
    transform: none;
  }

  .timer-strip {
    grid-template-columns: auto 1fr;
  }

  .round-status span {
    flex: 1 1 190px;
  }

  .time-left {
    grid-column: 1 / -1;
    text-align: left;
  }

  .cookie-banner {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  body {
    overflow-x: hidden;
  }

  body.cookie-open {
    padding-bottom: 290px;
  }

  .shell {
    width: min(calc(100% - 20px), 1180px);
    padding: 16px 0;
  }

  .home-layout,
  .hero-copy,
  .hero-copy .brand,
  .hero-copy p,
  .home-section,
  .home-info-panel,
  .home-stats,
  .home-cta-row,
  .score-sheet-preview,
  .letter-wall,
  .join-card,
  .ad-slot,
  .site-footer {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .hero-copy .brand {
    gap: 10px;
  }

  .hero-copy .brand > div:last-child {
    min-width: 0;
  }

  .hero-copy h1 {
    font-size: clamp(1.55rem, 7vw, 2.25rem);
    line-height: 1.05;
    overflow-wrap: anywhere;
  }

  .hero-copy p {
    font-size: 1rem;
    line-height: 1.5;
  }

  .panel-body {
    padding: 16px;
  }

  .topbar {
    border-left-width: 4px;
    padding: 10px;
  }

  .mark {
    width: 42px;
    height: 42px;
  }

  .score-sheet-preview {
    width: 100%;
    max-width: 100%;
    padding-left: 14px;
    font-size: 0.72rem;
  }

  .sheet-row {
    grid-template-columns: 78px minmax(0, 1fr) minmax(0, 1fr) 58px;
  }

  .sheet-row span {
    overflow: hidden;
    padding: 8px 4px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .letter-wall {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
    max-width: 100%;
  }

  .letter-wall span {
    min-height: 46px;
    font-size: 1.1rem;
  }

  .home-stats span {
    flex: 1 1 100%;
    text-align: center;
  }

  .home-cta-row .btn {
    width: 100%;
  }

  .rule-list li {
    grid-template-columns: 1fr;
  }

  .cookie-banner {
    left: 10px;
    right: auto;
    width: calc(100vw - 20px);
    max-width: calc(100vw - 20px);
  }

  .cookie-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    width: 100%;
  }

  .cookie-actions .btn {
    min-width: 0;
    padding: 0 8px;
  }

  .button-row .btn {
    width: 100%;
  }

  .button-row.compact {
    width: 100%;
  }

  .button-row.compact .btn {
    flex: 1;
    width: auto;
    min-width: 0;
    padding: 0 10px;
  }

  .big-letter {
    width: 74px;
    height: 74px;
    font-size: 2.6rem;
  }

  .timer-strip {
    gap: 12px;
    padding: 12px;
  }

  .round-status span {
    flex-basis: 100%;
  }

  .time-left {
    min-width: 0;
    font-size: 1.2rem;
  }

  .category-input {
    min-height: auto;
    padding: 12px 12px 12px 16px;
  }

  .review-table {
    display: none;
  }

  .review-cards {
    display: grid;
    gap: 12px;
    margin-top: 16px;
  }

  .review-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--paper);
    box-shadow: 0 2px 0 rgba(24, 32, 40, 0.04);
    overflow: hidden;
  }

  .review-card header,
  .review-card-answer {
    display: grid;
    gap: 10px;
    padding: 12px;
  }

  .review-card header {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    background:
      linear-gradient(90deg, rgba(47, 124, 246, 0.09), transparent),
      #f7f9fc;
  }

  .review-card header span {
    color: var(--blue);
    font-weight: 800;
  }

  .review-card-answers {
    display: grid;
  }

  .review-card-answer {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    border-top: 1px solid var(--line);
  }

  .review-card-answer strong {
    display: block;
    margin-top: 3px;
    word-break: break-word;
  }

  .review-card-answer small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-weight: 700;
  }
}

@media (max-width: 420px) {
  .hero-copy .brand {
    display: grid;
    grid-template-columns: auto;
  }

  .hero-copy h1 {
    font-size: clamp(1.7rem, 8vw, 2.05rem);
  }

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

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

@media print {
  body {
    background: white;
  }

  .back-link,
  .print-actions {
    display: none;
  }

  .legal-page {
    width: 100%;
    padding: 0;
  }

  .legal-card {
    border: 0;
    box-shadow: none;
  }
}
