/* Colourdle — web1.0 as web4.0 */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --mono: 'IBM Plex Mono', 'Courier New', monospace;
  --fg: #000;
  --fg-dim: #00000088;
  --bg: #fff;
}

:root.dark {
  --fg: #fff;
  --fg-dim: #ffffff66;
  --bg: #111;
}

body {
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--fg);
  min-height: 100dvh;
}

#app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* Screens */
.screen {
  display: none;
  flex-direction: column;
  min-height: 100dvh;
}
.screen.active {
  display: flex;
}

/* Chrome bar — always at top */
.chrome {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  font-size: 13px;
  flex-shrink: 0;
  gap: 12px;
}

.chrome-home {
  background: none;
  border: none;
  color: var(--fg);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
}
.chrome-home::before {
  content: '\2302';
  margin-right: 6px;
}
.chrome-home:hover {
  text-decoration: underline;
}

.title {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.05em;
}

.nav {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

/* Button groups */
.btn-group {
  display: inline-flex;
}
.btn-group .mode-btn {
  border-radius: 0;
}
.btn-group .mode-btn:first-child {
  border-right: none;
}

/* Mode buttons */
.mode-btn {
  background: none;
  border: 1px solid var(--fg-dim);
  color: var(--fg-dim);
  font-family: var(--mono);
  font-size: 12px;
  padding: 4px 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.mode-btn.active {
  background: var(--fg);
  color: var(--bg);
  border-color: var(--fg);
}
.mode-btn:hover:not(.active) {
  border-color: var(--fg);
  color: var(--fg);
}

/* Buttons */
.btn {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 500;
  padding: 10px 24px;
  border: 1px solid var(--fg);
  background: var(--bg);
  color: var(--fg);
  cursor: pointer;
  transition: all 0.15s;
}
.btn:hover {
  background: var(--fg);
  color: var(--bg);
}
.btn.dim {
  border-color: var(--fg-dim);
  color: var(--fg-dim);
}
.btn.dim:hover {
  border-color: var(--fg);
  background: var(--fg);
  color: var(--bg);
}

/* Centre content */
.fill-centre {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  gap: 20px;
}

/* Start screen */
.hero {
  font-size: clamp(2rem, 8vw, 4rem);
  font-weight: 700;
  text-align: center;
  letter-spacing: -0.02em;
}
.sub {
  text-align: center;
  color: var(--fg-dim);
  font-size: 13px;
  line-height: 1.8;
}

/* Source subtitle — burned-in pirated movie style */
.source-subtitle {
  font-size: 28px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: #fff;
  -webkit-text-stroke: 2px #000;
  paint-order: stroke fill;
  text-shadow: 2px 2px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000;
  margin-bottom: 16px;
}

.source-tag {
  font-size: 11px;
  color: var(--fg-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* Game screen input */
.input-row {
  display: flex;
  gap: 8px;
  width: 100%;
  max-width: 400px;
}

#guess-input {
  flex: 1;
  font-family: var(--mono);
  font-size: 18px;
  padding: 12px 16px;
  border: 1px solid var(--fg);
  background: transparent;
  color: var(--fg);
  outline: none;
}
#guess-input::placeholder {
  color: var(--fg-dim);
}
#guess-input:focus {
  border-width: 2px;
  padding: 11px 15px;
}

.input-row .btn {
  font-size: 18px;
  padding: 12px 18px;
}

/* Result screen */
.result-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  gap: 24px;
}

.result-answer {
  text-align: center;
}

