#overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex; align-items: center; justify-content: center;
  color: #ccc; font-size: 14px; letter-spacing: 6px;
  z-index: 10; cursor: pointer; user-select: none;
  transition: opacity 0.25s ease;
}
#overlay .overlay-text {
  display: none;
  padding: 14px 28px; border: 1px solid #444; background: rgba(20, 10, 5, 0.7);
  font-size: 16px; letter-spacing: 10px; min-width: 220px;
  text-align: center; color: #d8d8d8; text-transform: uppercase;
  text-shadow: 0 0 18px rgba(220, 220, 220, 0.45);
}
#overlay.intro-mode .overlay-text { display: inline-block; }
#overlay.intro-mode .title-card   { display: none; }
#overlay.hidden { opacity: 0; pointer-events: none; }

.title-card { text-align: center; color: #f0c070; user-select: none; max-width: 560px; }
.title-name {
  font-size: 56px; letter-spacing: 14px;
  text-shadow: 0 0 24px rgba(240, 180, 80, 0.45);
  margin-bottom: 6px;
}
.title-sub {
  font-size: 11px; letter-spacing: 5px; color: #8a6040;
  margin-bottom: 26px;
}
.title-story {
  color: #a08868; font-size: 12px; letter-spacing: 2px;
  line-height: 1.85;
  max-width: 460px; margin: 0 auto 28px;
  text-align: center;
}
.title-story p { margin: 0 0 6px; }
.title-cursor {
  display: inline-block; margin-left: 2px;
  color: #f0c070;
  text-shadow: 0 0 8px rgba(240, 200, 100, 0.55);
  animation: title-blink 0.85s steps(1) infinite;
}
.title-cursor.done { animation: none; opacity: 0.7; }
@keyframes title-blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }

.title-actions {
  display: flex; gap: 12px; justify-content: center; margin-bottom: 14px;
}
.title-btn {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: inherit;
  font-size: 13px; letter-spacing: 5px; text-transform: uppercase;
  padding: 11px 22px;
  background: linear-gradient(180deg, #2a1d0f, #160c04);
  color: #d0a878;
  border: 1px solid #5a3a18;
  border-radius: 2px;
  box-shadow: inset 0 1px 0 rgba(255, 200, 120, 0.05),
              0 2px 0 rgba(0, 0, 0, 0.45);
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s, transform 0.06s;
}
.title-btn:hover {
  background: linear-gradient(180deg, #3a2814, #1c1006);
  color: #f0c070; border-color: #8a5028;
}
.title-btn:active { transform: translateY(1px); }
.title-btn svg {
  width: 15px; height: 15px;
  stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
  fill: none;
}
.title-btn.primary svg { fill: currentColor; stroke: none; }
.title-btn.primary {
  background: linear-gradient(180deg, #5a3416, #2c1808);
  color: #f8e090; border-color: #b87530;
  padding: 13px 32px; font-size: 14px;
  text-shadow: 0 0 8px rgba(248, 224, 144, 0.4);
}
.title-btn.primary:hover {
  background: linear-gradient(180deg, #6a3e1a, #3a200c);
  color: #fff; border-color: #d89040;
}
.title-foot {
  font-size: 10px; letter-spacing: 4px; color: #6a4828;
  margin-bottom: 22px;
}
.title-foot b { color: #d0a878; font-weight: normal; }
.title-panel {
  margin: 0 auto 8px; max-width: 520px;
  padding: 18px 22px;
  border: 1px solid #3a2812;
  background: rgba(10, 5, 2, 0.65);
  text-align: center;
}
.title-panel[hidden] { display: none; }
.title-ctrl {
  display: grid; grid-template-columns: auto auto;
  gap: 6px 22px; font-size: 12px; letter-spacing: 2px;
  color: #d0a878; margin: 0 auto 16px;
  width: fit-content; text-align: left;
}
.title-ctrl span:nth-child(2n) { color: #8a6040; text-transform: lowercase; }
.title-tips {
  list-style: none; padding: 0; margin: 0;
  font-size: 11px; letter-spacing: 2px; color: #8a6040;
  line-height: 1.7;
  text-align: left;
  max-width: 360px; margin: 0 auto;
}
.title-tips li::before { content: '· '; color: #5a4020; }

.screen {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 26px;
  background: rgba(10, 5, 2, 0.9);
  z-index: 20;
  color: #f0c070;
  font-family: inherit;
  user-select: none;
}
.screen.hidden { display: none; }
.screen h1 {
  font-size: 68px;
  letter-spacing: 14px;
  margin: 0;
  text-shadow: 0 0 32px rgba(240, 80, 40, 0.5), 0 0 8px rgba(240, 80, 40, 0.9);
}
#game-over h1 { color: #e04040; }
#victory h1   { color: #f0d070;
                text-shadow: 0 0 32px rgba(240, 200, 60, 0.5), 0 0 8px rgba(240, 200, 60, 0.9); }
#go-stats, #vic-stats { font-size: 14px; letter-spacing: 5px; color: #a8866a; }

#vic-name-row {
  display: flex; gap: 10px; align-items: center; justify-content: center;
}
#vic-name-row label {
  color: #8a6040; font-size: 11px; letter-spacing: 4px;
}
#vic-name {
  font-family: inherit; font-size: 14px; letter-spacing: 4px;
  padding: 8px 12px; min-width: 180px;
  background: rgba(20, 10, 4, 0.7); color: #f0d070;
  border: 1px solid #6a4020; outline: none; text-transform: uppercase;
}
#vic-name:focus { border-color: #b87530; box-shadow: 0 0 12px rgba(248,210,128,0.3); }
#vic-submit {
  font-family: inherit; font-size: 12px; letter-spacing: 4px;
  padding: 8px 18px; cursor: pointer;
  background: linear-gradient(180deg, #4a2e14, #2a1808);
  color: #f8e090; border: 1px solid #b87530;
}
#vic-submit:hover { background: linear-gradient(180deg, #6a3e1a, #3a200c); color: #fff; }
#vic-submit:disabled { opacity: 0.4; cursor: default; }

#vic-board {
  display: flex; flex-direction: column; gap: 4px;
  min-width: 360px;
  padding: 14px 18px;
  border: 1px solid #3a2812;
  background: rgba(8, 4, 2, 0.7);
  font-size: 12px; letter-spacing: 3px;
  color: #a8866a;
}
#vic-board .board-title {
  color: #f0d070; font-size: 11px; letter-spacing: 5px; margin-bottom: 8px;
}
#vic-board .row {
  display: grid; grid-template-columns: 22px 1fr auto; gap: 14px;
  padding: 3px 4px;
}
#vic-board .row.you { color: #f0d070; }
#vic-board .row .rank { color: #6a4828; text-align: right; }
#vic-board .empty { color: #5a4020; font-style: italic; padding: 4px; }
#retry-btn, #replay-btn {
  padding: 12px 42px;
  font-family: inherit;
  font-size: 16px;
  letter-spacing: 6px;
  background: #2a1d0f;
  color: #f0c070;
  border: 2px solid #5a4020;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
#retry-btn:hover, #replay-btn:hover {
  background: #3a2814;
  color: #fff;
  border-color: #8a6030;
}
