/* ============================================================================
 * Overlays — Editorial Left-Aligned Title Stage & Right-Anchored Result Ledger
 * ========================================================================== */
.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 240ms var(--ease-ui);
  z-index: 25;
}

.overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

/* Title Screen: Asymmetric Left-Weighted Editorial Game Frame (No Centered Modal Box!) */
.overlay.title-mode {
  justify-content: flex-start;
  padding: clamp(24px, 4vw, 48px) clamp(24px, 6vw, 76px);
  background: linear-gradient(
    95deg,
    rgba(11, 13, 19, 0.94) 0%,
    rgba(11, 13, 19, 0.82) 38%,
    rgba(11, 13, 19, 0.24) 64%,
    rgba(11, 13, 19, 0.04) 84%
  );
}

.title-stage {
  width: min(468px, 100%);
  transform: translateY(8px);
  transition: transform 300ms var(--ease-ui);
}

.overlay.visible .title-stage {
  transform: translateY(0);
}

.title-stage h1 {
  margin: 0;
  font-size: clamp(28px, 3.6vw, 40px);
  font-weight: 800;
  line-height: 1.18;
  letter-spacing: -0.02em;
  color: var(--ink-main);
  text-shadow: 0 3px 0 var(--stone-ledge);
  text-wrap: balance;
}

.title-brass-rule {
  position: relative;
  width: 96px;
  height: 2px;
  margin: 14px 0 16px;
  background: var(--brass);
}

.title-brass-rule::after {
  content: "";
  position: absolute;
  right: -8px;
  top: -2px;
  width: 6px;
  height: 6px;
  background: var(--brass);
  transform: rotate(45deg);
}

.lead {
  margin: 0 0 22px;
  font-size: 13.5px;
  line-height: 1.72;
  color: var(--ink-muted);
  word-break: keep-all;
  overflow-wrap: anywhere;
  text-wrap: pretty;
}

.lead strong {
  color: var(--ink-main);
  font-weight: 700;
}

.resume-run-btn {
  margin-bottom: 10px;
  background: #163240;
  color: #e9fbff;
  border-color: var(--soul-cyan);
  border-bottom-color: #0d212b;
  box-shadow: 0 4px 0 var(--stone-ledge);
}

@media (hover: hover) {
  .resume-run-btn:hover {
    background: #1d4154;
    border-color: #88f1ff;
  }
}

.checkpoint-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding: 6px 10px;
  background: var(--stone-base);
  border: 1px solid var(--stone-edge);
  border-left: 2px solid var(--brass);
  border-bottom: 2px solid var(--stone-ledge);
  border-radius: var(--radius-outer);
  box-shadow: 0 3px 0 var(--stone-ledge);
}

.checkpoint-label {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--brass);
}

.checkpoint-select {
  flex: 1 1 auto;
  min-width: 0;
  background: var(--stone-deep);
  color: var(--ink-main);
  border: 1px solid var(--stone-edge);
  border-radius: var(--radius-inner);
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.checkpoint-select:focus-visible {
  outline: 1px solid var(--brass);
  outline-offset: 1px;
}

.title-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.primary-btn,
.secondary-btn {
  width: 100%;
  min-height: 44px;
  appearance: none;
  border-radius: var(--radius-outer);
  padding: 11px 16px;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform 150ms var(--ease-ui), background-color 140ms var(--ease-ui), border-color 140ms var(--ease-ui);
}

.primary-btn {
  background: var(--brass);
  color: #161108;
  border: 1px solid var(--brass-bright);
  border-bottom: 2px solid var(--brass-dark);
  box-shadow: 0 4px 0 var(--stone-ledge);
}

.secondary-btn {
  background: var(--stone-base);
  color: var(--ink-main);
  border: 1px solid var(--stone-edge);
  border-top-color: var(--stone-bevel-top);
  border-bottom: 2px solid var(--stone-ledge);
  box-shadow: 0 4px 0 var(--stone-ledge);
}

.daily-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 6px 12px;
  border-color: var(--brass-dim);
  color: var(--ink-main);
}

