/* ===== Spectrum - Styles ===== */

:root {
  --game-accent: #A5C9E8;
}

body { overflow-x: hidden; }

/* --- Top Bar --- */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .5rem 1rem;
  background: var(--surface);
  border-bottom: 3px solid var(--color-coral);
  box-shadow: var(--shadow-sm);
}
.top-bar .title { font-size: .85rem; font-weight: 600; color: var(--text-muted); }
.top-bar .title a { color: var(--text-muted); transition: color .2s; }
.top-bar .title a:hover { color: var(--game-accent); }
.top-bar .title span { color: var(--text); font-weight: 900; }
.top-bar-actions { display: flex; gap: .4rem; align-items: center; }
.icon-btn {
  background: var(--surface2); border: 2px solid var(--surface2);
  color: var(--text-muted); width: 30px; height: 30px; border-radius: 50%;
  font-size: .8rem; cursor: pointer; display: flex; align-items: center;
  justify-content: center; font-family: inherit; font-weight: 700;
  transition: border-color .2s, color .2s;
}
.icon-btn:hover { border-color: var(--game-accent); color: var(--game-accent); }

/* --- Game Page --- */
.game-page {
  max-width: 600px; margin: 0 auto; padding: .5rem .75rem;
  display: flex; flex-direction: column; gap: .6rem;
  min-height: calc(100vh - 48px);
}

/* --- Setup --- */
.setup-section {
  background: var(--surface); border-radius: var(--radius);
  padding: 1rem; box-shadow: var(--shadow);
}
.setup-section h4 {
  font-size: .75rem; color: var(--text-muted); text-transform: uppercase;
  letter-spacing: .05em; margin-bottom: .5rem; font-weight: 700;
}

.start-btn {
  margin-top: .8rem; width: 100%; padding: .7rem; font-size: 1.1rem;
  border-radius: 999px; background: var(--color-coral);
  color: #5A3A3A; box-shadow: 0 4px 14px rgba(165, 201, 232, .3);
  border: none; font-family: inherit; font-weight: 700; cursor: pointer;
  transition: box-shadow .2s, transform .1s;
}
.start-btn:hover { box-shadow: 0 6px 20px rgba(165, 201, 232, .45); }
.start-btn:active { transform: scale(.97); }

/* --- Phase Section --- */
.phase-section {
  background: var(--surface); border-radius: var(--radius);
  padding: 1.2rem 1rem; box-shadow: var(--shadow);
}
.round-counter {
  font-size: .7rem; color: var(--text-muted); font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em; margin-bottom: .4rem;
}

/* --- Clue Phase --- */
.clue-giver-label {
  font-size: .85rem; font-weight: 600; color: var(--text-muted);
  margin-bottom: .2rem; text-align: center;
}
.clue-giver-name {
  color: var(--game-accent); font-weight: 900; font-size: 1rem;
}

/* --- Spectrum Bar --- */
.spectrum-container {
  margin: .8rem 0;
}

.spectrum-labels {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: .35rem;
}
.label-left, .label-right {
  font-size: .85rem; font-weight: 700; color: var(--text);
  max-width: 42%; word-break: break-all; line-height: 1.2;
}
.label-left { text-align: left; }
.label-right { text-align: right; }

.spectrum-bar-wrap {
  position: relative; width: 100%;
}

.spectrum-bar {
  position: relative;
  height: 36px;
  border-radius: 999px;
  background: linear-gradient(to right,
    #3b82f6 0%,
    #06b6d4 25%,
    #a3e635 50%,
    #f59e0b 75%,
    #ef4444 100%
  );
  overflow: visible;
  box-shadow: 0 2px 12px rgba(6, 182, 212, .2);
}

/* Target zone — semi-transparent band */
.target-zone {
  position: absolute;
  top: 0; bottom: 0;
  background: rgba(255, 255, 255, .4);
  border: 2px solid rgba(255, 255, 255, .8);
  border-radius: 4px;
  transition: opacity .4s ease;
  pointer-events: none;
}

/* --- Hint Input --- */
.hint-input-section {
  margin-top: .9rem;
}
.hint-label {
  display: block; font-size: .75rem; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .04em; margin-bottom: .35rem;
}
.hint-input-row {
  display: flex; gap: .4rem;
}
.hint-input-row input {
  flex: 1; min-width: 0; padding: .45rem .7rem; font-size: 1rem;
  border-radius: 10px; font-weight: 700; text-align: center;
}
.hint-input-row .btn {
  flex-shrink: 0; padding: .45rem 1.1rem; border-radius: 10px;
  background: var(--color-coral);
  box-shadow: 0 3px 10px rgba(165, 201, 232, .3);
}
.hint-input-row .btn:hover { box-shadow: 0 5px 16px rgba(165, 201, 232, .4); }

