/* Molecular Crossword — styles */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  color: #222;
  background: #f5f5f5;
  /* Page scrolls normally — no height/overflow lock */
}

/* ---- Page column ---- */

.page-col {
  max-width: 640px;
  margin: 0 auto;
  padding: 12px 16px 32px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ---- Title row ---- */

.title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.title-row h1 {
  flex: 1;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-align: center;
  white-space: nowrap;
}

.icon-btn {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  font-size: 16px;
  line-height: 1;
  border-radius: 8px;
  border: 1px solid #bbb;
  background: #fff;
  color: #333;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.icon-btn:hover {
  background: #f0f4ff;
  border-color: #5ba0f5;
}

/* ---- Solved banner ---- */

#solved-banner {
  background: #1a9e3a;
  color: #fff;
  text-align: center;
  padding: 6px;
  font-weight: 700;
  font-size: 15px;
}

/* ---- Molecule panel ---- */

.mol-panel {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  position: relative;
  /* Square on a phone; on a wide screen, no taller than 60% of the window
     so the first clues stay in view. */
  aspect-ratio: 1 / 1;
  width: min(100%, 60vh);
  margin: 0 auto;
  overflow: hidden;
}

/* Hidden text field: invisible but focusable; placed near top so the
   browser does not scroll the molecule off-screen when it focuses. */
#el-input {
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 1px;
  height: 1px;
  font-size: 16px; /* prevents iOS zoom */
  opacity: 0;
  pointer-events: none; /* taps go to the SVG, not here */
  border: none;
  outline: none;
}

#mol-svg {
  width: 100%;
  height: 100%;
  display: block;
  cursor: default;
  user-select: none;
  touch-action: manipulation;
}

/* Atom and bond hit targets */
.atom {
  cursor: pointer;
  transition: stroke 0.1s, fill 0.1s;
}

.atom:hover {
  stroke-width: 2.5;
}

.atom-hit {
  cursor: pointer;
}

.bond-hit {
  cursor: pointer;
}

/* ---- Clue list ---- */

#clue-panel {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 10px 12px;
}

.clue-list {
  list-style: none;
  padding: 0;
}

.clue-item {
  padding: 6px 8px;
  border-radius: 5px;
  margin-bottom: 3px;
  cursor: pointer;
  line-height: 1.4;
  display: flex;
  align-items: flex-start;
  gap: 4px;
  transition: background 0.1s;
}

.clue-item:hover {
  background: #edf2ff;
}

.clue-selected {
  background: #dbeafe;
}

.clue-selected:hover {
  background: #bfdbfe;
}

.clue-solved {
  color: #1a9e3a;
}

.clue-solved .clue-icon {
  color: #1a9e3a;
  font-weight: bold;
}

.clue-num {
  font-weight: 700;
  color: #444;
  min-width: 20px;
  flex-shrink: 0;
}

.clue-icon {
  color: #999;
  font-size: 11px;
  margin-top: 1px;
  flex-shrink: 0;
}

.clue-text {
  font-size: 13px;
  color: #333;
  flex: 1;
}

.clue-name {
  font-style: italic;
  color: #1a9e3a;
  font-size: 12px;
  margin-left: 4px;
}

/* ---- Action buttons ---- */

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

.action-btn {
  flex: 1;
  padding: 10px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid #bbb;
  background: #fff;
  color: #333;
  cursor: pointer;
  text-align: center;
  transition: background 0.1s, border-color 0.1s;
}

.action-btn:hover {
  background: #f0f4ff;
  border-color: #5ba0f5;
  color: #1a4fa8;
}

.action-btn-reveal {
  background: #fff8e1;
  border-color: #f9a825;
  color: #795548;
}

.action-btn-reveal:hover {
  background: #fff3cd;
  border-color: #e67700;
}

/* ---- Status message ---- */

#status-msg {
  font-size: 12px;
  color: #888;
  min-height: 16px;
  text-align: center;
}

/* ---- No-puzzles fallback ---- */

.no-puzzles {
  max-width: 540px;
  margin: 80px auto;
  padding: 32px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  text-align: center;
  line-height: 1.8;
}

.no-puzzles p {
  margin-bottom: 10px;
}

.no-puzzles code {
  font-family: 'Courier New', monospace;
  background: #f5f5f5;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 13px;
}

/* ---- Help dialog ---- */

.help-dialog {
  max-width: 460px;
  margin: auto;
  padding: 20px 24px;
  border: none;
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
  font-size: 14px;
  line-height: 1.5;
  color: #222;
}

.help-dialog::backdrop {
  background: rgba(0, 0, 0, 0.35);
}

.help-dialog h2 {
  font-size: 18px;
  margin-bottom: 10px;
}

.help-dialog p,
.help-dialog ul {
  margin-bottom: 10px;
}

.help-dialog ul {
  padding-left: 18px;
}

.help-dialog li {
  margin-bottom: 4px;
}

.help-dialog .action-btn {
  width: 100%;
  margin-top: 6px;
}
