:root {
  --card: rgba(255, 250, 240, 0.78);
  --card-strong: rgba(255, 252, 246, 0.92);
  --ink: #182127;
  --muted: #5c625c;
  --accent: #c4512d;
  --accent-strong: #8f3219;
  --line: rgba(24, 33, 39, 0.08);
  --shadow: 0 26px 60px rgba(34, 28, 16, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "Trebuchet MS", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(196, 81, 45, 0.26), transparent 28%),
    radial-gradient(circle at bottom right, rgba(63, 124, 95, 0.24), transparent 24%),
    linear-gradient(135deg, #f8f2e3 0%, #e7ddc1 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.22) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.22) 1px, transparent 1px);
  background-size: 38px 38px;
  opacity: 0.4;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 0.95fr 1.15fr;
  gap: 1.5rem;
  align-items: center;
  padding: 2rem 0;
}

.hero-card,
.game-card {
  backdrop-filter: blur(18px);
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 30px;
  box-shadow: var(--shadow);
}

.hero-card {
  padding: 3rem;
}

.game-card {
  padding: 1.6rem;
}

.eyebrow,
.panel-label,
.label {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.75rem;
  color: var(--muted);
}

h1 {
  margin: 0.5rem 0 1rem;
  font-family: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  font-size: clamp(2.8rem, 5vw, 4.6rem);
  line-height: 0.98;
  max-width: 12ch;
}

.intro,
.helper-text {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.7;
}

.status-grid,
.score-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}

.status-grid article,
.score-strip article,
.grid-panel,
.words-panel,
.difficulty-panel {
  background: var(--card-strong);
  border: 1px solid var(--line);
  border-radius: 24px;
}

.status-grid article,
.score-strip article {
  padding: 1.2rem;
}

.status-grid strong,
.score-strip strong {
  display: block;
  margin-top: 0.35rem;
  font-size: 1.7rem;
}

.toolbar {
  display: flex;
  justify-content: flex-end;
}

.toolbar-field {
  display: grid;
  gap: 0.5rem;
}

.custom-panel {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

button,
input,
textarea {
  border: 0;
  border-radius: 18px;
  font: inherit;
}

input,
textarea {
  padding: 0.9rem 1rem;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(24, 33, 39, 0.1);
  color: var(--ink);
}

input:focus,
textarea:focus,
button:focus-visible {
  outline: 3px solid rgba(196, 81, 45, 0.24);
  outline-offset: 2px;
}

textarea {
  resize: vertical;
  min-height: 120px;
}

.difficulty-panel {
  margin: 0;
  padding: 1rem;
}

.difficulty-panel legend {
  padding: 0;
}

.difficulty-option {
  display: flex;
  gap: 0.9rem;
  align-items: flex-start;
  padding: 0.85rem 0;
  cursor: pointer;
}

.difficulty-option + .difficulty-option {
  border-top: 1px solid var(--line);
}

.difficulty-option input {
  margin-top: 0.2rem;
}

.difficulty-option span {
  display: grid;
  gap: 0.15rem;
}

.button-row,
.export-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.export-row {
  margin-top: 1rem;
}

button {
  padding: 0.95rem 1.2rem;
  font-weight: 700;
  background: #eadbc1;
  color: var(--ink);
  cursor: pointer;
  transition:
    transform 140ms ease,
    box-shadow 140ms ease,
    background 140ms ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 20px rgba(24, 33, 39, 0.08);
}

button.primary {
  background: var(--accent);
  color: white;
}

button.primary:hover {
  background: var(--accent-strong);
}

.export-row button {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(24, 33, 39, 0.08);
}

.play-area {
  margin-top: 1.25rem;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(260px, 0.75fr);
  gap: 1rem;
}

.grid-panel,
.words-panel {
  padding: 1rem;
}

.grid-board {
  --grid-size: 10;
  margin-top: 0.85rem;
  display: grid;
  grid-template-columns: repeat(var(--grid-size), minmax(0, 1fr));
  gap: 0;
  background: rgba(24, 33, 39, 0.1);
  border: 1px solid rgba(24, 33, 39, 0.1);
}

.grid-cell {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.95);
  border-right: 1px solid rgba(24, 33, 39, 0.1);
  border-bottom: 1px solid rgba(24, 33, 39, 0.1);
  font-weight: 800;
  font-size: clamp(0.85rem, 2vw, 1.05rem);
  letter-spacing: 0.06em;
}

.word-list {
  list-style: none;
  padding: 0;
  margin: 0.85rem 0 1rem;
  display: grid;
  gap: 0.55rem;
}

.word-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.8rem 0.9rem;
  border-radius: 16px;
  background: #fff;
  border: 1px solid rgba(24, 33, 39, 0.08);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.word-list .tag {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
    align-items: start;
  }

  h1 {
    max-width: none;
  }
}

@media (max-width: 760px) {
  .play-area {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .hero-card,
  .game-card {
    padding: 1.25rem;
    border-radius: 24px;
  }

  .status-grid,
  .score-strip {
    grid-template-columns: 1fr 1fr;
  }

  .button-row,
  .export-row {
    width: 100%;
  }

  .button-row button,
  .export-row button {
    width: 100%;
  }

  .grid-cell {
    font-size: 0.8rem;
  }
}
