/* css/polish.css — UX polish wave */

/* Anim-speed multiplier — settings adjust this */
:root { --anim-speed: 1; }

/* ── AI SUMMARY OVERLAY ── */
#ai-summary-overlay {
  position: fixed;
  top: 70px;
  right: 18px;
  z-index: 400;
  width: 340px;
  background: rgba(255, 252, 245, 0.97);
  border: 2px solid rgba(200, 185, 160, 0.6);
  border-radius: 16px;
  padding: 18px 20px 14px;
  box-shadow: 0 8px 36px rgba(0, 0, 0, 0.32);
  font-family: 'Cinzel', serif;
  animation: aiSummaryIn calc(360ms * var(--anim-speed)) cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
#ai-summary-overlay.dismissing {
  animation: aiSummaryOut calc(260ms * var(--anim-speed)) ease-in forwards;
}
@keyframes aiSummaryIn {
  from { transform: translateX(380px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}
@keyframes aiSummaryOut {
  from { transform: translateX(0); opacity: 1; }
  to   { transform: translateX(380px); opacity: 0; }
}
.ai-sum-header {
  display: flex; align-items: center; gap: 10px; margin-bottom: 10px;
  border-bottom: 1px solid #e8e0d0; padding-bottom: 8px;
}
.ai-sum-crest {
  width: 38px; height: 38px; border-radius: 50%;
  background-size: cover; background-position: center;
  border: 2px solid #c8b898;
  background-color: #faf8f2;
}
.ai-sum-title {
  flex: 1;
}
.ai-sum-name {
  font-size: 13px; font-weight: 900; letter-spacing: 2px; color: #3a3028;
}
.ai-sum-sub {
  font-size: 9px; letter-spacing: 2px; color: #a09080; margin-top: 2px;
}
.ai-sum-list {
  list-style: none; padding: 0; margin: 0 0 10px;
  max-height: 220px; overflow-y: auto;
  font-family: Georgia, serif;
}
.ai-sum-list li {
  font-size: 11px; line-height: 1.5; padding: 4px 0 4px 18px;
  position: relative; color: #3a3028;
  border-bottom: 1px dashed #efe6d4;
}
.ai-sum-list li:last-child { border-bottom: none; }
.ai-sum-list li::before {
  content: '•'; position: absolute; left: 4px; color: #a09080;
}
.ai-sum-list li.ai-sum-bold { font-weight: 700; color: #c0392b; }
.ai-sum-empty {
  font-size: 11px; color: #a09080; font-style: italic;
  font-family: Georgia, serif; padding: 8px 0; text-align: center;
}
.ai-sum-ok {
  width: 100%; padding: 8px;
  background: #3a3028; color: #faf8f2;
  border: none; border-radius: 10px;
  font-family: 'Cinzel', serif; font-size: 10px; letter-spacing: 2px;
  font-weight: 700; cursor: pointer;
}
.ai-sum-ok:hover { background: #2a2018; }
.ai-sum-timer {
  height: 3px; background: #e8e0d0; border-radius: 2px; overflow: hidden;
  margin-bottom: 8px;
}
.ai-sum-timer-bar {
  height: 100%; background: linear-gradient(90deg, #c8b898, #8a7028);
  width: 100%;
  animation: aiSumCountdown 3500ms linear forwards;
}
@keyframes aiSumCountdown { to { width: 0; } }

/* ── SETTINGS MODAL ── */
#settings-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.65);
  z-index: 350; display: none; align-items: center; justify-content: center;
}
.settings-modal {
  background: rgba(255, 252, 245, 0.97);
  border-radius: 20px;
  padding: 28px 32px;
  width: 420px; max-height: 85vh; max-height: 85svh; overflow-y: auto;
  box-shadow: 0 8px 48px rgba(0, 0, 0, 0.35);
  border: 2px solid rgba(200, 185, 160, 0.5);
  font-family: 'Cinzel', serif;
  animation: diceModalIn 0.2s ease-out;
}
.settings-row {
  display: flex; flex-direction: column; gap: 6px;
  padding: 12px 0; border-bottom: 1px solid #efe6d4;
}
.settings-row:last-of-type { border-bottom: none; }
.settings-label {
  font-size: 11px; font-weight: 700; letter-spacing: 2px; color: #3a3028;
}
.settings-hint {
  font-size: 9px; color: #a09080; font-family: Georgia, serif;
}
.settings-options { display: flex; gap: 6px; flex-wrap: wrap; }
.settings-opt {
  padding: 6px 12px; border-radius: 8px; border: 1px solid #d4c8b0;
  background: #f0e8d8; color: #7a6a50;
  font-family: 'Cinzel', serif; font-size: 10px; letter-spacing: 1px;
  font-weight: 700; cursor: pointer; transition: all 0.15s;
}
.settings-opt.active { background: #3a3028; color: #faf8f2; border-color: #3a3028; }
.settings-opt:hover:not(.active) { background: #e0d8c8; }
.settings-slider {
  width: 100%; appearance: none; height: 6px; border-radius: 4px;
  background: #e8e0d0; outline: none;
}
.settings-slider::-webkit-slider-thumb {
  appearance: none; width: 18px; height: 18px; border-radius: 50%;
  background: #3a3028; cursor: pointer; border: 2px solid #faf8f2;
}
.settings-slider::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%;
  background: #3a3028; cursor: pointer; border: 2px solid #faf8f2;
}
.settings-vol-display {
  font-size: 11px; color: #3a3028; font-weight: 700;
  width: 40px; text-align: right;
}
.settings-vol-row { display: flex; align-items: center; gap: 10px; }

/* ── GAME OVER EXTENDED ── */
#gameover-overlay {
  align-items: flex-start !important;
  padding: 40px 20px;
  overflow-y: auto;
}
.gameover-card {
  background: rgba(255, 252, 245, 0.98);
  border: 2px solid #c8b898;
  border-radius: 20px;
  padding: 28px 36px;
  max-width: 540px; width: 100%;
  margin: auto;
  box-shadow: 0 8px 64px rgba(0, 0, 0, 0.5);
  font-family: 'Cinzel', serif;
  text-align: center;
}
.gameover-crest {
  width: 80px; height: 80px; border-radius: 50%;
  margin: 0 auto 12px;
  background-size: cover; background-position: center;
  border: 3px solid #c8b898;
}
.gameover-winner-name {
  font-size: 22px; font-weight: 900; letter-spacing: 4px;
  margin-bottom: 4px;
}
.gameover-track {
  font-size: 11px; letter-spacing: 2px; color: #a09080; margin-bottom: 18px;
}
.gameover-stats {
  width: 100%; border-collapse: collapse; margin: 0 0 18px;
  font-family: Georgia, serif;
}
.gameover-stats th, .gameover-stats td {
  text-align: left; padding: 6px 10px; font-size: 11px;
  border-bottom: 1px solid #efe6d4;
}
.gameover-stats th {
  font-family: 'Cinzel', serif; font-size: 9px; letter-spacing: 2px;
  color: #7a6a50; font-weight: 700;
  background: #f7f0e0;
}
.gameover-stats td.gs-val { text-align: right; font-weight: 700; color: #3a3028; }
.gameover-section {
  font-family: 'Cinzel', serif; font-size: 10px; letter-spacing: 3px;
  color: #7a6a50; font-weight: 700;
  margin: 14px 0 6px; text-align: left;
}

/* ── MINI-MAP ── */
#mini-map-wrap {
  position: fixed;
  top: 64px;
  left: 12px;
  z-index: 90;
  background: rgba(255, 252, 245, 0.92);
  border: 2px solid rgba(200, 185, 160, 0.6);
  border-radius: 10px;
  padding: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(6px);
}
#mini-map-canvas {
  display: block;
  cursor: crosshair;
  border-radius: 6px;
}
#mini-map-label {
  font-family: 'Cinzel', serif; font-size: 8px; letter-spacing: 2px;
  color: #a09080; text-align: center; margin-top: 3px;
}

/* ── KEYBOARD HINT + HELP ── */
#kbd-hint {
  position: fixed; bottom: 130px; right: 18px; z-index: 80;
  background: rgba(58, 48, 40, 0.85); color: #faf8f2;
  border-radius: 8px; padding: 6px 12px;
  font-family: 'Cinzel', serif; font-size: 10px; letter-spacing: 1px;
  pointer-events: none;
  animation: kbdHintFade 6s ease forwards;
}
@keyframes kbdHintFade {
  0%, 70% { opacity: 0.9; }
  100% { opacity: 0; visibility: hidden; }
}

#kbd-help-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.7);
  z-index: 360; display: none; align-items: center; justify-content: center;
}
.kbd-help-modal {
  background: rgba(255, 252, 245, 0.97);
  border-radius: 18px; padding: 26px 32px;
  width: 420px; max-height: 80vh; max-height: 80svh; overflow-y: auto;
  border: 2px solid rgba(200, 185, 160, 0.5);
  font-family: 'Cinzel', serif;
  animation: diceModalIn 0.18s ease-out;
}
.kbd-help-list {
  display: grid; grid-template-columns: 60px 1fr; gap: 8px 14px;
  margin: 14px 0 16px;
}
.kbd-key {
  display: inline-block; min-width: 28px; text-align: center;
  padding: 4px 8px; border-radius: 6px;
  background: #3a3028; color: #faf8f2;
  font-family: 'Cinzel', serif; font-size: 11px; font-weight: 700;
  border: 1px solid #2a2018;
  box-shadow: 0 2px 0 #1a1208;
}
.kbd-desc {
  font-family: Georgia, serif; font-size: 12px; color: #3a3028;
  align-self: center;
}