.daily-btn-main {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
}

.daily-btn-sub {
  font-size: 9.5px;
  font-weight: 600;
  color: var(--brass-bright);
  letter-spacing: 0.03em;
  line-height: 1.15;
}

.codex-trigger-btn,
.boss-practice-trigger-btn {
  min-height: 38px;
  padding: 8px 14px;
  font-size: 12.5px;
  color: var(--ink-muted);
  border-color: var(--stone-edge);
}

.boss-practice-trigger-btn {
  border-left: 2px solid var(--brass-dim);
}

@media (hover: hover) {
  .codex-trigger-btn:hover,
  .boss-practice-trigger-btn:hover {
    color: var(--ink-main);
    border-color: var(--brass-dim);
  }
}

.primary-btn:not(:disabled):active,
.secondary-btn:not(:disabled):active {
  transform: scale(0.96);
}

.btn-kbd {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 5px;
  border-radius: var(--radius-inner);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.35;
  vertical-align: 1px;
  letter-spacing: 0.03em;
  background: rgba(11, 13, 19, 0.34);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: inherit;
  opacity: 0.85;
}

.primary-btn .btn-kbd {
  background: rgba(22, 17, 8, 0.24);
  border-color: rgba(22, 17, 8, 0.38);
}

body.touch-mode .btn-kbd {
  display: none;
}

@media (pointer: coarse) {
  .btn-kbd {
    display: none;
  }
}

@media (hover: hover) {
  .primary-btn:hover { background: var(--brass-bright); }
  .secondary-btn:hover { background: var(--stone-raised); border-color: var(--brass); }
}

.title-records {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 10px;
  padding: 9px 12px;
  border-radius: var(--radius-inner);
  background: rgba(16, 19, 26, 0.84);
  border: 1px solid var(--stone-edge);
  border-left: 2px solid var(--brass-dim);
  font-variant-numeric: tabular-nums;
}

.title-save-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 16px;
  padding: 6px 10px;
  border-radius: var(--radius-inner);
  background: var(--stone-deep);
  border: 1px solid #252b38;
  font-size: 11px;
  color: var(--ink-muted);
}

.title-save-status.is-saved {
  border-left: 2px solid var(--soul-cyan);
}

.title-save-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.title-save-link {
  flex-shrink: 0;
  appearance: none;
  padding: 3px 8px;
  border-radius: var(--radius-inner);
  background: var(--stone-base);
  border: 1px solid var(--stone-edge);
  color: var(--brass-bright);
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 120ms var(--ease-ui), background-color 140ms var(--ease-ui), border-color 140ms var(--ease-ui);
}

.title-save-link:not(:disabled):active {
  transform: scale(0.96);
}

@media (hover: hover) {
  .title-save-link:hover {
    background: var(--stone-raised);
    border-color: var(--brass);
  }
}

.record-cell {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.record-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-muted);
  white-space: nowrap;
}

.record-cell strong {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-main);
  white-space: nowrap;
}

#rec-daily {
  color: var(--soul-cyan);
}

.record-divider {
  width: 1px;
  height: 16px;
  background: var(--brass-dim);
  flex-shrink: 0;
}

.controls-list {
  list-style: none;
  padding: 12px 0 0;
  margin: 0;
  border-top: 1px solid rgba(240, 231, 213, 0.12);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px 14px;
  font-size: 11.5px;
  color: var(--ink-muted);
}

.controls-list li {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 5px;
  white-space: nowrap;
  min-width: 0;
}

.controls-list li span {
  color: var(--ink-main);
}

kbd {
  display: inline-block;
  padding: 1px 6px;
  border-radius: var(--radius-inner);
  background: var(--stone-deep);
  border: 1px solid var(--stone-edge);
  border-bottom: 2px solid var(--stone-ledge);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--brass);
  flex-shrink: 0;
}
