/* Top bar, title screen, depth select, settings / guide / achievements modal contents. */

/* Top bar */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1.5px solid var(--border);
  padding-bottom: 8px;
  flex-shrink: 0;
  gap: 8px;
}
.brand {
  color: var(--crimson);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 1px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: text-shadow 0.15s ease;
}
.brand:hover { text-shadow: 0 0 12px rgba(215, 58, 73, 0.6); }
.top-controls { display: flex; gap: 6px; align-items: center; }

/* Title */
#view-title {
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 22px;
}
.title-seal {
  border: 2px solid var(--crimson);
  padding: 26px 40px;
  background: linear-gradient(180deg, rgba(40,14,22,0.72) 0%, rgba(10,11,17,0.92) 100%);
  box-shadow: 0 0 60px rgba(215, 58, 73, 0.25), inset 0 0 28px rgba(215, 58, 73, 0.16);
  max-width: 100%;
}
.title-kanji {
  font-family: 'Noto Serif JP', serif;
  font-size: clamp(2.6rem, 11vw, 4.6rem);
  color: var(--crimson);
  letter-spacing: 0.6rem;
  margin-right: -0.6rem;
  text-shadow: 0 0 26px rgba(215, 58, 73, 0.65);
}
.title-eng { font-size: 0.96rem; letter-spacing: 0.35rem; color: var(--text); margin-top: 8px; }
.title-sub { color: var(--muted); font-size: 0.78rem; margin-top: 8px; }

.saved-run-banner {
  font-size: 0.78rem;
  color: var(--gold);
  background: rgba(229, 192, 123, 0.1);
  border: 1px solid #6e5931;
  padding: 6px 14px;
  border-radius: 3px;
  display: none;
  cursor: pointer;
  max-width: 100%;
}
.saved-run-banner.show { display: inline-block; }

.title-menu {
  display: flex;
  flex-direction: column;
  gap: 11px;
  width: 100%;
  max-width: 280px;
}
.menu-btn {
  width: 100%;
  height: 48px;
  background: rgba(16, 18, 27, 0.92);
  border: 1.5px solid var(--border);
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 2px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.18s ease;
}
.menu-btn:hover, .menu-btn.kb-focus {
  border-color: var(--crimson);
  color: var(--gold);
  transform: scale(1.03);
  box-shadow: 0 0 20px rgba(215, 58, 73, 0.35);
  background: linear-gradient(90deg, rgba(215,58,73,0.14), rgba(16,18,27,0.95), rgba(215,58,73,0.14));
}

/* Icon-only corner buttons (guide / achievements) */
.corner-btn {
  position: absolute;
  bottom: 6px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(16, 18, 27, 0.92);
  border: 1.5px solid var(--border);
  font-size: 1.35rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.16s ease;
  z-index: 10;
}
.corner-btn.left { left: 0; }
.corner-btn.right { right: 0; }
.corner-btn:hover {
  border-color: var(--gold);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(229, 192, 123, 0.25);
}
.trial-line {
  display: none;
  font-size: 0.74rem;
  color: #9aa3b5;
  border-bottom: 1px dashed #6e5931;
  cursor: pointer;
  padding-bottom: 2px;
}
.trial-line.show { display: inline-block; }
.trial-line:hover { color: var(--gold); }