/* Settings gear button uses zoom-btn styling already */

/* Hide log when setting toggled */
body.hide-event-log .log { display: none !important; }

/* Honour the anim-speed variable on existing animations */
.fx-move, .fx-hit, .fx-capture, .fx-garrison,
.die.die-locked, .tile-unit-shield {
  animation-duration: calc(var(--orig-anim, 1) * 1ms);
}

/* ── RANDOM EVENT POPUP ── */
#event-overlay {
  position: fixed;
  top: 90px; left: 50%; transform: translateX(-50%);
  z-index: 410;
  min-width: 320px; max-width: 460px;
  background: rgba(255, 252, 245, 0.97);
  border: 3px solid #c8b898;
  border-radius: 16px;
  padding: 16px 22px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.35);
  font-family: 'Cinzel', serif;
  text-align: center;
  cursor: pointer;
  animation: eventPop calc(380ms * var(--anim-speed)) cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
#event-overlay.event-positive { border-color: #50a850; }
#event-overlay.event-negative { border-color: #c0392b; }
#event-overlay.dismissing { animation: eventOut 260ms ease-in forwards; }
@keyframes eventPop {
  from { transform: translateX(-50%) translateY(-30px); opacity: 0; }
  to   { transform: translateX(-50%) translateY(0); opacity: 1; }
}
@keyframes eventOut {
  from { transform: translateX(-50%) translateY(0); opacity: 1; }
  to   { transform: translateX(-50%) translateY(-30px); opacity: 0; }
}
.event-icon { font-size: 36px; line-height: 1; margin-bottom: 4px; }
.event-name {
  font-size: 16px; font-weight: 900; letter-spacing: 3px;
  color: #3a3028; margin-bottom: 6px;
}
.event-desc {
  font-family: Georgia, serif; font-size: 12px;
  color: #5a4838; line-height: 1.5;
}
.event-hint {
  margin-top: 8px; font-size: 9px; letter-spacing: 2px;
  color: #a09080;
}

