/* ChemCross (crossword). Colors come from style.css; the home screen reuses live.css (ChemSpy). */

#cross { max-width: 1200px; margin: 0 auto; padding: 4px 16px 64px; }
#cross.home { max-width: 620px; }
#cross h1 { font-size: clamp(1.7rem, 6vw, 2.4rem); line-height: 1.1; letter-spacing: -0.02em; margin: 8px 0 10px; }
#cross .lead { color: var(--ink-2); margin: 0 0 16px; }
#cross .hint { color: var(--ink-2); font-size: 0.92rem; margin: 10px 0 8px; }
#cross .error:empty { display: none; }
.two-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.two-buttons .button { width: 100%; }
.resume { border-left: 6px solid var(--nitrogen); }
.resume p { margin: 0 0 10px; }

/* hidden typing box: kept on screen (1 px) so the keyboard can open */
.cc-type { position: fixed; left: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; border: 0; padding: 0; font-size: 16px; }

/* top of the puzzle screen */
.cc-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin: 8px 0 10px; }
.cc-head h1 { font-size: 1.35rem !important; margin: 2px 0 0 !important; }
.cc-head .meta { display: block; font-size: 0.9rem; color: var(--ink-2); }
.cc-stats { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cc-clock { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.15rem; background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius-sm); padding: 4px 10px; }
.cc-count { color: var(--ink-2); font-size: 0.92rem; }

.cc-tools { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 10px; }
.cc-tools .button { padding: 8px 14px; font-size: 0.95rem; }

/* players in a group lobby */
.cc-players { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; padding: 0; list-style: none; }
.cc-players li { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--card); border: 1.5px solid var(--line); font-size: 0.9rem; font-weight: 600; }
.cc-players li.offline { opacity: 0.55; }
.cc-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.cc-players .link-button { font-size: 0.8rem; }

/* layout: grid on the left, clues on the right (stacked on narrow screens) */
.cc-main { display: grid; grid-template-columns: minmax(0, auto) minmax(260px, 1fr); gap: 18px; align-items: start; }
.cc-main > div { min-width: 0; } /* lets a wide grid scroll inside its box instead of stretching the page */
@media (max-width: 900px) { .cc-main { grid-template-columns: 1fr; } }

.cc-clue-bar { position: sticky; top: 0; z-index: 4; display: flex; gap: 10px; align-items: baseline; min-height: 3em; margin: 0 0 8px; padding: 8px 12px; background: #e7effc; border: 1.5px solid #b9cdf0; border-radius: var(--radius-sm); font-size: 1rem; }
.cc-clue-bar strong { flex: none; color: var(--nitrogen-dark); }

.cc-board { position: relative; overflow: auto; max-width: 100%; padding: 2px; -webkit-overflow-scrolling: touch; }
.cc-grid { display: grid; gap: 0; width: max-content; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.cc-cell, .cc-block { width: var(--cell, 28px); height: var(--cell, 28px); }
.cc-block { background: transparent; }
.cc-cell { position: relative; background: #fff; box-shadow: inset 0 0 0 1px #8b97ad; cursor: pointer; display: grid; place-items: center; }
.cc-cell .num { position: absolute; top: 1px; left: 2px; font-size: calc(var(--cell, 28px) * 0.3); line-height: 1; color: var(--ink-2); pointer-events: none; }
.cc-cell .ch { font-size: calc(var(--cell, 28px) * 0.58); font-weight: 600; line-height: 1; pointer-events: none; text-transform: uppercase; }
.cc-cell.word { background: #dfeafc; }
.cc-cell.sel { background: #ffe58a; box-shadow: inset 0 0 0 2px var(--nitrogen-dark); }
.cc-cell.wrong .ch { color: var(--oxygen); }
.cc-cell.wrong { background: #fde0de; }
.cc-cell.wrong.sel { background: #fbc7c3; }
.cc-cell.revealed .ch { color: var(--nitrogen-dark); }
.cc-cell.revealed::after { content: ''; position: absolute; right: 0; top: 0; border-style: solid; border-width: 0 calc(var(--cell, 28px) * 0.28) calc(var(--cell, 28px) * 0.28) 0; border-color: transparent var(--nitrogen) transparent transparent; }
.cc-cell.other { box-shadow: inset 0 0 0 3px var(--who, #8a4fd1); }
.cc-cell.sel.other { box-shadow: inset 0 0 0 2px var(--nitrogen-dark), inset 0 0 0 5px var(--who, #8a4fd1); }

/* clue lists */
.cc-clues { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
@media (max-width: 1100px) and (min-width: 901px) { .cc-clues { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .cc-clues { grid-template-columns: 1fr; } }
.cc-clues h2 { font-size: 1rem; margin: 0 0 6px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-2); }
.cc-clues ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.cc-clues li { display: grid; grid-template-columns: 2.1em 1fr; gap: 4px; padding: 5px 8px; border-radius: 8px; cursor: pointer; font-size: 0.93rem; line-height: 1.35; }
.cc-clues li:hover { background: #f1f5fb; }
.cc-clues li.current { background: #e7effc; box-shadow: inset 3px 0 0 var(--nitrogen); }
.cc-clues li.done { color: var(--ink-2); }
.cc-clues li.done .text { text-decoration: line-through; text-decoration-color: rgba(82, 96, 125, 0.5); }
.cc-clues .n { font-weight: 700; text-align: right; }
.cc-len { color: var(--ink-2); white-space: nowrap; }

/* finished */
.cc-done { text-align: center; background: var(--card); border: 2px solid var(--chlorine); border-radius: var(--radius); padding: 16px; margin: 0 0 12px; }
.cc-done h2 { margin: 0 0 6px; color: var(--chlorine); font-size: 1.4rem; }
.cc-done p { margin: 4px 0; }
.cc-done .actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 12px; }
.cc-new { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; }
.cc-new select { font: inherit; padding: 8px 10px; border-radius: var(--radius-sm); border: 1.5px solid var(--line); background: #fff; max-width: 100%; }
.cc-leave { margin-top: 24px; }

/* Review puzzles (50 or 100 words): bigger grid with readable squares that scrolls inside its box,
   and on laptops the clues sit in their own scrolling panel beside it */
#cross.big { max-width: 1500px; }
.cc-main.big .cc-board { max-height: calc(100vh - 150px); border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: rgba(255, 255, 255, 0.6); }
@media (min-width: 901px) {
  .cc-main.big { grid-template-columns: minmax(0, 1fr) 340px; }
  .cc-main.big .cc-clues { grid-template-columns: 1fr; position: sticky; top: 8px; max-height: calc(100vh - 24px); overflow-y: auto; padding-right: 4px; }
}
@media (max-width: 900px) { .cc-main.big .cc-board { max-height: 70vh; } }
