/* ===== 伝言あそび - Styles ===== */
:root {
  --game-accent: #B5DDC9;
}

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(--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(181, 221, 201, .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(181, 221, 201, .4); }
.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); text-align: center;
}
.round-counter {
  font-size: .7rem; color: var(--text-muted); font-weight: 600; margin-bottom: .3rem;
  text-transform: uppercase; letter-spacing: .05em;
}
.phase-label {
  font-size: 1rem; font-weight: 900; margin-bottom: .8rem; color: var(--text);
}

/* --- Word Prompt Card --- */
.word-prompt {
  background: var(--surface2); border-radius: var(--radius);
  padding: 1rem; margin: .5rem 0 .8rem; text-align: center;
}
.word-prompt-hint {
  font-size: .7rem; color: var(--text-muted); font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em; margin-bottom: .4rem;
}
.word-prompt-word {
  font-size: 2rem; font-weight: 900; line-height: 1.2;
}
.word-prompt-word.original {
  color: var(--game-accent);
}
.word-prompt-word.prev {
  color: #6366f1;
}

/* --- Input Area --- */
.input-area {
  display: flex; gap: .5rem; align-items: center;
  margin: .5rem 0 .3rem;
}
.input-area input {
  flex: 1; min-width: 0;
  padding: .6rem .9rem; font-size: 1.1rem;
  border-radius: 14px; border: 2px solid var(--surface2);
  background: var(--surface); color: var(--text);
  font-family: inherit; outline: none;
  transition: border-color .2s;
}
.input-area input:focus {
  border-color: var(--game-accent);
}
.submit-btn {
  padding: .6rem 1.2rem; font-size: .95rem; font-weight: 700;
  border-radius: 14px; border: none;
  background: var(--color-coral);
  color: #5A3A3A; cursor: pointer; font-family: inherit;
  box-shadow: 0 3px 10px rgba(181, 221, 201, .3);
  flex-shrink: 0; transition: transform .1s;
}
.submit-btn:active { transform: scale(.96); }

.input-hint {
  font-size: .72rem; color: var(--text-muted); margin-top: .15rem;
}

/* --- Reveal Phase --- */
.reveal-title {
  font-size: 1.2rem; font-weight: 900; margin-bottom: 1rem; color: var(--text);
}

.chain-container {
  display: flex; flex-direction: column; align-items: center;
  gap: 0; padding: .3rem 0;
}

.chain-reveal-wrapper {
  width: 100%; max-width: 320px;
}

.chain-link {
  border-radius: 14px; padding: .65rem 1rem;
  display: flex; flex-direction: column; align-items: center;
  gap: .15rem; margin: 0 auto; width: 100%;
}
.chain-link-original {
  background: linear-gradient(135deg, #2a5c49, #3a7060);
  color: #fff;
}
.chain-link-player {
  background: var(--surface2);
  color: var(--text);
}
.chain-link-label {
  font-size: .65rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; opacity: .7;
}
.chain-link-word {
  font-size: 1.3rem; font-weight: 900;
}

.chain-arrow {
  text-align: center; font-size: 1.1rem;
  color: var(--text-muted); padding: .1rem 0;
  font-weight: 700; line-height: 1;
}

.next-phase-btn {
  margin-top: 1rem; padding: .6rem 2rem; font-size: 1rem; border-radius: 999px;
}

/* --- Vote Phase --- */
.vote-title {
  font-size: 1.2rem; font-weight: 900; margin-bottom: .2rem;
}
.vote-subtitle {
  font-size: .85rem; color: var(--text-muted); margin-bottom: .5rem;
}
.vote-original {
  font-weight: 900; color: var(--game-accent);
}

.chain-mini {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: .2rem; margin-bottom: .8rem;
  font-size: .8rem; color: var(--text-muted);
}
.chain-mini-original {
  font-weight: 900; color: var(--game-accent); font-size: .85rem;
}
.chain-mini-word {
  font-weight: 700; color: var(--text);
}
.chain-mini-arrow {
  color: var(--text-muted);
}

.vote-grid {
  display: flex; flex-direction: column; gap: .5rem; padding: .3rem 0;
}
.vote-pill {
  display: flex; flex-direction: column; align-items: center;
  gap: .15rem; padding: .7rem 1rem;
  border-radius: 14px; border: 2px solid var(--surface2);
  background: var(--surface); cursor: pointer; font-family: inherit;
  transition: border-color .15s, background .15s, transform .1s;
}
.vote-pill:hover { border-color: var(--game-accent); }
.vote-pill.selected {
  background: var(--color-coral);
  border-color: transparent; color: #5A3A3A;
}
.vote-pill-player {
  font-size: .7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; opacity: .8;
}
.vote-pill-word {
  font-size: 1.2rem; font-weight: 900;
}
.vote-pill:active { transform: scale(.97); }

/* --- Result Phase --- */
.result-section { text-align: center; }
.result-icon { font-size: 3rem; margin-bottom: .3rem; }
.result-title { font-size: 1.3rem; font-weight: 900; margin-bottom: .2rem; color: var(--game-accent); }
.result-subtitle { font-size: .9rem; color: var(--text-muted); margin-bottom: .8rem; }

.result-chain {
  display: flex; flex-direction: column; align-items: center;
  gap: 0; margin-bottom: .8rem;
}
.result-chain-arrow {
  font-size: .9rem; color: var(--text-muted); padding: .05rem 0; line-height: 1;
}
.result-chain-link {
  display: flex; flex-direction: column; align-items: center;
  padding: .4rem .9rem; border-radius: 12px;
  background: var(--surface2);
  min-width: 140px; gap: .1rem;
}
.result-chain-link.original {
  background: linear-gradient(135deg, #2a5c49, #3a7060);
  color: #fff;
}
.result-chain-link.winner {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #5A3A3A;
}
.result-chain-label {
  font-size: .6rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; opacity: .75;
}
.result-chain-word {
  font-size: 1.1rem; font-weight: 900;
}

.next-btn {
  margin-top: .6rem; padding: .6rem 2rem; font-size: 1rem; border-radius: 999px;
}

/* --- 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);
  flex: 1; min-height: 0; overflow-y: auto;
}
.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: .72rem; overflow: hidden;
}
.log-entry:last-child { border-bottom: none; }
.log-entry span:first-child {
  flex: 1; min-width: 0; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
  color: var(--text-muted);
}
.log-winner { flex-shrink: 0; font-weight: 700; color: var(--game-accent); }

/* --- Help Modal --- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(90, 58, 58, .3); backdrop-filter: blur(4px);
  z-index: 100; display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.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); }

/* --- btn helpers --- */
.btn {
  display: inline-block; border: none; cursor: pointer;
  font-family: inherit; font-weight: 700; transition: transform .1s;
}
.btn:active { transform: scale(.97); }
.btn-primary {
  background: var(--color-coral);
  color: #5A3A3A; box-shadow: 0 4px 14px rgba(181, 221, 201, .3);
}

@media (max-width: 375px) {
  .game-page { padding: .4rem .5rem; }
  .word-prompt-word { font-size: 1.6rem; }
  .chain-link-word { font-size: 1.1rem; }
  .vote-pill-word { font-size: 1rem; }
}
