/* ===== Katakana-Nashi - Game Styles ===== */
:root {
  --game-accent: #F29CB2;
}

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(--primary); }
.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(--secondary); color: var(--secondary); }

/* --- 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 Phase --- */
.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;
}

.player-bar {
  display: flex;
  gap: .4rem;
  align-items: center;
  flex-wrap: wrap;
}
.player-bar input {
  padding: .35rem .6rem;
  font-size: .85rem;
  border-radius: 10px;
  width: 100px;
  min-width: 0;
}
.player-bar .btn { padding: .35rem .6rem; font-size: .8rem; border-radius: 10px; }
.player-tags {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  margin-top: .4rem;
}
.player-tags .player-tag { font-size: .75rem; padding: .15rem .5rem; }

/* --- Options Row --- */
.options-row {
  display: flex;
  gap: .6rem;
  flex-wrap: wrap;
  margin-top: .6rem;
}
.option-group {
  display: flex;
  flex-direction: column;
  gap: .25rem;
}
.option-group label {
  font-size: .7rem;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.option-pills {
  display: flex;
  gap: .25rem;
}
.option-pill {
  padding: .25rem .6rem;
  font-size: .75rem;
  border-radius: 999px;
  border: 2px solid var(--surface2);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  transition: all .15s;
}
.option-pill:hover { border-color: var(--secondary); }
.option-pill.selected {
  background: var(--color-coral);
  color: #5A3A3A;
  border-color: transparent;
}

/* --- Start Button --- */
.start-btn {
  margin-top: .8rem;
  width: 100%;
  padding: .7rem;
  font-size: 1.1rem;
  border-radius: 999px;
}

/* --- Presenter Phase --- */
.phase-section {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.2rem 1rem;
  box-shadow: var(--shadow);
  text-align: center;
}

.round-counter {
  font-size: .7rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: .3rem;
}

.presenter-display {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: .8rem;
}
.presenter-name {
  color: var(--primary);
  font-size: 1.2rem;
}

/* --- Topic Card --- */
.topic-card {
  background: var(--surface2);
  border-radius: var(--radius);
  padding: 1.5rem 1rem;
  margin: .5rem 0;
  position: relative;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  cursor: pointer;
  transition: background .3s;
}
.topic-card.revealed {
  background: #2d2040;
  color: #fff;
}
.topic-category {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  opacity: .7;
}
.topic-word {
  font-size: 2rem;
  font-weight: 900;
  line-height: 1.2;
}
.topic-hidden {
  font-size: 1rem;
  color: var(--text-muted);
}
.topic-hidden .tap-icon {
  font-size: 2rem;
  display: block;
  margin-bottom: .3rem;
}

/* --- Timer --- */
.timer-area {
  margin: .8rem auto;
  position: relative;
  width: 120px;
  height: 120px;
}
.timer-area svg {
  transform: rotate(-90deg);
  width: 120px;
  height: 120px;
}
.timer-area svg circle {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
}
.timer-bg { stroke: var(--surface2); }
.timer-fg {
  stroke: var(--accent-green);
  transition: stroke-dashoffset 1s linear, stroke .3s;
}
.timer-area.warning .timer-fg {
  stroke: var(--primary);
}
@keyframes timer-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}
.timer-area.warning {
  animation: timer-pulse .5s ease-in-out infinite;
}
.timer-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--text);
}

/* --- Action Buttons --- */
.action-row {
  display: flex;
  gap: .5rem;
  justify-content: center;
  margin-top: .5rem;
}
.action-row .btn {
  flex: 1;
  max-width: 160px;
  padding: .6rem;
  font-size: .95rem;
  border-radius: 14px;
}
.btn-correct {
  background: var(--accent-green);
  color: #5A3A3A;
  box-shadow: 0 4px 12px rgba(52, 211, 153, .3);
}
.btn-correct:hover { box-shadow: 0 6px 18px rgba(52, 211, 153, .4); }
.btn-skip {
  background: var(--surface2);
  color: var(--text-muted);
}

/* --- Buzzer --- */
.buzzer-row {
  margin-top: .4rem;
  text-align: center;
}
.buzzer-btn {
  background: var(--game-accent);
  color: #5A3A3A;
  border: none;
  border-radius: 14px;
  padding: .5rem 1.2rem;
  font-size: .85rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: transform .1s;
  box-shadow: 0 4px 12px rgba(242, 156, 178, .3);
}
.buzzer-btn:active { transform: scale(.93); }
.violation-count {
  font-size: .7rem;
  color: var(--text-muted);
  margin-top: .2rem;
}

/* --- Violation Flash --- */
@keyframes violation-flash {
  0% { background: rgba(242, 156, 178, .3); }
  100% { background: transparent; }
}
.flash-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 900;
}
.flash-overlay.active {
  animation: violation-flash .4s ease-out;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}
.shake {
  animation: shake .3s ease-in-out;
}

/* --- Answerer Select --- */
.answerer-select {
  margin-top: .6rem;
}
.answerer-select h4 {
  font-size: .85rem;
  font-weight: 700;
  margin-bottom: .4rem;
}
.answerer-grid {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  justify-content: center;
}
.answerer-btn {
  padding: .5rem 1rem;
  font-size: .9rem;
  border-radius: 999px;
  border: 2px solid var(--surface2);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  font-weight: 700;
  transition: all .15s;
}
.answerer-btn:hover {
  border-color: var(--accent-green);
  background: rgba(52, 211, 153, .08);
}

/* --- Round Result --- */
.result-section {
  text-align: center;
}
.result-icon {
  font-size: 2.5rem;
  margin-bottom: .3rem;
}
.result-topic {
  font-size: 1.5rem;
  font-weight: 900;
  margin: .3rem 0;
}
.result-details {
  font-size: .85rem;
  color: var(--text-muted);
  line-height: 1.8;
}
.result-details strong {
  color: var(--text);
}
.next-btn {
  margin-top: .8rem;
  padding: .6rem 2rem;
  font-size: 1rem;
  border-radius: 999px;
}

/* --- Scoreboard (compact horizontal) --- */
.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 (compact) --- */
.log-section {
  background: var(--surface);
  border-radius: var(--radius);
  padding: .5rem .8rem;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  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: .3rem;
  padding: .25rem 0;
  border-bottom: 1px solid var(--surface2);
  font-size: .75rem;
}
.log-entry:last-child { border-bottom: none; }
.log-entry .valid { color: var(--accent-green); }
.log-entry .invalid { color: var(--primary); }
.log-entry .skip-tag { color: var(--accent-yellow); }
.log-entry .time-tag { color: var(--text-muted); font-size: .65rem; }

/* --- Help Modal --- */
.modal-overlay {
  display: none;
  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;
}
.modal-overlay.show { 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); }

/* --- Responsive --- */
@media (max-width: 480px) {
  .game-page { padding: .4rem .5rem; }
  .topic-word { font-size: 1.6rem; }
  .timer-area { width: 100px; height: 100px; }
  .timer-area svg { width: 100px; height: 100px; }
  .timer-text { font-size: 1.8rem; }
  .action-row .btn { font-size: .85rem; padding: .5rem; }
}