.big-name {
  font-size: clamp(1.5rem, 6vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.result-guess-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.inline-swatch {
  width: 32px;
  height: 32px;
  border: 1px solid var(--fg-dim);
  flex-shrink: 0;
}

.guess-name {
  font-size: 13px;
}

.result-guess-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.guess-label {
  font-size: 12px;
  color: var(--fg-dim);
}
.guess-label strong {
  color: var(--fg);
  font-weight: 500;
}

.result-guess-right {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

/* Scores */
.scores {
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-top: 1px solid var(--fg-dim);
  border-bottom: 1px solid var(--fg-dim);
  padding: 12px 0;
}

.score-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
}

.score-line.total {
  font-weight: 700;
  font-size: 15px;
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px solid var(--fg-dim);
}

.score-key {
  display: flex;
  flex-direction: column;
}

.score-hint {
  font-size: 10px;
  color: var(--fg-dim);
  font-weight: 400;
}

.score-val {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Score colours */
.score-great { color: inherit; }
.score-good { opacity: 0.7; }
.score-poor { opacity: 0.4; }

/* Summary */
.summary-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  gap: 20px;
  overflow-y: auto;
}

#summary-rounds {
  width: 100%;
  max-width: 500px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.summary-round {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--fg-dim);
  font-size: 13px;
}

.summary-swatch {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border: 1px solid var(--fg-dim);
}

.summary-name {
  flex: 1;
  min-width: 0;
}

.summary-target-name {
  font-weight: 500;
}

.summary-source {
  font-size: 10px;
  color: var(--fg-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.summary-guess-name {
  font-size: 12px;
  color: var(--fg-dim);
}

.summary-score {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.summary-totals {
  display: flex;
  gap: 32px;
  font-size: 13px;
}

.summary-total-item {
  text-align: center;
}

.summary-total-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--fg-dim);
}

.summary-total-value {
  font-size: 20px;
  font-weight: 700;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

/* Percentile */
.percentile {
  font-size: 14px;
  font-weight: 500;
  color: var(--fg);
  text-align: center;
  padding: 8px 0;
}

.summary-actions {
  display: flex;
  gap: 12px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--fg);
  color: var(--bg);
  padding: 10px 20px;
  font-family: var(--mono);
  font-size: 12px;
  opacity: 0;
  transition: all 0.3s;
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Iterative feedback */
.iter-feedback {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 0;
  border-top: 1px solid var(--fg-dim);
}
.iter-highlight {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding: 4px 0;
}
.iter-highlight-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg-dim);
  width: 32px;
  flex-shrink: 0;
}
.iter-highlight-score {
  margin-left: auto;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.iter-log {
  max-height: 120px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1px;
  border-top: 1px solid var(--fg-dim);
  padding-top: 6px;
}
.iter-log-entry {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  padding: 3px 0;
  color: var(--fg-dim);
}
.iter-log-entry .inline-swatch {
  width: 16px;
  height: 16px;
}
.iter-log-num {
  width: 18px;
  text-align: right;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.iter-log-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.iter-log-score {
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.iter-guess-count {
  font-size: 11px;
  color: var(--fg-dim);
}

/* Start options (type toggle + palette dropdown) */
.start-options {
  display: flex;
  align-items: center;
  gap: 12px;
}
.start-options select {
  font-family: var(--mono);
  font-size: 13px;
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--fg-dim);
  padding: 6px 12px;
  cursor: pointer;
}
.start-options select:focus {
  outline: none;
  border-color: var(--fg);
}

/* Credit */
.credit {
  padding: 12px 20px;
  font-size: 11px;
  color: var(--fg-dim);
  text-align: center;
}
.credit a {
  color: var(--fg-dim);
  text-decoration: none;
  border-bottom: 1px solid var(--fg-dim);
}
.credit a:hover,
.credit-btn:hover {
  color: var(--fg);
  border-color: var(--fg);
}
.credit-btn {
  background: none;
  border: none;
  border-bottom: 1px solid var(--fg-dim);
  color: var(--fg-dim);
  font-family: var(--mono);
  font-size: 11px;
  cursor: pointer;
  padding: 0;
}

/* History */
.history {
  width: 100%;
  max-width: 280px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.history-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--fg-dim);
  margin-bottom: 4px;
}
.history-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border: none;
  border-bottom: 1px solid var(--fg-dim);
  background: none;
  color: var(--fg);
  font-family: var(--mono);
  font-size: 13px;
  cursor: pointer;
  width: 100%;
}
.history-row:hover {
  color: var(--fg);
  background: var(--fg-dim);
}
.history-label {
  font-weight: 500;
}
.history-score {
  font-variant-numeric: tabular-nums;
}

/* Responsive */
@media (max-width: 480px) {
  .chrome { padding: 12px 16px; }
  .input-row { max-width: 100%; }
  .scores { max-width: 100%; }
}
