* { box-sizing: border-box; }
:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --line: #d7dcea;
  --text: #1a2233;
  --muted: #5a657d;
  --primary: #3557d6;
  --primary-dark: #213c9e;
  --success: #1f9363;
  --danger: #c33f49;
  --warning: #d8a11a;
  --start: #d9f2ff;
  --question: #ede7ff;
  --bonus: #e7f9eb;
  --trap: #ffeaea;
  --finish: #fff3cf;
}
html, body { margin: 0; padding: 0; font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 0.75rem 1rem; }
button:hover { background: #f1f4fb; }
button.primary, .btn-like.primary { background: var(--primary); color: white; border-color: var(--primary); }
button.primary:hover { background: var(--primary-dark); }
code { background: #eef2fa; padding: 0.1rem 0.35rem; border-radius: 6px; }
.app-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.5rem; background: white; border-bottom: 1px solid var(--line); }
.app-header h1 { margin: 0; font-size: 1.65rem; }
.subtitle { margin: 0.25rem 0 0; color: var(--muted); }
.header-actions { display: flex; gap: 0.5rem; }
.tab-btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.app-shell { padding: 1rem; }
.view { display: none; }
.view.active { display: grid; }
#gameView.active { grid-template-columns: 320px minmax(0, 1fr); gap: 1rem; }
#editorView.active { grid-template-columns: 300px minmax(0, 1fr); gap: 1rem; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 1rem; box-shadow: 0 8px 20px rgba(31, 41, 55, 0.04); }
.field { display: grid; gap: 0.35rem; margin-bottom: 0.8rem; }
.field span { color: var(--muted); font-size: 0.95rem; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 0.7rem 0.8rem; background: #fff; }
.button-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.65rem; margin-top: 0.75rem; }
.button-grid.stacked { grid-template-columns: 1fr; }
.bank-chip { padding: 0.75rem 0.9rem; border-radius: 14px; border: 1px dashed var(--line); background: #fafcff; }
.dice-box { margin-top: 1rem; padding: 1rem; border-radius: 16px; background: #f8faff; border: 1px solid var(--line); }
.dice-value { font-size: 2.5rem; font-weight: 700; }
.turn-info { margin-top: 0.5rem; color: var(--muted); }
.players-list, .legend, .question-list { list-style: none; padding: 0; margin: 0; }
.players-list li, .legend li { display: flex; align-items: center; gap: 0.55rem; margin-bottom: 0.5rem; }
.player-dot, .legend-box { width: 16px; height: 16px; border-radius: 50%; display: inline-block; border: 1px solid rgba(0,0,0,0.08); }
.legend-box.start { background: var(--start); }
.legend-box.question { background: var(--question); }
.legend-box.bonus { background: var(--bonus); }
.legend-box.trap { background: var(--trap); }
.legend-box.finish { background: var(--finish); }
.board-panel { min-width: 0; }
.board { display: grid; gap: 0.45rem; background: white; border: 1px solid var(--line); border-radius: 18px; padding: 0.8rem; min-height: 70vh; }
.cell { position: relative; border: 1px solid var(--line); border-radius: 14px; min-height: 84px; padding: 0.4rem; background: #fff; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; }
.cell.start { background: var(--start); }
.cell.question { background: var(--question); }
.cell.bonus { background: var(--bonus); }
.cell.trap { background: var(--trap); }
.cell.finish { background: var(--finish); }
.cell.current-turn { outline: 3px solid rgba(53, 87, 214, 0.24); }
.cell-header { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.cell-index { font-weight: 700; font-size: 0.9rem; }
.cell-icon { font-size: 1.1rem; }
.cell-label { color: var(--muted); font-size: 0.78rem; line-height: 1.2; }
.tokens { display: flex; gap: 0.25rem; flex-wrap: wrap; margin-top: 0.25rem; }
.token { width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: white; font-size: 0.8rem; font-weight: 700; border: 2px solid rgba(255,255,255,0.9); box-shadow: 0 2px 8px rgba(0,0,0,0.16); }
.editor-header-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.editor-body { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 1rem; min-height: 70vh; }
.question-list-wrap { border-right: 1px solid var(--line); padding-right: 1rem; }
.question-list-wrap input { width: 100%; margin-bottom: 0.75rem; border: 1px solid var(--line); border-radius: 12px; padding: 0.7rem 0.8rem; }
.question-list li { border: 1px solid var(--line); border-radius: 14px; padding: 0.75rem; margin-bottom: 0.6rem; background: #fff; cursor: pointer; }
.question-list li.active { border-color: var(--primary); background: #f6f8ff; }
.question-title { font-weight: 700; margin-bottom: 0.25rem; }
.question-meta { color: var(--muted); font-size: 0.82rem; }
.question-form { min-width: 0; }
.validation-box { margin-top: 0.8rem; border-radius: 14px; padding: 0.8rem; background: #fafcff; border: 1px dashed var(--line); white-space: pre-line; }
.small-note { color: var(--muted); font-size: 0.9rem; line-height: 1.45; }
.btn-like { display: inline-flex; align-items: center; justify-content: center; text-align: center; border: 1px solid var(--line); border-radius: 12px; padding: 0.75rem 1rem; background: #fff; cursor: pointer; }
.question-dialog { border: none; border-radius: 20px; padding: 0; width: min(680px, 92vw); }
.question-dialog::backdrop { background: rgba(15, 24, 44, 0.45); }
.dialog-card { padding: 1rem; background: white; }
.dialog-header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.dialog-header h3 { margin: 0; }
.icon-button { border: none; background: transparent; font-size: 1.2rem; }
.dialog-text { font-size: 1.1rem; line-height: 1.5; }
.dialog-options { display: grid; gap: 0.7rem; margin: 1rem 0; }
.option-btn { text-align: left; border-radius: 14px; padding: 0.9rem 1rem; }
.option-btn.correct { background: #e8faee; border-color: #66c686; }
.option-btn.wrong { background: #ffe9ea; border-color: #e1777d; }
.dialog-feedback { min-height: 2rem; color: var(--muted); }
.dialog-actions { display: flex; justify-content: flex-end; }
@media (max-width: 1100px) {
  #gameView.active, #editorView.active, .editor-body { grid-template-columns: 1fr; }
  .question-list-wrap { border-right: none; padding-right: 0; border-bottom: 1px solid var(--line); padding-bottom: 1rem; }
}