/* AI connect modal */
.connect-step { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 0.8rem; color: var(--gold); }
.connect-status { font-size: 0.78rem; min-height: 1.2em; color: var(--muted); }
.connect-status.ok { color: var(--green); }
.connect-status.err { color: #ff8a95; }
.connect-actions { display: flex; flex-direction: column; gap: 8px; }
.connect-main { padding: 10px; font-size: 0.88rem; }
.connect-sub { display: flex; gap: 8px; justify-content: space-between; flex-wrap: wrap; }
.connect-sub .btn { flex: 1; }

/* Depth select */
#view-select { gap: 10px; }
.select-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 4px 2px;
  flex-shrink: 0;
}
.select-title { color: var(--crimson); font-weight: 700; font-size: 0.9rem; }
.abyss-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 6px 24px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.abyss-spine {
  width: 100%;
  max-width: 660px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
}
.abyss-spine::before {
  content: "";
  position: absolute;
  left: 36px;
  top: 20px;
  bottom: 20px;
  width: 2px;
  background: linear-gradient(180deg, var(--crimson) 0%, #8a2be2 100%);
  opacity: 0.5;
  z-index: 0;
}
.abyss-node {
  display: grid;
  grid-template-columns: 42px 1fr;
  column-gap: 16px;
  row-gap: 8px;
  align-items: center;
  background: var(--panel);
  border: 1.5px solid var(--border);
  padding: 12px 16px;
  cursor: pointer;
  position: relative;
  z-index: 1;
  transition: all 0.18s ease;
}
.abyss-node:hover, .abyss-node.kb-focus {
  border-color: var(--crimson);
  transform: translateX(6px);
  box-shadow: 0 4px 20px rgba(215, 58, 73, 0.28);
}
.node-num {
  width: 42px;
  height: 42px;
  border: 2px solid var(--crimson);
  background: #0b0d14;
  color: var(--crimson);
  font-weight: 700;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.node-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.node-title { font-family: 'Noto Serif JP', serif; font-size: 1.02rem; color: #f2ede4; font-weight: 700; }
.node-meta { font-size: 0.75rem; color: var(--muted); }
.node-scores { font-size: 0.74rem; color: var(--gold); }
.node-bosses {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  font-family: 'Noto Serif JP', serif;
  font-size: 0.85rem;
}
.node-bosses span { color: #4a4f5c; }
.node-bosses span.seen { color: var(--crimson); }

/* Settings */
.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #0b0d14;
  padding: 8px 12px;
  border: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--gold);
}
.setting-note { font-size: 0.75rem; color: var(--muted); line-height: 1.5; }
.setting-note a { color: var(--gold); margin-left: 6px; }
.readonly-rules { opacity: 0.7; min-height: 140px; font-size: 0.74rem; }

/* Guide */
.guide-body { white-space: pre-wrap; min-height: 150px; }
.guide-body strong { color: var(--gold); }

/* Achievements */
.ach-card { height: min(720px, 100%); }
.tab-row { display: flex; gap: 6px; flex-shrink: 0; }
.tab-btn {
  flex: 1;
  background: #0c0e16;
  border: 1.5px solid var(--border);
  color: var(--muted);
  padding: 8px 6px;
  font-size: 0.8rem;
  cursor: pointer;
}
.tab-btn small { display: block; font-size: 0.68rem; margin-top: 2px; }
.tab-btn.active { border-color: var(--gold); color: var(--gold); background: rgba(229,192,123,0.08); }
.ach-body { flex: 1; min-height: 0; overflow-y: auto; padding-right: 4px; display: flex; flex-direction: column; gap: 14px; }
.ach-hint { font-size: 0.75rem; color: var(--muted); }
.ach-group { display: flex; flex-direction: column; gap: 6px; }
.ach-group-title { font-family: 'Noto Serif JP', serif; font-size: 0.86rem; color: var(--crimson); }
.ach-group-title small { color: var(--muted); font-family: 'JetBrains Mono', monospace; margin-left: 6px; }
.ach-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 8px;
}
.ach-grid.compact { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.ach-item {
  padding: 9px 11px;
  background: #0c0e16;
  border: 1px solid #2b2126;
  display: flex;
  flex-direction: column;
  gap: 3px;
  opacity: 0.5;
}
.ach-item.unlocked {
  opacity: 1;
  border-color: var(--gold);
  background: linear-gradient(135deg, rgba(229,192,123,0.12), rgba(14,16,24,0.95));
}
.ach-name { font-size: 0.82rem; font-weight: 700; color: var(--gold); }
.ach-desc { font-size: 0.73rem; color: var(--text); }
.boss-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.boss-tile {
  min-width: 44px;
  height: 48px;
  padding: 0 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Noto Serif JP', serif;
  font-size: 1.4rem;
  background: #0c0e16;
  border: 1px solid #2b2126;
  color: #3a3f4b;
}
.boss-tile.seen {
  color: var(--crimson);
  border-color: var(--crimson);
  background: radial-gradient(circle, #2e141c 0%, #0b0d14 100%);
  text-shadow: 0 0 10px rgba(215, 58, 73, 0.5);
}

@media (max-width: 680px) {
  .brand { font-size: 0.95rem; }
  .mode-badge { display: none; }
  .title-seal { padding: 20px 22px; }
  .title-eng { font-size: 0.82rem; letter-spacing: 0.25rem; }
  #view-title { gap: 18px; }
  .abyss-spine::before { left: 30px; }
  .abyss-node { grid-template-columns: 36px 1fr; column-gap: 12px; padding: 10px 12px; }
  .node-num { width: 36px; height: 36px; font-size: 0.95rem; }
  .abyss-node:hover { transform: none; }
}
@media (max-width: 360px) {
  .brand-text { display: none; }
}