/* --- Guess Phase --- */
.hint-display {
  font-size: 2rem; font-weight: 900; text-align: center;
  color: var(--text); letter-spacing: .02em; margin: .6rem 0 .9rem;
  padding: .5rem .8rem;
  background: linear-gradient(135deg, rgba(165,201,232,.08), rgba(165,201,232,.12));
  border-radius: 12px;
  border: 2px solid rgba(165, 201, 232, .2);
}

.guess-bar { overflow: visible; cursor: pointer; }

/* Custom slider */
.slider-wrap {
  margin-top: .6rem; padding: 0 2px;
}
.slider-wrap input[type="range"] {
  width: 100%;
  height: 36px;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  border: none;
  outline: none;
  padding: 0;
  cursor: pointer;
}
.slider-wrap input[type="range"]::-webkit-slider-runnable-track {
  height: 36px;
  border-radius: 999px;
  background: transparent;
}
.slider-wrap input[type="range"]::-moz-range-track {
  height: 36px;
  background: transparent;
}
.slider-wrap input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--game-accent);
  border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
  margin-top: 4px;
  transition: transform .1s, box-shadow .1s;
  cursor: grab;
}
.slider-wrap input[type="range"]::-moz-range-thumb {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--game-accent);
  border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
  cursor: grab;
}
.slider-wrap input[type="range"]:active::-webkit-slider-thumb {
  transform: scale(1.2);
  box-shadow: 0 4px 14px rgba(165, 201, 232, .4);
  cursor: grabbing;
}
.slider-wrap input[type="range"]:active::-moz-range-thumb {
  transform: scale(1.2);
}

/* Visual thumb overlay on bar */
.guess-slider-thumb {
  position: absolute;
  top: 50%; transform: translate(-50%, -50%);
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--game-accent);
  border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
  pointer-events: none;
  transition: left .05s, background .2s;
  z-index: 2;
}

.slider-value-row {
  display: flex; justify-content: center; margin-top: .25rem;
}
.slider-value-display {
  font-size: .8rem; font-weight: 700; color: var(--text-muted);
  background: var(--surface2); padding: .1rem .6rem; border-radius: 999px;
}

.guesser-indicator {
  text-align: center; margin: .6rem 0 .3rem;
}
.guesser-name {
  font-size: 1rem; font-weight: 900; color: var(--text); margin-bottom: .3rem;
}

