:root {
  /* Main theme variables - aligned with main site */
  --primary-color: #c5f3f6;
  --secondary-color: #EDF2F4;
  --text-color: #000000;
  --heading-color: #122c34;
  --link-color: #224870;
  --link-hover-color: #0f2a38;
  --accent-color: #2563eb;
  --shadow-color: rgba(0, 0, 0, 0.2);
  --border-color: #ddd;
  --event-bg: #ffffff;
  --date-text: #555;

  /* Crossword specific variables */
  --cell-size: 34px;
  --grid-cols: 15;
  --grid-rows: 15;
  --line-color: #222;
  --page-bg: #f4f6f8;
  --cell-bg: #fff;
  --selected: #b8d4ff;
  --text-muted: #555;
}

@media (prefers-color-scheme: dark) {
  :root {
    --primary-color: #1a3a3a;
    --secondary-color: #2a2a2a;
    --text-color: #e0e0e0;
    --heading-color: #b0d0d0;
    --link-color: #88d0ff;
    --link-hover-color: #ffcc99;
    --accent-color: #88bbff;
    --event-bg: #333333;
    --date-text: #aaa;
    
    /* Crossword dark mode colors */
    --line-color: #ddd;
    --page-bg: #1a1a1a;
    --cell-bg: #2a2a2a;
    --selected: #3a5a7a;
    --text-muted: #aaa;
  }
}

* {
  box-sizing: border-box;
}


body.play-page {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.play-top-bar {
  flex-shrink: 0;
  width: 100%;
  background: var(--secondary-color);
  border-bottom: 1px solid var(--border-color);
  box-shadow: 0 1px 3px var(--shadow-color);
}

.play-top-bar-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0.01rem 0.02rem;
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.play-back-link {
  font-size: 0.85rem;
  color: var(--link-color);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.3s ease, text-decoration 0.3s ease;
}

.play-back-link:hover {
  color: var(--link-hover-color);
  text-decoration: underline;
}

.play-back-link:focus-visible {
  outline: 2px solid var(--link-color);
  outline-offset: 3px;
  border-radius: 4px;
}

.menu-header {
  text-align: center;
  margin-bottom: 1.75rem;
  max-width: 36rem;
}

.menu-header h1 {
  margin: 0 0 0.5rem;
  font-size: 1.65rem;
  color: var(--heading-color);
}

.menu-header p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.45;
}

.puzzle-list {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 28rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.puzzle-card {
  display: block;
  padding: 1rem 1.15rem;
  border: 2px solid var(--border-color);
  border-radius: 10px;
  background: var(--secondary-color);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.puzzle-card:hover {
  border-color: var(--accent-color);
  box-shadow: 0 2px 12px var(--shadow-color);
}

.puzzle-card h2 {
  margin: 0 0 0.35rem;
  font-size: 1.1rem;
  color: var(--heading-color);
}

.puzzle-card p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.menu-footer {
  margin-top: 2rem;
  font-size: 0.82rem;
  color: #888;
}

.play-layout {
    flex: 1;
    display: flex;
    flex-wrap: nowrap;
    flex-direction: row;
    gap: 1rem 1.5rem;
    align-items: flex-start;
    width: 100%;
    padding: 0.01rem 1rem 1.5rem;
    box-sizing: border-box;
    overflow: hidden;
}

.play-column {
    flex: 0 0 auto;
    min-width: 0;
}
.page {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.clues-panel {
    flex: 1 1 0;
    min-width: 200px;
    max-width: none;
    position: sticky;
    top: 0;
    max-height: 80vh;
    overflow-y: auto;
    padding: 0 0.9rem 1rem;
    background: var(--secondary-color);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    align-self: flex-start;
}

.clues-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0 0.8rem;
  align-items: start;
}

@media (max-width: 640px) {
  .clues-columns {
    grid-template-columns: 1fr;
    gap: 1rem 0;
  }
}

.clues-block--across {
  min-width: 0;
  box-shadow: none;
}

.clues-block--down {
  min-width: 0;
  border-left: 1px solid #ddd;
  padding-left: 1.15rem;
  box-shadow: none;
}

@media (max-width: 640px) {
  .clues-block--down {
    border-left: none;
    padding-left: 0;
    padding-top: 1rem;
    border-top: 1px solid #ddd;
  }
}

.clues-heading {
  margin: 0 0 0.6rem;
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--heading-color);
  position: sticky;
  top: 0rem;
  background: var(--secondary-color);
  padding: 0.5rem 0.5rem;
  z-index: 1;
  border-bottom: 1px solid var(--border-color);
}

.clues-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.clues-list li {
  margin-bottom: 0.55rem;
  font-size: 0.875rem;
  line-height: 1.4;
  color: var(--text-muted);
}

.clues-list li:last-child {
  margin-bottom: 0;
}

.clue-num {
  font-weight: 700;
  color: var(--heading-color);
  margin-right: 0.35em;
}

.clue-template {
  color: var(--text-muted);
}

.clue-text {
  color: var(--text-color);
}

.clue-active {
  background: rgba(37, 99, 235, 0.12);
  border-radius: 0.5rem;
  padding: 0.22rem 0.4rem;
  color: var(--heading-color);
}

.clues-list .clues-empty {
  font-style: italic;
  opacity: 0.9;
}

.direction-tools {
  display: flex;
  gap: 0.5rem;
}

.direction-tools button {
  font: inherit;
  padding: 0.45rem 0.9rem;
  border: 2px solid var(--border-color);
  background: var(--secondary-color);
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-color);
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.direction-tools button:hover {
  background: var(--primary-color);
}

.direction-tools button.is-active {
  background: var(--selected);
  border-color: var(--accent-color);
  font-weight: 600;
}

.play-column .load-hint,
.play-column .solve-status {
  text-align: center;
}

.load-hint,
.solve-status {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  max-width: 28rem;
  line-height: 1.4;
}

.solve-status.is-solved {
  color: #166534;
  font-weight: 600;
}

.crossword {
  display: grid;
  grid-template-columns: repeat(var(--grid-cols), var(--cell-size));
  grid-template-rows: repeat(var(--grid-rows), var(--cell-size));
  border: 2px solid var(--line-color);
  background: var(--line-color);
  gap: 1px;
  padding: 0;
  list-style: none;
  outline: none;
}

.crossword:focus {
  box-shadow: 0 0 0 3px rgba(34, 34, 34, 0.25);
}

.cell {
  position: relative;
  width: var(--cell-size);
  height: var(--cell-size);
  background: var(--cell-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
}

.cell .cell-num {
  position: absolute;
  top: 2px;
  left: 3px;
  font-size: 0.55rem;
  line-height: 1;
  font-weight: 700;
  color: var(--heading-color);
  pointer-events: none;
  user-select: none;
}

.cell.is-block {
  background: #1a1a1a;
  cursor: default;
  pointer-events: none;
}

.cell.is-block .letter {
  visibility: hidden;
}

.cell.is-block .cell-num {
  display: none;
}


.cell.selected {
  background: var(--selected);
  box-shadow: inset 0 0 0 2px var(--accent);
}

/* Solved state: green cells */
.cell.solved-cell {
  background: #d4edda;
}
.cell.solved-cell .letter {
  color: #155724;
}

.cell .letter {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1;
  text-transform: uppercase;
  color: var(--heading-color);
  min-width: 1ch;
  text-align: center;
}

.play-title {
  margin: 0;
  font-size: 1.05rem;
  color: var(--heading-color);
  text-align: center;
}
