/* ===== Number Expression (数字deコトバ) - Styles ===== */
:root {
  --game-accent: #A5C9E8;
}

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(--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 {
  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;
}
.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 { 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; flex-wrap: wrap; }
.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(--game-accent); }
.option-pill.selected { background: var(--color-coral); color: #5A3A3A; border-color: transparent; }

.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(165, 201, 232, .4);
  border: none; font-family: inherit; font-weight: 700; cursor: pointer;
}
.start-btn:hover { box-shadow: 0 6px 20px rgba(165, 201, 232, .5); }
.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; }

/* --- Theme Display --- */
.theme-display {
  font-size: 1.4rem; font-weight: 900; color: var(--game-accent);
  margin: .3rem 0 .5rem;
}
.theme-hint {
  font-size: .75rem; color: var(--text-muted); margin-bottom: .5rem;
}

/* --- Confirm (number distribution) --- */
.confirm-progress { display: flex; justify-content: center; gap: .3rem; margin-bottom: .6rem; }
.confirm-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--surface2); transition: background .2s; }
.confirm-dot.done { background: var(--game-accent); }
.confirm-dot.current { background: var(--game-accent); }
.confirm-instruction { font-size: .85rem; color: var(--text-muted); margin-bottom: .3rem; }
.confirm-player-name { font-size: 1.1rem; font-weight: 900; margin-bottom: .6rem; }

.number-card {
  background: var(--surface2); border-radius: var(--radius);
  padding: 1.5rem 1rem; margin: .5rem 0; min-height: 120px;
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: .4rem; cursor: pointer;
  transition: background .3s, color .3s;
}
.number-card.revealed {
  background: linear-gradient(135deg, #065f46, #047857);
  color: #fff; cursor: default;
}
.number-card .tap-icon { font-size: 2.5rem; }
.number-card .tap-text { font-size: .9rem; color: var(--text-muted); }
.number-card .my-number { font-size: 3rem; font-weight: 900; }
.number-card .number-hint { font-size: .8rem; opacity: .8; }
.confirm-next-btn { margin-top: .6rem; padding: .5rem 2rem; font-size: .95rem; border-radius: 999px; }

/* --- Hint Phase --- */
.hint-list { text-align: left; margin-top: .5rem; }
.hint-item {
  display: flex; gap: .4rem; align-items: center; padding: .4rem 0;
  border-bottom: 1px solid var(--surface2);
}
.hint-item:last-child { border-bottom: none; }
.hint-item .hint-name { font-weight: 700; font-size: .85rem; min-width: 50px; flex-shrink: 0; }
.hint-item .hint-input {
  flex: 1; min-width: 0; padding: .3rem .5rem; font-size: .8rem; border-radius: 8px;
}
.hint-item .hint-done {
  font-size: .8rem; color: #4a8ab8; flex-shrink: 0; cursor: pointer;
  background: none; border: 1px solid var(--game-accent); border-radius: 8px;
  padding: .2rem .5rem; font-family: inherit; font-weight: 600;
}
.hint-item .hint-text { font-size: .85rem; color: var(--text); flex: 1; }
.hint-item .hint-status { font-size: .8rem; flex-shrink: 0; }
.all-hints-btn { margin-top: .6rem; padding: .5rem 2rem; font-size: .95rem; border-radius: 999px; }

/* --- Order Phase (drag sort) --- */
.order-labels {
  display: flex; justify-content: space-between; font-size: .7rem;
  color: var(--text-muted); font-weight: 700; margin-bottom: .3rem;
  padding: 0 .3rem;
}
.sort-list {
  display: flex; flex-direction: column; gap: .3rem;
  touch-action: none; user-select: none;
}
.sort-item {
  display: flex; align-items: center; gap: .5rem;
  background: var(--surface2); border-radius: 12px; padding: .5rem .7rem;
  cursor: grab; transition: box-shadow .15s, transform .15s;
}
.sort-item:active { cursor: grabbing; }
.sort-item.dragging {
  box-shadow: 0 8px 24px rgba(165, 201, 232, .4);
  transform: scale(1.03);
  z-index: 10;
  opacity: .9;
}
.sort-item .drag-handle { font-size: 1rem; color: var(--text-muted); flex-shrink: 0; }
.sort-item .sort-name { font-weight: 700; font-size: .85rem; flex-shrink: 0; }
.sort-item .sort-hint { font-size: .8rem; color: var(--text-muted); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.timer-inline {
  font-size: .85rem; color: var(--text-muted); margin-bottom: .4rem; font-weight: 600;
}
.submit-order-btn { margin-top: .6rem; padding: .6rem 2rem; font-size: 1rem; border-radius: 999px; }

/* --- Result Phase --- */
.result-section { text-align: center; }
.result-icon { font-size: 3rem; margin-bottom: .3rem; }
.result-title { font-size: 1.2rem; font-weight: 900; margin-bottom: .5rem; }

.result-bar {
  position: relative; background: var(--surface2); border-radius: 12px;
  height: 60px; margin: .5rem 0; overflow: visible;
}
.result-dot {
  position: absolute; top: 50%; transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; gap: .1rem;
}
.result-dot .dot-circle {
  width: 12px; height: 12px; border-radius: 50%; background: var(--game-accent);
}
.result-dot .dot-number { font-size: .6rem; font-weight: 900; color: var(--text); }
.result-dot .dot-name { font-size: .55rem; color: var(--text-muted); white-space: nowrap; }

.pair-results { margin-top: .5rem; font-size: .8rem; text-align: left; }
.pair-row { display: flex; justify-content: space-between; padding: .15rem 0; }
.pair-correct { color: var(--accent-green); }
.pair-wrong { color: var(--primary); }

.result-score { font-size: 1rem; font-weight: 900; color: #4a8ab8; margin: .5rem 0; }
.next-btn { margin-top: .4rem; 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: #4a8ab8; 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; 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; }
.log-entry { display: flex; justify-content: space-between; align-items: center; padding: .25rem 0; border-bottom: 1px solid var(--surface2); font-size: .75rem; }
.log-entry:last-child { border-bottom: none; }

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

@media (max-width: 480px) {
  .game-page { padding: .4rem .5rem; }
  .theme-display { font-size: 1.2rem; }
  .number-card .my-number { font-size: 2.5rem; }
}
