/* ===== Minority (マイノリティ) ===== */
:root {
  --game-accent: #C5B8E0;
  --game-accent-blue: #A5C9E8;
  --game-accent-pink: #FBD4DC;
}

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); text-decoration: none; }
.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: #5A3A3A; }

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

.option-pills { display: flex; gap: .3rem; flex-wrap: wrap; }
.option-pill {
  padding: .3rem .75rem; font-size: .8rem; 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.selected {
  border-color: var(--game-accent); background: var(--game-accent); color: #5A3A3A;
}
.option-pill:hover:not(.selected) { border-color: var(--game-accent); color: #5A3A3A; }

.start-btn {
  width: 100%; padding: .75rem; font-size: 1.1rem; border-radius: 999px;
  background: var(--color-coral);
  color: #5A3A3A; box-shadow: 0 4px 14px rgba(197, 184, 224, .5);
  border: none; font-family: inherit; font-weight: 700; cursor: pointer;
  transition: transform .1s, box-shadow .1s;
}
.start-btn:active { transform: scale(.97); box-shadow: 0 2px 8px rgba(197, 184, 224, .3); }

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

.round-badge {
  display: inline-block; padding: .2rem .75rem; border-radius: 999px;
  background: linear-gradient(135deg, var(--game-accent), #d8cfee);
  color: #5A3A3A; font-size: .75rem; font-weight: 700; margin-bottom: .8rem;
}

/* --- Question Phase --- */
.question-card {
  background: linear-gradient(135deg, rgba(197,184,224,.08), rgba(216,207,238,.06));
  border: 2px solid rgba(197,184,224,.2);
  border-radius: 16px; padding: 1.2rem 1rem; margin-bottom: 1rem;
}
.question-text {
  font-size: 1.25rem; font-weight: 900; color: var(--text);
  line-height: 1.5;
}

.choice-row {
  display: flex; gap: .6rem; margin-bottom: .8rem;
}
.choice-btn {
  flex: 1; padding: .8rem .4rem; border-radius: 16px; border: none;
  font-family: inherit; font-weight: 700; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: .3rem;
  transition: transform .1s;
  pointer-events: none; /* display only on question phase */
}
.choice-btn:active { transform: scale(.97); }
.choice-a { background: linear-gradient(135deg, var(--game-accent-blue), #c2dff2); color: #5A3A3A; }
.choice-b { background: linear-gradient(135deg, var(--game-accent-pink), #fce4ea); color: #5A3A3A; }
.choice-label {
  font-size: 1.5rem; font-weight: 900; opacity: .9;
}
.choice-text { font-size: .9rem; font-weight: 700; line-height: 1.3; }

.vote-hint {
  font-size: .8rem; color: var(--text-muted); margin-bottom: .6rem;
}
.start-vote-btn {
  padding: .6rem 2rem; font-size: 1rem; border-radius: 999px;
  background: linear-gradient(135deg, var(--game-accent), #d8cfee);
}

/* --- Voting Phase --- */
.voting-question {
  font-size: 1rem; font-weight: 900; color: var(--text);
  margin-bottom: .6rem;
}
.voting-progress {
  font-size: .75rem; color: var(--text-muted); margin-bottom: .3rem;
}
.voting-player-name {
  font-size: 1.1rem; font-weight: 900; color: #5A3A3A;
  margin-bottom: .8rem;
}
.voting-choice-row {
  display: flex; gap: .6rem;
}
.voting-choice-btn {
  flex: 1; padding: 1rem .5rem; border-radius: 16px; border: none;
  font-family: inherit; font-weight: 700; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: .4rem;
  transition: transform .1s, box-shadow .15s, opacity .15s;
  box-shadow: 0 3px 12px rgba(0,0,0,.1);
}
.voting-choice-btn:active { transform: scale(.95); }
.voting-choice-btn:disabled { opacity: .4; cursor: not-allowed; }
.voting-choice-btn.selected { box-shadow: 0 0 0 3px rgba(255,255,255,.8), 0 4px 16px rgba(0,0,0,.2); transform: scale(1.03); }
.voting-choice-a { background: linear-gradient(135deg, var(--game-accent-blue), #c2dff2); color: #5A3A3A; }
.voting-choice-b { background: linear-gradient(135deg, var(--game-accent-pink), #fce4ea); color: #5A3A3A; }
.voting-choice-label { font-size: 1.8rem; font-weight: 900; }
.voting-choice-text { font-size: .85rem; font-weight: 700; line-height: 1.3; }

/* --- Result Phase --- */
.result-section { text-align: left; }

.result-question {
  font-size: 1rem; font-weight: 900; color: var(--text);
  text-align: center; margin-bottom: 1rem;
}

.result-bar-wrap {
  background: var(--surface2); border-radius: 12px;
  padding: .8rem; margin-bottom: .8rem;
}

.result-bar-row {
  display: flex; align-items: center; gap: .5rem;
}
.result-bar-label {
  width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 900; color: #5A3A3A; flex-shrink: 0;
}
.label-a { background: var(--game-accent-blue); }
.label-b { background: var(--game-accent-pink); }

.result-bar-track {
  flex: 1; height: 20px; background: rgba(0,0,0,.08);
  border-radius: 10px; overflow: hidden;
}
.result-bar-fill {
  height: 100%; width: 0%; border-radius: 10px;
  transition: width .6s cubic-bezier(.4,0,.2,1);
}
.fill-a { background: linear-gradient(90deg, var(--game-accent-blue), #c2dff2); }
.fill-b { background: linear-gradient(90deg, var(--game-accent-pink), #fce4ea); }

.minority-bar {
  box-shadow: 0 0 0 2px #fff, 0 0 10px 2px rgba(197,184,224,.6);
  animation: minorityPulse 1.2s ease-in-out infinite;
}
@keyframes minorityPulse {
  0%, 100% { box-shadow: 0 0 0 2px #fff, 0 0 10px 2px rgba(197,184,224,.4); }
  50% { box-shadow: 0 0 0 3px #fff, 0 0 18px 4px rgba(197,184,224,.8); }
}

.result-bar-count {
  font-size: .85rem; font-weight: 900; color: var(--text);
  min-width: 18px; text-align: right; flex-shrink: 0;
}
.result-bar-choice-text {
  font-size: .7rem; color: var(--text-muted); margin-top: .2rem;
  padding-left: 30px;
}

.result-announce {
  text-align: center; font-size: 1.1rem; font-weight: 900;
  padding: .6rem 1rem; border-radius: 12px; margin-bottom: .6rem;
}
.result-announce.tie {
  background: rgba(107,114,128,.12); color: var(--text-muted);
}
.result-announce.minority {
  background: linear-gradient(135deg, rgba(197,184,224,.15), rgba(216,207,238,.1));
  color: #5A3A3A; border: 2px solid rgba(197,184,224,.3);
}
.result-announce strong { color: #5A3A3A; }

.result-scorers {
  display: flex; flex-wrap: wrap; gap: .4rem; justify-content: center;
  margin-bottom: .6rem; min-height: 1.5rem;
}
.scorer-badge {
  padding: .25rem .7rem; background: linear-gradient(135deg, var(--game-accent), #d8cfee);
  color: #5A3A3A; border-radius: 999px; font-size: .8rem; font-weight: 700;
  animation: popIn .3s cubic-bezier(.34,1.56,.64,1);
}
@keyframes popIn {
  from { transform: scale(0); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.result-vote-detail {
  background: var(--surface2); border-radius: 10px; padding: .6rem;
  margin-bottom: .8rem;
}
.vote-detail-row {
  display: flex; align-items: center; gap: .4rem; padding: .25rem 0;
  border-bottom: 1px solid rgba(0,0,0,.05); font-size: .8rem;
}
.vote-detail-row:last-child { border-bottom: none; }
.vote-detail-row.voted-minority {
  background: rgba(197,184,224,.08); border-radius: 8px;
  padding: .25rem .4rem; margin: .1rem 0;
}
.vote-detail-name { font-weight: 700; min-width: 60px; color: var(--text); }
.vote-detail-choice { flex: 1; color: var(--text-muted); }
.vote-detail-choice.choice-a { color: #4a7fa8; font-weight: 700; }
.vote-detail-choice.choice-b { color: #a86080; font-weight: 700; }
.vote-detail-pt {
  font-weight: 900; color: #5A3A3A; font-size: .8rem;
  background: rgba(197,184,224,.2); padding: .1rem .4rem;
  border-radius: 6px;
}

.next-btn {
  width: 100%; padding: .65rem; font-size: .95rem; border-radius: 999px;
  background: var(--color-coral); border: none;
  color: #5A3A3A; font-family: inherit; font-weight: 700; cursor: pointer;
  transition: transform .1s;
}
.next-btn:active { transform: scale(.97); }

/* --- Final Phase --- */
.final-section { text-align: center; }
.final-icon { font-size: 3.5rem; margin-bottom: .5rem; }
.final-title {
  font-size: 1.4rem; font-weight: 900; color: var(--text);
  margin-bottom: .3rem; line-height: 1.3;
}
.final-subtitle {
  font-size: .9rem; color: var(--text-muted); margin-bottom: 1rem;
}
.final-scores {
  background: var(--surface2); border-radius: 12px;
  padding: .6rem .8rem; margin-bottom: 1rem;
}
.final-score-row {
  display: flex; align-items: center; gap: .5rem;
  padding: .35rem 0; border-bottom: 1px solid rgba(0,0,0,.06);
  font-size: .9rem;
}
.final-score-row:last-child { border-bottom: none; }
.final-score-row.winner {
  background: linear-gradient(135deg, rgba(197,184,224,.1), rgba(216,207,238,.08));
  border-radius: 8px; padding: .35rem .4rem; margin: .05rem 0;
}
.final-rank { min-width: 36px; font-weight: 700; font-size: .85rem; }
.final-player-name { flex: 1; font-weight: 700; text-align: left; }
.final-pts { font-weight: 900; color: #5A3A3A; font-size: 1rem; }
.final-recommendation { margin-bottom: .8rem; }

/* --- 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; 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: #5A3A3A; 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; 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;
}
.log-entry {
  display: flex; justify-content: space-between; padding: .25rem 0;
  border-bottom: 1px solid var(--surface2); font-size: .7rem;
  gap: .4rem;
}
.log-entry:last-child { border-bottom: none; }

/* --- 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;
}
.modal-overlay[style*="flex"] { display: flex !important; }
.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.9; 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;
}

/* --- Mobile tweaks --- */
@media (max-width: 380px) {
  .question-text { font-size: 1.1rem; }
  .choice-text { font-size: .8rem; }
  .voting-choice-text { font-size: .75rem; }
  .voting-choice-label { font-size: 1.5rem; }
}