.confirm-dots {
  display: flex; gap: .3rem; justify-content: center; margin-top: .25rem;
}
.confirm-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--surface2); border: 2px solid var(--surface2);
}
.confirm-dot.done { background: var(--game-accent); border-color: var(--game-accent); }
.confirm-dot.current { background: #fff; border-color: var(--game-accent); box-shadow: 0 0 0 2px rgba(165,201,232,.3); }

.submit-guess-btn {
  width: 100%; margin-top: .6rem; padding: .65rem; font-size: 1rem;
  border-radius: 999px;
  background: var(--color-coral);
  box-shadow: 0 4px 14px rgba(165, 201, 232, .3);
}
.submit-guess-btn:hover { box-shadow: 0 6px 20px rgba(165, 201, 232, .45); }

/* --- Reveal Phase --- */
.reveal-section { text-align: center; }

.reveal-hint {
  font-size: 2.2rem; font-weight: 900; color: var(--text);
  margin: .4rem 0 .8rem;
  animation: hint-pop .4s cubic-bezier(.175, .885, .32, 1.275);
}

@keyframes hint-pop {
  0% { transform: scale(.7); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.reveal-spectrum { margin-bottom: .6rem; }

.reveal-target {
  transition: opacity .5s ease .2s;
  background: rgba(255, 255, 255, .45);
  border: 2px solid rgba(255, 255, 255, .9);
}

.target-pin {
  position: absolute;
  top: -6px; bottom: -6px;
  width: 4px;
  background: #fff;
  border-radius: 2px;
  transform: translateX(-50%);
  box-shadow: 0 0 8px rgba(255,255,255,.8);
  transition: opacity .5s ease .2s;
  z-index: 3;
}
.target-pin::after {
  content: '🎯';
  position: absolute;
  top: -22px; left: 50%;
  transform: translateX(-50%);
  font-size: .9rem;
}

/* Guess pins on reveal bar */
.guess-pin {
  position: absolute;
  top: 50%; transform: translate(-50%, -50%);
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
  z-index: 4;
  animation: pin-pop .35s cubic-bezier(.175, .885, .32, 1.275) forwards;
}
@keyframes pin-pop {
  0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
  70% { transform: translate(-50%, -50%) scale(1.3); }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

/* Reveal markers list */
.reveal-markers {
  display: flex; flex-direction: column; gap: .35rem; margin-top: .7rem;
}
.score-badge {
  display: flex; align-items: center; gap: .4rem;
  background: var(--surface2); border-radius: 10px;
  padding: .35rem .6rem; font-size: .85rem;
  animation: none;
}
.score-badge.pop-in {
  animation: badge-pop .4s cubic-bezier(.175, .885, .32, 1.275) forwards;
}
@keyframes badge-pop {
  0% { transform: scale(.7) translateY(8px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}
.badge-name {
  font-weight: 900; flex: 1; min-width: 0; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; text-align: left;
}
.badge-pts { font-weight: 700; color: var(--text); white-space: nowrap; }
.badge-diff {
  font-size: .7rem; color: var(--text-muted); white-space: nowrap;
}

/* Result summary */
.result-summary {
  margin-top: .7rem; padding: .5rem .7rem;
  background: linear-gradient(135deg, rgba(165,201,232,.07), rgba(165,201,232,.12));
  border: 1.5px solid rgba(165, 201, 232, .2);
  border-radius: 12px; font-size: .85rem;
  opacity: 0; transition: opacity .4s ease;
}
.result-spectrum-label {
  font-weight: 700; color: var(--text);
}
.target-value-badge {
  display: inline-block; background: var(--game-accent);
  color: #5A3A3A; padding: .1rem .5rem; border-radius: 999px;
  font-size: .8rem; font-weight: 900; margin: 0 .2rem;
}
.clue-giver-bonus {
  margin-top: .3rem; font-size: .8rem;
  color: var(--game-accent); font-weight: 700;
}

.next-btn {
  margin-top: .8rem; width: 100%; padding: .65rem; font-size: 1rem;
  border-radius: 999px;
  background: var(--color-coral);
  box-shadow: 0 4px 14px rgba(165, 201, 232, .3);
}
.next-btn:hover { box-shadow: 0 6px 20px rgba(165, 201, 232, .45); }

/* --- Scoreboard --- */
.score-section {
  background: var(--surface); border-radius: var(--radius);
  padding: .5rem .8rem; box-shadow: var(--shadow);
}
.score-section h4 {
  font-size: .7rem; color: var(--text-muted); margin-bottom: .3rem;
  text-transform: uppercase; letter-spacing: .05em; font-weight: 700;
}
.score-list { display: flex; flex-wrap: wrap; gap: .3rem .8rem; }
.score-item { font-size: .8rem; display: flex; gap: .3rem; align-items: center; }
.score-item .name { font-weight: 700; }
.score-item .pts { color: var(--game-accent); font-weight: 700; }

/* --- Log --- */
.log-section {
  background: var(--surface); border-radius: var(--radius);
  padding: .5rem .8rem; box-shadow: var(--shadow);
}
.log-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: .3rem;
}
.log-header h4 {
  font-size: .7rem; color: var(--text-muted); text-transform: uppercase;
  letter-spacing: .05em; font-weight: 700;
}
.clear-log-btn {
  background: var(--surface2); border: 2px solid var(--surface2);
  color: var(--text-muted); border-radius: 8px; padding: .15rem .5rem;
  font-size: .65rem; cursor: pointer; font-family: inherit; font-weight: 600;
  transition: border-color .2s, color .2s;
}
.clear-log-btn:hover { border-color: var(--primary); color: var(--primary); }
.log-entry {
  display: flex; justify-content: space-between; align-items: center;
  gap: .5rem; padding: .25rem 0;
  border-bottom: 1px solid var(--surface2); font-size: .75rem;
}
.log-entry:last-child { border-bottom: none; }
.log-muted { color: var(--text-muted); font-size: .65rem; display: block; }

/* --- Help Modal --- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(90, 58, 58, .3); backdrop-filter: blur(4px);
  z-index: 100; align-items: center; justify-content: center; padding: 1rem;
  display: flex;
}
.modal-box {
  background: var(--surface); border-radius: var(--radius); padding: 1.5rem;
  max-width: 400px; width: 100%; max-height: 80vh; overflow-y: auto;
  position: relative; box-shadow: var(--shadow-lg);
}
.modal-box h3 { margin-bottom: .8rem; font-weight: 900; }
.modal-box ul {
  margin: 0 0 0 1.2rem; line-height: 1.8;
  font-size: .85rem; color: var(--text-muted);
}
.modal-close {
  position: absolute; top: .5rem; right: .8rem;
  background: none; border: none;
  color: var(--text-muted); font-size: 1.4rem; cursor: pointer;
  transition: color .2s;
}
.modal-close:hover { color: var(--primary); }

/* --- Mobile --- */
@media (max-width: 480px) {
  .game-page { padding: .4rem .5rem; }
  .hint-display { font-size: 1.7rem; }
  .reveal-hint { font-size: 1.8rem; }
  .label-left, .label-right { font-size: .78rem; }
  .spectrum-bar { height: 30px; }
  .slider-wrap input[type="range"]::-webkit-slider-runnable-track { height: 30px; }
  .guess-slider-thumb { width: 24px; height: 24px; }
  .slider-wrap input[type="range"]::-webkit-slider-thumb { width: 24px; height: 24px; margin-top: 3px; }
}
