@import url("reset.css");
@import url("variables.css");
@import url("grid.css");
@import url("animations.css");

html {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.32) #0a0a0a;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html::-webkit-scrollbar {
  width: 7px;
}

html::-webkit-scrollbar-track {
  background: #0a0a0a;
}

html::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

html::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.42);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, sans-serif;
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px));
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 260px) minmax(0, 1fr) minmax(0, 260px);
  grid-template-rows: auto 1fr;
  gap: 2rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
  align-items: start;
}

.site-header {
  grid-column: 1 / -1;
  text-align: center;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--cell-border);
}

.site-header h1 {
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.site-header p {
  margin-top: 0.5rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.puzzle-main {
  grid-column: 2;
  grid-row: 2;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  width: 100%;
  min-width: 0;
}

.clues {
  min-width: 0;
  max-width: 260px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

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

.clues--across {
  grid-column: 1;
  grid-row: 2;
}

.clues--down {
  grid-column: 3;
  grid-row: 2;
}

.clues h2 {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

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

.clues li {
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  line-height: 1.4;
  cursor: pointer;
  padding: 0.35rem 0.5rem;
  border-radius: 4px;
  transition:
    background var(--anim-fast) var(--anim-ease),
    transform var(--anim-fast) var(--anim-ease),
    color var(--anim-fast) var(--anim-ease);
}

.clues li::before {
  content: none;
}

/* A13 — clue hover slide */
.clues li:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateX(6px);
}

.clues li.is-active {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border-left: 2px solid #fff;
  padding-left: calc(0.5rem - 2px);
}

.clues--down li {
  color: var(--text-muted);
}

.clues--down li.is-active {
  color: #fff;
}

.poem-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 100;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.poem-overlay.is-visible {
  display: flex;
}

.poem-content {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 2rem;
  max-width: 40rem;
}

.poem-overlay p,
.poem-line {
  font-family: "Cormorant Garamond", "Georgia", "Times New Roman", serif;
  font-size: clamp(1.25rem, 4vw, 1.75rem);
  font-weight: 500;
  line-height: 1.7;
  text-align: center;
  letter-spacing: 0.02em;
  color: #fff;
}

.puzzle-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  display: flex;
  justify-content: center;
  padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to top, rgba(0, 0, 0, 0.96) 65%, rgba(0, 0, 0, 0));
  pointer-events: none;
}

.btn-reset {
  pointer-events: auto;
  min-height: 44px;
  padding: 0.65rem 1.25rem;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition:
    background var(--anim-fast) var(--anim-ease),
    border-color var(--anim-fast) var(--anim-ease),
    transform var(--anim-fast) var(--anim-ease);
}

.btn-reset:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.42);
}

.btn-reset:active {
  transform: scale(0.98);
}

@media (max-width: 900px) {
  body {
    padding-bottom: calc(5rem + env(safe-area-inset-bottom, 0px));
  }

  .layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto auto;
    gap: 1.25rem;
    padding: 1rem 1rem 0;
  }

  .site-header {
    padding-bottom: 0.75rem;
  }

  .site-header h1 {
    font-size: 1.5rem;
  }

  .site-header p {
    font-size: 0.875rem;
  }

  .puzzle-main {
    grid-column: 1;
    grid-row: 2;
  }

  .clues--across {
    grid-column: 1;
    grid-row: 3;
  }

  .clues--down {
    grid-column: 1;
    grid-row: 4;
  }

  .clues {
    min-width: unset;
    max-height: min(38vh, 18rem);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding-right: 0.25rem;
  }

  .clues li {
    padding: 0.5rem 0.6rem;
  }

  .clues li:hover {
    transform: none;
  }
}

@media (max-width: 360px) {
  .layout {
    padding: 0.75rem 0.75rem 0;
    gap: 1rem;
  }

  .site-header h1 {
    font-size: 1.35rem;
  }

  .clues li {
    font-size: 0.85rem;
  }

  .btn-reset {
    width: 100%;
    max-width: 20rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .clues li:hover {
    transform: none;
  }
}