/* ── DOMINATION VICTORY BAR ── (vt-fill-dom set in game.css) */

/* ── TUTORIAL ── */
#tutorial-overlay { position: fixed; inset: 0; z-index: 700; pointer-events: none; }
#tutorial-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.7);
  transition: background 0.3s ease;
  pointer-events: auto;
}
#tutorial-tooltip {
  position: fixed; width: 320px;
  background: #faf3df;
  border: 3px solid #8a7028;
  border-radius: 14px;
  padding: 18px 20px 14px;
  font-family: 'Cinzel', serif;
  box-shadow: 0 8px 36px rgba(0,0,0,0.45);
  pointer-events: auto;
}
#tut-title {
  font-size: 14px; font-weight: 900; letter-spacing: 2px;
  color: #3a3028; margin-bottom: 8px;
}
#tut-body {
  font-family: Georgia, serif; font-size: 13px;
  color: #3a3028; line-height: 1.5; margin-bottom: 14px;
}
.tut-bottom {
  display: flex; align-items: center; justify-content: space-between;
}
#tut-step-count {
  font-size: 10px; letter-spacing: 2px; color: #a09080;
}
.tut-actions { display: flex; gap: 8px; }
#tut-skip {
  background: transparent; border: none; color: #a09080;
  font-family: 'Cinzel', serif; font-size: 10px; letter-spacing: 2px;
  cursor: pointer; padding: 6px 10px;
}
#tut-skip:hover { color: #3a3028; }
#tut-next {
  background: #3a3028; color: #faf8f2;
  border: none; border-radius: 8px;
  font-family: 'Cinzel', serif; font-size: 11px; font-weight: 700;
  letter-spacing: 2px; padding: 8px 16px; cursor: pointer;
}
#tut-next:hover { background: #2a2018; }
.tutorial-pulse {
  animation: tutorialPulse 1.4s ease-in-out infinite;
  position: relative; z-index: 701;
  box-shadow: 0 0 0 4px rgba(232, 200, 64, 0.6),
              0 0 24px 4px rgba(232, 200, 64, 0.5);
  border-radius: 12px;
}
@keyframes tutorialPulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(232,200,64,0.55), 0 0 24px 4px rgba(232,200,64,0.4); }
  50%      { box-shadow: 0 0 0 8px rgba(232,200,64,0.85), 0 0 40px 8px rgba(232,200,64,0.7); }
}
