/* PL Wordle — game-specific styles */

:root {
  --color-correct:  #10b981;
  --color-partial:  #f59e0b;
  --color-wrong:    #64748b;
  --color-empty:    #e2e8f0;
  --color-border:   #cbd5e1;
}

/* ── Layout ── */

.game-wrapper {
  max-width: 600px;
  margin: 0 auto;
  padding: 16px;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* ── Spacing overrides — global styles have large margins not suited to a game UI ── */

.main-nav {
  margin-bottom: 10px;
}

.header {
  margin-bottom: 4px;
}

.header .subtitle {
  margin-bottom: 4px;
}

.game-wrapper {
  padding-top: 8px;
}

.game-header {
  text-align: center;
  margin-bottom: 6px;
}

.game-header h1 {
  font-size: 1.8rem;
  color: var(--text-primary, #0f172a);
  margin: 0 0 4px;
}

.game-header .subtitle {
  color: var(--text-secondary, #475569);
  font-size: 0.9rem;
}

.guesses-left {
  margin-top: 6px;
  font-size: 0.85rem;
  color: var(--text-muted, #94a3b8);
}

/* ── Hint line ── */

.game-hint {
  margin: 0 0 4px;
  font-size: 0.78rem;
  color: var(--text-muted, #94a3b8);
  text-align: center;
  letter-spacing: 0.02em;
}

.game-hint span {
  font-weight: 600;
  color: var(--text-secondary, #475569);
}

/* ── Attribute header row ── */

.attr-header {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  margin-bottom: 4px;
}

.attr-header span {
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted, #94a3b8);
}

/* ── Guess board ── */

.guess-board {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

/* ── Guess group (label + row) ── */

.guess-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.guess-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary, #475569);
  padding-left: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Guess row ── */

.guess-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  min-height: 54px;
}

.guess-group.empty .guess-cell {
  background: transparent;
  border: 1px solid var(--color-border);
}

/* ── Guess cell ── */

.guess-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border-radius: 6px;
  padding: 6px 3px;
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
  color: #fff;
  line-height: 1;
  transition: background 0.2s;
}


.guess-cell.correct  { background: var(--color-correct); }
.guess-cell.partial  { background: var(--color-partial);  }
.guess-cell.wrong    { background: var(--color-wrong);    }

.guess-cell .cell-value {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.guess-cell .cell-direction {
  font-size: 0.7rem;
  font-weight: 400;
  line-height: 1;
  opacity: 0.9;
}

/* ── Input area ── */

.input-area {
  position: relative;
  margin-bottom: 12px;
}

.player-search {
  width: 100%;
  padding: 12px 16px;
  font-size: 1rem;
  border: 2px solid var(--color-border);
  border-radius: 8px;
  outline: none;
  box-sizing: border-box;
  font-family: inherit;
  transition: border-color 0.15s;
}

.player-search:focus {
  border-color: var(--accent-primary, #0891b2);
}

.player-search:disabled {
  background: var(--bg-surface, #f1f5f9);
  cursor: not-allowed;
}

/* ── Autocomplete dropdown ── */

.autocomplete-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  list-style: none;
  margin: 0;
  padding: 4px 0;
  z-index: 100;
  max-height: 280px;
  overflow-y: auto;
}

.autocomplete-list.hidden { display: none; }

.autocomplete-item {
  padding: 10px 16px;
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.autocomplete-item:hover,
.autocomplete-item.focused {
  background: var(--bg-surface, #f1f5f9);
}

.autocomplete-item .player-club {
  font-size: 0.78rem;
  color: var(--text-muted, #94a3b8);
}

/* ── Submit button ── */

.btn-submit {
  width: 100%;
  padding: 12px;
  background: var(--accent-primary, #0891b2);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}

.btn-submit:hover:not(:disabled) {
  background: var(--accent-primary-dark, #0e7490);
}

.btn-submit:disabled {
  background: var(--color-border);
  cursor: not-allowed;
}

/* ── Results panel ── */

.results-panel {
  background: var(--bg-card, #fff);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  margin-top: 16px;
}

.results-panel.hidden { display: none; }

.results-panel h2 {
  margin: 0 0 8px;
  font-size: 1.4rem;
}

.results-panel .answer-reveal {
  font-size: 1rem;
  color: var(--text-secondary, #475569);
  margin-bottom: 16px;
}

.results-panel .answer-name {
  font-weight: 700;
  color: var(--text-primary, #0f172a);
}

.share-text-box {
  background: var(--bg-surface, #f1f5f9);
  border-radius: 8px;
  padding: 12px;
  font-family: monospace;
  font-size: 0.85rem;
  white-space: pre;
  text-align: left;
  margin-bottom: 12px;
  overflow-x: auto;
}

.btn-share {
  padding: 10px 24px;
  background: var(--accent-secondary, #f97316);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}

.btn-share:hover {
  background: var(--accent-secondary-dark, #ea580c);
}

/* ── Message toast ── */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(60px);
  background: #0f172a;
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.9rem;
  opacity: 0;
  transition: transform 0.2s, opacity 0.2s;
  pointer-events: none;
  z-index: 999;
}

.toast.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ── How to play ── */

.how-to-play {
  background: var(--bg-surface, #f1f5f9);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 16px;
  font-size: 0.82rem;
  color: var(--text-secondary, #475569);
}

.how-to-play summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text-primary, #0f172a);
  list-style: none;
  user-select: none;
}

.how-to-play summary::before {
  content: '▶ ';
}

.how-to-play[open] summary::before {
  content: '▼ ';
}

.how-to-play ul {
  margin: 8px 0 0;
  padding-left: 16px;
  line-height: 1.7;
}

.legend {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
}

.legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  flex-shrink: 0;
}

.legend-swatch.correct { background: var(--color-correct); }
.legend-swatch.partial  { background: var(--color-partial);  }
.legend-swatch.wrong    { background: var(--color-wrong);    }

/* ── Mobile ── */

@media (max-width: 480px) {
  .game-header h1 { font-size: 1.4rem; }
  .guess-cell { font-size: 0.88rem; }
  .guess-label { font-size: 0.75rem; }
  .attr-header span { font-size: 0.7rem; }
}
