:root {
    --bg-color: #f8f7f2;
    --card-bg: #ffffff;
    --text-primary: #1a1a1a;
    --text-secondary: #555555;
    --accent-color: #2c3e50;
    --education-color: #3498db;
    --income-color: #27ae60;
    --health-color: #e74c3c;
    --election-color: #f1c40f;
    --youth-color: #bdc3c7;
    --spiral-color: #7f8c8d;
    --border-radius: 12px;
    --shadow: 0 10px 30px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    margin: 0;
    line-height: 1.6;
}

h1, h2, h3 { font-family: 'Playfair Display', serif; }

header {
    background: var(--card-bg);
    padding: 15px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo { font-family: 'Playfair Display', serif; font-size: 1.5em; font-weight: 700; letter-spacing: 2px; }

nav { display: flex; gap: 10px; }
nav button {
    background: none; border: none; padding: 8px 15px; font-weight: 600; cursor: pointer; border-radius: 6px; transition: 0.2s;
}
nav button:hover { background: #f0f0f0; }

/* Hero Screen */
.hero-screen {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: radial-gradient(circle at center, #fff 0%, #f0ede4 100%);
}

.hero-content h1 { font-size: 5em; margin: 0; color: var(--accent-color); letter-spacing: 5px; }
.subtitle { font-size: 1.2em; text-transform: uppercase; letter-spacing: 3px; color: var(--text-secondary); margin-bottom: 40px; }
.leader-summary-name { font-family: 'Playfair Display', serif; font-size: 1.5rem; font-weight: 700; line-height: 1.1; }
.leader-summary-subtitle { margin-top: 4px; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #6b7280; }
.leader-summary-context { margin-top: 8px; font-size: 0.85rem; color: var(--text-secondary); line-height: 1.45; }
.flavor-intro { margin-top: 40px; font-style: italic; color: #888; }

.hero-actions { display: flex; gap: 20px; justify-content: center; }
.intro-guidance { max-width: 610px; margin: -16px auto 27px; color: #4e5d55; font-size: 1.08rem; }
.intro-secondary-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px 22px; margin-top: 25px; }
.intro-secondary-actions a, .intro-secondary-actions button { border: 0; padding: 5px 0; background: none; color: #345b4a; font: 600 .91rem 'Inter', sans-serif; text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }
.intro-secondary-actions a:hover, .intro-secondary-actions button:hover { color: #9b4a36; }
.intro-loading { margin: 18px auto 0; color: #5f6c61; font-size: .83rem; }
.hero-actions button:disabled, .intro-secondary-actions button:disabled { opacity: .55; cursor: wait; }
.hero-screen { height: auto; min-height: 100svh; padding: 50px 20px; background: linear-gradient(90deg, #f8f1e7f7 0%, #f8f1e7e9 48%, #f8f1e7a8 100%), url('/web/assets/life-path-hero.webp') 65% center / cover; }
.hero-content { max-width: 850px; padding: clamp(28px, 4vw, 55px); border: 1px solid #d6c7b4; border-radius: 20px; background: #fffaf0e8; box-shadow: 0 20px 60px #584c3326; }
.hero-content h1 { font-size: clamp(3.2rem, 6vw, 5rem); letter-spacing: .035em; }
.hero-actions { flex-wrap: wrap; }
.hero-actions .btn-mega, .hero-actions .btn-mega-outline { padding: 16px 25px; font-size: 1rem; }
@media(max-width: 600px) { .hero-screen { padding: 25px 14px; } .hero-content { padding: 29px 18px; } .hero-content h1 { font-size: clamp(2.5rem, 11vw, 4rem); letter-spacing: .01em; } .subtitle { font-size: .84rem; margin-bottom: 31px; } .hero-actions { flex-direction: column; gap: 10px; } .hero-actions .btn-mega, .hero-actions .btn-mega-outline { width: 100%; } }

/* Buttons */
.btn-mega { background: var(--accent-color); color: white; padding: 18px 40px; font-size: 1.1em; border: none; border-radius: 50px; cursor: pointer; font-weight: 600; box-shadow: 0 4px 15px rgba(0,0,0,0.2); transition: 0.3s; }
.btn-mega:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.3); }
.btn-mega-outline { background: none; border: 2px solid var(--accent-color); color: var(--accent-color); padding: 18px 40px; font-size: 1.1em; border-radius: 50px; cursor: pointer; font-weight: 600; transition: 0.3s; }
.btn-mega-outline:hover { background: var(--accent-color); color: white; }

.btn-success-large { background: var(--income-color); color: white; border: none; padding: 15px 30px; border-radius: 8px; font-weight: 600; cursor: pointer; transition: 0.2s; font-size: 1.1em; width: 100%; }
.btn-danger-outline { border: 1px solid var(--health-color); color: var(--health-color); background: none; border-radius: 6px; cursor: pointer; }

/* Setup View */
.centered-container { display: flex; align-items: center; justify-content: center; min-height: 80vh; padding: 40px; }
.setup-card { background: var(--card-bg); padding: 40px; border-radius: var(--border-radius); box-shadow: var(--shadow); width: 100%; max-width: 600px; }

.setup-section { margin-bottom: 30px; }
.setup-section h3 { margin-top: 0; font-size: 1.4em; }

.large-select { width: 100%; padding: 12px; border-radius: 8px; border: 1px solid #ccc; font-size: 1em; }

.advanced-toggle { display: flex; justify-content: space-between; align-items: center; background: #f0f0f0; padding: 10px 15px; border-radius: 8px; cursor: pointer; margin-bottom: 20px; font-weight: 600; font-size: 0.9em; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; background: #f9f9f9; padding: 20px; border-radius: 8px; margin-bottom: 20px; }
.form-group label { display: block; font-size: 0.8em; font-weight: 600; margin-bottom: 5px; color: var(--text-secondary); }
.form-group select, .form-group input { width: 100%; padding: 8px; border-radius: 4px; border: 1px solid #ddd; }

.player-setup-grid { border: 1px solid #eee; border-radius: 8px; overflow: hidden; }
.player-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; border-bottom: 1px solid #eee; }
.player-row:last-child { border-bottom: none; }
.player-row.human { background: #fffdf5; }

/* Game Board */
.game-layout { display: flex; padding: 40px; gap: 40px; align-items: flex-start; }

.board {
    position: relative;
    width: min(1100px, 92vw);
    aspect-ratio: 3 / 2;
    background: #e5e2d9;
    padding: 24px;
    border-radius: 20px;
    box-shadow: inset 0 0 50px rgba(0,0,0,0.1), 0 20px 50px rgba(0,0,0,0.15);
    overflow: hidden;
}

.board.has-bg-image::before,
.board-preview-live.has-bg-image::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: var(--board-bg-url);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: var(--board-bg-opacity, 1);
    pointer-events: none;
    z-index: 0;
    border-radius: inherit;
}

.board.has-bg-image > *,
.board-preview-live.has-bg-image > * {
    position: relative;
    z-index: 1;
}

.board-preview-live {
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
}

.board-preview-live .square {
    width: 42px;
    height: 42px;
    border-width: 2px;
}

.board-preview-live .square .label {
    font-size: 6px;
}

.board-preview-live .board-mini-meta {
    font-size: 6px;
}

.board-preview-live .board-decor-name {
    font-size: 0.55rem;
}

.board-path-overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.board-route-riser-block {
    fill: rgba(210, 205, 190, 0.65);
    stroke: rgba(142, 119, 88, 0.45);
    stroke-width: 0.6;
}

.board-route-riser-internal {
    fill: none;
    stroke: rgba(92, 71, 44, 0.55);
    stroke-width: 3.2;
    stroke-linecap: round;
    stroke-dasharray: 0.1 4.5;
}

.board-route-connector-label {
    font-size: 2.8px;
    font-weight: 800;
    fill: rgba(92, 71, 44, 0.9);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    pointer-events: none;
}

.square {
    width: 58px;
    height: 58px;
    background: rgba(255, 252, 244, 0.96);
    border-radius: 50%;
    position: absolute;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    box-shadow: 0 8px 16px rgba(0,0,0,0.10);
    transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 3px solid rgba(255,255,255,0.92);
    cursor: default;
    transform: translate(-50%, -50%);
    padding: 6px;
}

.square:hover { transform: translate(-50%, calc(-50% - 5px)); z-index: 10; }

.square.active-turn { 
    transform: translate(-50%, -50%) scale(1.1); 
    box-shadow: 0 15px 30px rgba(0,0,0,0.2); 
    z-index: 5; 
    border-color: var(--accent-color) !important;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(44, 62, 80, 0.4); }
    70% { box-shadow: 0 0 0 15px rgba(44, 62, 80, 0); }
    100% { box-shadow: 0 0 0 0 rgba(44, 62, 80, 0); }
}

.square span { position: absolute; top: 4px; left: 50%; transform: translateX(-50%); font-size: 9px; font-weight: 800; opacity: 0.44; }
.square .label { font-size: 7px; font-weight: 800; text-transform: uppercase; color: #5f5a52; margin-top: 7px; padding: 0 4px; text-align: center; line-height: 1.05; }
.board-mini-meta {
    font-size: 6px;
    font-weight: 700;
    text-align: center;
    color: #5b6670;
    line-height: 1.2;
    padding: 0 4px;
}

.board-mini-meta.mechanics {
    color: #8a5a00;
}

/* Deck Colors */
.square[data-type="Knowledge"] { border-color: #8bc3ef; color: var(--education-color); }
.square[data-type="Income"] { border-color: #8dd8b0; color: var(--income-color); }
.square[data-type="Health"] { border-color: #f3a49b; color: var(--health-color); }
.square[data-type="Election"] { background: #fff7cf; border-color: #d4ac0d; color: #000; }
.square[data-type="youth"] { border-color: var(--youth-color); color: #999; }
.square[data-type="death_spiral"] { border-color: var(--spiral-color); background: #fdfdfd; color: var(--spiral-color); }
.square[data-type="adult_start"] { border: 4px double #333; font-weight: 900; }

.player-token {
    width: 24px; height: 24px;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    margin: 2px;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Modals */
.modal-sub {
    font-family: 'Inter', sans-serif;
    font-size: 0.75em;
    letter-spacing: 2px;
    color: #999;
    margin: 20px 0 10px 0;
    text-align: left;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

.avatar-grid { display: flex; gap: 12px; padding: 10px 0; margin-bottom: 20px; overflow-x: auto; }
.avatar-card {
    border: 2px solid #eee; padding: 15px; border-radius: 16px; cursor: pointer; text-align: center; min-width: 110px; background: #fff; transition: 0.2s;
}
.avatar-card.selected { border-color: var(--accent-color); background: #f0f7ff; transform: translateY(-5px); }
.avatar-card img {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 50%;
    display: block;
    margin: 0 auto 8px;
    border: 2px solid #e5e9ef;
    background: #f4f6f8;
}
.av-icon { font-size: 2.5em; margin-bottom: 5px; }
.av-name { font-size: 0.8em; font-weight: 700; color: var(--accent-color); }

.goals-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.goal-label {
    display: flex; align-items: center; gap: 12px; background: #f8f9fa; padding: 12px 15px; border-radius: 10px; cursor: pointer; font-size: 0.9em; font-weight: 600; border: 2px solid transparent; transition: 0.2s;
}
.goal-label:hover { background: #f0f0f0; }
.goal-label input:checked + * { color: var(--income-color); }
.goal-label:has(input:checked) { border-color: var(--income-color); background: #f0fff4; }

.field-help {
    font-size: 0.75em;
    color: #888;
    margin-top: 5px;
    font-style: italic;
}

.summary-card {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 20px;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.05);
}

.story-card {
    background: white;
    padding: 25px;
    border-radius: 15px;
    min-width: 320px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    flex-shrink: 0;
}

.story-log {
    font-size: 0.85em;
    max-height: 300px;
    overflow-y: auto;
    border-top: 1px solid #eee;
    padding-top: 15px;
    margin-top: 15px;
}

.story-log div {
    margin-bottom: 8px;
    padding-left: 10px;
    border-left: 2px solid #ddd;
    color: #666;
}

.btn-link {
    background: none;
    border: none;
    color: var(--text-secondary);
    text-decoration: underline;
    cursor: pointer;
    font-weight: 600;
}

.pill {
    background: #eee;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8em;
    font-weight: 600;
}

.modal-content {
    box-sizing: border-box;
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
    background: white; padding: 40px; border-radius: 20px;
    max-width: 500px; width: 90%;
    box-shadow: 0 30px 60px rgba(0,0,0,0.4);
    position: relative;
}

.modal-content-large {
    max-width: 960px;
    max-height: 88vh;
    overflow-y: auto;
}

#modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(18, 24, 33, 0.52);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 200;
}

.modal-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 24px;
}

/* Timeline/History Archive */
.container-narrow { max-width: 800px; margin: 0 auto; }
.stats-summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin: 30px 0; }
.stat-box { background: white; padding: 20px; border-radius: 12px; text-align: center; box-shadow: var(--shadow); }
.stat-box .value { font-size: 2em; font-weight: 700; font-family: 'Playfair Display', serif; }

.history-list { display: flex; flex-direction: column; gap: 15px; }
.history-item { background: white; padding: 20px; border-radius: 12px; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
.history-item-actions { display: flex; gap: 10px; align-items: center; }
.history-detail-card { background: white; border-radius: 18px; box-shadow: var(--shadow); padding: 24px; margin-top: 24px; }
.history-timeline-grid { display: flex; gap: 18px; overflow-x: auto; padding-top: 10px; }
.history-timeline-card { background: #f8f9fb; border-top: 6px solid var(--accent-color); border-radius: 16px; min-width: 280px; padding: 18px; }

.filter-bar,
.sim-controls,
.library-controls {
    display: flex;
    align-items: end;
    gap: 12px;
    flex-wrap: wrap;
    margin: 20px 0 24px;
}

.filter-bar label,
.sim-controls label,
.library-controls label {
    display: block;
    font-size: 0.8em;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.filter-bar select,
.sim-controls select,
.library-controls select,
.editor-main input,
.editor-main select,
.editor-main textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d9d9d9;
    border-radius: 10px;
    background: white;
    font: inherit;
}

.sim-controls .form-group {
    min-width: 260px;
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.builder-welcome {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.9fr);
    gap: 18px;
    background: linear-gradient(135deg, #fffdf7, #f3eee0);
    border: 1px solid #e6dcc2;
    border-radius: 20px;
    padding: 22px 24px;
    box-shadow: var(--shadow);
    margin-bottom: 22px;
}

.builder-welcome h3 {
    margin: 0 0 10px;
}

.builder-welcome-copy p {
    margin: 0;
    color: var(--text-secondary);
}

.builder-example-header {
    margin-top: 18px;
}

.builder-example-header strong,
.builder-example-header span {
    display: block;
}

.builder-example-header span {
    margin-top: 4px;
    font-size: 0.9em;
    color: var(--text-secondary);
}

.builder-example-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.builder-example-card {
    background: rgba(255,255,255,0.76);
    border: 1px solid #eadfca;
    border-radius: 16px;
    padding: 14px;
}

.builder-example-card h4 {
    margin: 0 0 8px;
    font-size: 1.05em;
}

.builder-example-card small {
    color: var(--text-secondary);
}

.builder-welcome-steps {
    display: grid;
    gap: 10px;
}

.builder-welcome-step {
    background: rgba(255,255,255,0.72);
    border: 1px solid #eadfca;
    border-radius: 14px;
    padding: 12px 14px;
}

.builder-welcome-step strong,
.builder-welcome-step span {
    display: block;
}

.builder-welcome-step span {
    margin-top: 4px;
    font-size: 0.9em;
    color: var(--text-secondary);
}

.society-panel-copy p {
    margin: 8px 0 0;
    color: var(--text-secondary);
    font-size: 0.95em;
}

.society-catalog-card {
    gap: 8px;
}

.society-card-metrics {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 6px;
    color: var(--text-secondary);
}

.society-catalog-summary {
    margin-bottom: 18px;
}

.society-summary-card {
    background: linear-gradient(135deg, #fffdf7, #f3eee0);
    border: 1px solid #e6dcc2;
    border-radius: 16px;
    padding: 16px 18px;
    box-shadow: var(--shadow);
}

.society-summary-subcopy {
    margin-top: 6px;
    color: var(--text-secondary);
}

.society-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-top: 14px;
}

.investment-trend-chart {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 12px;
}

.investment-trend-svg {
    display: block;
    width: 100%;
    height: auto;
}

.tab-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.tab-controls button,
.btn-primary,
.btn-success,
.btn-small {
    border: none;
    border-radius: 10px;
    padding: 10px 16px;
    font-weight: 700;
    cursor: pointer;
}

.tab-controls button {
    background: #e8ecf0;
    color: var(--accent-color);
}

.tab-controls button.active {
    background: var(--accent-color);
    color: white;
}

.board-wizard-nav {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 20px 0;
}

.board-wizard-nav button {
    border: 1px solid #d8dee6;
    border-radius: 999px;
    background: #f4f7fa;
    color: var(--accent-color);
    padding: 10px 14px;
    font-weight: 700;
    cursor: pointer;
}

.board-wizard-nav button.active {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

.board-builder-step {
    display: none;
}

.board-builder-step.active {
    display: block;
}

.branch-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.btn-primary { background: var(--accent-color); color: white; }
.btn-success { background: var(--income-color); color: white; }
.btn-small { background: #eef1f4; color: var(--accent-color); }
.btn-small.active-variant {
    background: var(--accent-color);
    color: white;
}

.editor-layout {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    margin-top: 20px;
}

.editor-sidebar,
.editor-main {
    background: white;
    border-radius: 18px;
    box-shadow: var(--shadow);
    padding: 24px;
}

.editor-sidebar {
    width: 280px;
    flex: 0 0 280px;
}

.editor-main {
    flex: 1;
    min-width: 0;
}

.item-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 520px;
    overflow-y: auto;
    margin-bottom: 16px;
}

.compact-list {
    max-height: 240px;
}

.list-item {
    background: #f6f7f9;
    border: 1px solid #e7eaee;
    border-radius: 12px;
    padding: 12px 14px;
    cursor: pointer;
    transition: 0.2s ease;
}

.list-item.selected-item {
    border-color: var(--accent-color);
    background: #eef3f8;
}

.builder-panel {
    background: #f8f9fb;
    border: 1px solid #eceff3;
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 16px;
}

.builder-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.board-tile-editor-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.9fr);
    gap: 18px;
    align-items: start;
}

.board-tile-editor-layout .form-section {
    margin: 0;
}

.board-tile-editor-panel {
    position: sticky;
    top: 16px;
}

.board-path-designer,
.board-preview-grid {
    position: relative;
    aspect-ratio: 3 / 2;
    max-height: 70vh;
    max-width: 100%;
    width: auto;
    margin: 0 auto;
    border-radius: 18px;
    background: radial-gradient(circle at 20% 20%, #fbfaf7, #ebe6db);
    border: 1px solid #d7d0c0;
    overflow: hidden;
}

.board-path-designer[data-orientation="portrait"],
.board-preview-grid[data-orientation="portrait"] {
    aspect-ratio: 2 / 3;
}

.icon-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 6px;
}
.icon-option {
    cursor: pointer;
}
.icon-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.icon-option .icon-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 10px 14px;
    border: 2px solid #d8dde3;
    border-radius: 10px;
    background: #fff;
    color: #4a5260;
    min-width: 88px;
    transition: border-color 0.15s, background 0.15s, transform 0.1s;
}
.icon-option:hover .icon-card {
    border-color: #99a3ad;
}
.icon-option input[type="radio"]:checked + .icon-card {
    border-color: var(--accent-color, #2c3e50);
    background: #eef4fa;
    box-shadow: 0 1px 4px rgba(44, 62, 80, 0.08);
}
.icon-option input[type="radio"]:focus-visible + .icon-card {
    outline: 2px solid var(--accent-color, #2c3e50);
    outline-offset: 2px;
}
.icon-option .icon-orientation,
.icon-option .icon-corner {
    width: 42px;
    height: 32px;
    color: #4a5260;
}
.icon-option .icon-orientation rect {
    fill: #fff;
    stroke: currentColor;
    stroke-width: 1.6;
}
.icon-option .icon-corner .frame {
    fill: #fff;
    stroke: currentColor;
    stroke-width: 1.6;
}
.icon-option .icon-corner .start-dot {
    fill: #2ecc71;
    stroke: #145a32;
    stroke-width: 0.8;
}
.icon-option .icon-sweep {
    width: 56px;
    height: 38px;
    color: #4a5260;
}
.icon-option .icon-sweep .frame {
    fill: #fff;
    stroke: currentColor;
    stroke-width: 1.4;
}
.icon-option .icon-sweep .sweep-path {
    stroke: var(--accent-color, #2c3e50);
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0.85;
}
.icon-option .icon-sweep .sweep-start {
    fill: #2ecc71;
    stroke: #145a32;
    stroke-width: 0.6;
}
.icon-option .icon-label {
    font-size: 0.78em;
    font-weight: 600;
    text-align: center;
    line-height: 1.2;
}
.icon-option .icon-label small {
    font-weight: 400;
    color: #7a828c;
}
.corner-picker .icon-card {
    padding: 8px;
    min-width: 60px;
}

.phase-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 8px 0 14px;
}
.phase-list-empty {
    color: #7a828c;
    font-size: 0.85em;
    padding: 12px;
    border: 1px dashed #d7d0c0;
    border-radius: 8px;
    text-align: center;
}
.phase-card {
    border: 1px solid #d7d0c0;
    border-radius: 10px;
    background: #fff;
    padding: 12px 14px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.phase-card.phase-childhood {
    background: linear-gradient(to right, #f0f9f3, #fff);
    border-color: #b7d6c2;
}
.phase-card.phase-later-life {
    background: linear-gradient(to right, #f9efef, #fff);
    border-color: #d8b9b3;
}
.phase-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}
.phase-badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 0.7em;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    background: #eef1f4;
    color: #4a5260;
    border-radius: 999px;
    flex-shrink: 0;
}
.phase-card.phase-childhood .phase-badge { background: #c8e6cf; color: #145a32; }
.phase-card.phase-later-life .phase-badge { background: #e9c8c2; color: #7b241c; }
.phase-name-input {
    flex: 1;
    border: 1px solid transparent;
    background: transparent;
    font-weight: 600;
    font-size: 1em;
    padding: 4px 6px;
    border-radius: 6px;
    color: #2c3e50;
}
.phase-name-input:hover, .phase-name-input:focus {
    border-color: #c9cfd6;
    background: #fafbfd;
    outline: none;
}
.phase-range {
    color: #7a828c;
    font-size: 0.85em;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}
.phase-delete-btn {
    background: transparent;
    border: 1px solid #e2c4c2;
    color: #b33b2e;
    font-size: 1.1em;
    font-weight: 700;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    flex-shrink: 0;
}
.phase-delete-btn:hover {
    background: #fde8e6;
    border-color: #d96b5f;
}
.phase-card-fields {
    display: grid;
    grid-template-columns: 1fr 1.2fr 1.4fr;
    gap: 10px;
    align-items: end;
}
.phase-card-fields label {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 0.75em;
    color: #6a7280;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.phase-card-fields input[type="number"],
.phase-card-fields select {
    padding: 6px 8px;
    border: 1px solid #d7d0c0;
    border-radius: 6px;
    font-size: 0.95em;
    font-weight: 400;
    color: #2c3e50;
    background: #fff;
    text-transform: none;
    letter-spacing: 0;
}
.phase-card-fields input[type="range"] {
    width: 100%;
}
.phase-temp-readout {
    font-size: 0.85em;
    color: #4a5260;
    font-weight: 600;
    margin-top: 2px;
}
.phase-end-locked {
    display: inline-block;
    padding: 6px 8px;
    border: 1px dashed #d7d0c0;
    border-radius: 6px;
    color: #7a828c;
    font-size: 0.9em;
    background: #fafbfd;
}

.board-canvas-area {
    margin-bottom: 16px;
}
.board-canvas-actions {
    margin-top: 8px;
    flex-wrap: wrap;
    align-items: center;
}
.board-print-divider {
    width: 1px;
    height: 22px;
    background: #d7d0c0;
    margin: 0 4px;
    display: inline-block;
}
.board-print-guides-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8em;
    color: #4a5260;
    cursor: pointer;
}

.branch-creation-status {
    padding: 10px 14px;
    margin: 10px 0;
    border-radius: 8px;
    border: 1px solid #ecd292;
    background: #fff8e1;
    color: #6c5400;
    font-size: 0.9em;
    font-weight: 600;
}

.branch-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 10px 0 6px;
}
.branch-list-empty {
    padding: 14px;
    border: 1px dashed #d7d0c0;
    border-radius: 8px;
    color: #7a828c;
    font-size: 0.88em;
    text-align: center;
}
.branch-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid #d7d0c0;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.branch-card:hover {
    border-color: #99a3ad;
    background: #fafbfd;
}
.branch-card.selected {
    border-color: var(--accent-color, #2c3e50);
    background: #eef4fa;
    box-shadow: 0 2px 6px rgba(44, 62, 80, 0.08);
}
.branch-card-swatch {
    width: 14px;
    height: 30px;
    border-radius: 4px;
    flex-shrink: 0;
    background: #c8d2dc;
}
.branch-card.theme-education .branch-card-swatch { background: #b8842f; }
.branch-card.theme-income .branch-card-swatch { background: #3a9c5b; }
.branch-card.theme-health .branch-card-swatch { background: #c75147; }
.branch-card.theme-auto .branch-card-swatch { background: #94a0ac; }
.branch-card-body {
    flex: 1;
    min-width: 0;
}
.branch-card-name {
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.98em;
}
.branch-card-meta {
    margin-top: 2px;
    font-size: 0.82em;
    color: #6a7280;
}
.branch-grant-badge {
    display: inline-block;
    padding: 1px 6px;
    background: #eef1f4;
    border-radius: 999px;
    font-size: 0.85em;
    color: #4a5260;
}
.branch-starting-badge {
    display: inline-block;
    padding: 1px 6px;
    background: #fef3c7;
    border-radius: 999px;
    font-size: 0.75em;
    font-weight: 700;
    color: #6b4f00;
    letter-spacing: 0.4px;
}
.branch-card.starting .branch-card-swatch {
    background: linear-gradient(180deg, #f5d99b 0%, #c9a977 100%);
}
.branch-card-delete {
    background: transparent;
    border: 1px solid #e2c4c2;
    color: #b33b2e;
    font-size: 1.1em;
    font-weight: 700;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    flex-shrink: 0;
}
.branch-card-delete:hover {
    background: #fde8e6;
    border-color: #d96b5f;
}

.branch-advanced {
    margin: 12px 0;
    border: 1px solid #e2e6ea;
    border-radius: 8px;
    padding: 0;
    background: #fafbfd;
}
.branch-advanced > summary {
    cursor: pointer;
    padding: 8px 12px;
    font-weight: 600;
    color: #4a5260;
    font-size: 0.9em;
    list-style: none;
}
.branch-advanced > summary::-webkit-details-marker { display: none; }
.branch-advanced > summary::before {
    content: '▸';
    display: inline-block;
    margin-right: 6px;
    transition: transform 0.15s;
}
.branch-advanced[open] > summary::before { transform: rotate(90deg); }
.branch-advanced[open] > summary { border-bottom: 1px solid #e2e6ea; }
.branch-advanced > .form-row { padding: 8px 12px; }

.branch-start-marker {
    fill: rgba(46, 204, 113, 0.25);
    stroke: #1c7a3d;
    stroke-width: 0.6;
    stroke-dasharray: 0.8 0.8;
    pointer-events: none;
}
.branch-endpoint-marker {
    fill: none;
    stroke-width: 0.8;
    pointer-events: none;
}
.branch-endpoint-marker.start { stroke: #1c7a3d; }
.branch-endpoint-marker.end { stroke: #b3271b; }

.board-path-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.board-route.outline,
.board-route.fill,
.board-route.divider {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.board-route.outline {
    stroke: rgba(92, 71, 44, 0.45);
    stroke-width: 5.6;
}

.board-route.fill {
    stroke: rgba(245, 239, 226, 0.94);
    stroke-width: 4.2;
}

.board-route.divider {
    stroke: rgba(142, 119, 88, 0.48);
    stroke-width: 1.1;
    stroke-dasharray: 0.1 5.2;
}

.board-route.live.outline {
    stroke: rgba(86, 68, 45, 0.76);
    stroke-width: 7.2;
}

.board-route.live.fill {
    stroke: rgba(244, 237, 221, 0.98);
    stroke-width: 5.4;
}

.board-route.live.divider {
    stroke: rgba(140, 117, 86, 0.72);
    stroke-width: 1.35;
    stroke-dasharray: 0.1 6.3;
}

.board-route.branch.outline {
    stroke: rgba(132, 111, 84, 0.56);
    stroke-width: 3.5;
}

.board-route.branch.fill {
    stroke: rgba(236, 230, 220, 0.8);
    stroke-width: 2.5;
}

.board-route.branch.divider {
    stroke: rgba(162, 140, 110, 0.56);
    stroke-width: 0.5;
    stroke-dasharray: 0.2 4.5;
}

.board-route.branch.live.outline {
    stroke: rgba(132, 111, 84, 0.7);
    stroke-width: 4.5;
}

.board-route.branch.live.fill {
    stroke: rgba(236, 230, 220, 0.9);
    stroke-width: 3.2;
}

.board-route.branch.live.divider {
    stroke: rgba(162, 140, 110, 0.7);
    stroke-width: 0.7;
    stroke-dasharray: 0.2 5.1;
}

.board-route.connector.outline,
.board-route.connector.fill,
.board-route.connector.divider {
    stroke-dasharray: 3 3;
}

.board-branch-label {
    font-size: 1.9px;
    fill: rgba(92, 71, 44, 0.72);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.board-branch-label.end {
    fill: rgba(92, 71, 44, 0.55);
}

.board-grid-line {
    stroke: rgba(92, 71, 44, 0.12);
    stroke-width: 0.28;
}

.board-grid-line.major {
    stroke: rgba(92, 71, 44, 0.22);
    stroke-width: 0.45;
}

.board-grid-label {
    font-size: 2.5px;
    fill: rgba(92, 71, 44, 0.75);
    font-weight: 700;
}

.board-tile-segment {
    stroke: #3a4250;
    stroke-width: 0.18;
    stroke-linejoin: round;
    cursor: pointer;
    transition: stroke-width 0.15s, fill 0.15s, filter 0.15s;
}
.board-tile-segment.tone-neutral { fill: #faf5e8; }
.board-tile-segment.tone-knowledge { fill: #f0e0c8; }
.board-tile-segment.tone-income { fill: #d8e8cf; }
.board-tile-segment.tone-health { fill: #f5d8d2; }
.board-tile-segment.tone-election { fill: #f5e6a8; stroke: #8a6500; stroke-width: 0.3; }
.board-tile-segment.milestone { stroke: #2c3e50; stroke-width: 0.32; }
.board-tile-segment.starting-first {
    fill: #d6f0d4;
    stroke: #1c7a3d;
    stroke-width: 0.55;
}
.board-tile-segment.merge-terminal {
    opacity: 0.68;
    stroke-width: 0.12;
}
.board-tile-segment:hover { stroke-width: 0.4; filter: brightness(1.04); }
.board-tile-segment.selected {
    stroke: #2c3e50;
    stroke-width: 0.6;
    filter: drop-shadow(0 0 1.2px rgba(44,62,80,0.6));
}
.board-tile-segment-label {
    pointer-events: none;
    user-select: none;
    font-family: 'Inter', sans-serif;
}
.board-tile-segment-label.main {
    font-size: 1.7px;
    font-weight: 700;
    fill: #2c3e50;
}
.board-tile-segment-label.sub {
    font-size: 1.2px;
    font-weight: 600;
    fill: rgba(44, 62, 80, 0.7);
}
.board-tile-segment-label.sub.mod { fill: #1c3b5c; }
.board-tile-segment-label.sub.deck { fill: rgba(44, 62, 80, 0.45); font-size: 1.4px; }
.board-tile-segment-label.sub.election {
    font-size: 2.4px;
    fill: #8a6500;
}
.board-tile-segment-label.sub.milestone {
    font-size: 1.0px;
    font-weight: 800;
    fill: #2c3e50;
    letter-spacing: 0.05px;
}

.board-tile-marker {
    stroke: rgba(0, 0, 0, 0.32);
    stroke-width: 0.3;
    pointer-events: auto;
}
.board-tile-marker.tone-neutral { fill: #c8d2dc; }
.board-tile-marker.tone-income { fill: #3a9c5b; }
.board-tile-marker.tone-knowledge { fill: #b8842f; }
.board-tile-marker.tone-health { fill: #c75147; }
.board-tile-marker.tone-election { fill: #d8b645; stroke: #6b4f00; stroke-width: 0.55; }
.board-tile-marker.milestone {
    stroke: #2c3e50;
    stroke-width: 0.6;
}
.board-tile-marker.election-marker {
    stroke: #6b4f00;
    stroke-width: 0.55;
}

.board-tile-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 10px;
    padding: 8px 12px;
    font-size: 0.78em;
    color: #4a5260;
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid #d7d0c0;
    border-radius: 8px;
}
.board-tile-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.board-tile-legend .dot {
    display: inline-block;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.2);
}
.board-tile-legend .dot.tone-knowledge { background: #b8842f; }
.board-tile-legend .dot.tone-income { background: #3a9c5b; }
.board-tile-legend .dot.tone-health { background: #c75147; }
.board-tile-legend .dot.tone-election { background: #d8b645; border-color: #6b4f00; }
.board-tile-legend .dot.tone-neutral { background: #c8d2dc; }

.board-path-point {
    fill: rgba(255, 255, 255, 0.55);
    stroke: #2c3e50;
    stroke-width: 1.0;
    cursor: grab;
    transition: r 0.2s, stroke-width 0.2s;
}

.board-path-point:hover {
    r: 3.6;
    stroke-width: 1.4;
}

.board-path-point.selected {
    stroke: #f5c76c;
    stroke-width: 1.6;
    fill: rgba(255, 246, 220, 0.7);
}

.board-path-point.start {
    stroke: #1c7a3d;
    stroke-width: 1.4;
}

.board-path-point.end {
    stroke: #b3271b;
    stroke-width: 1.4;
}

.starting-path-anchor {
    fill: rgba(214, 240, 212, 0.92);
    stroke: #1c7a3d;
    stroke-width: 1.1;
    cursor: grab;
    filter: drop-shadow(0 0 0.7px rgba(28, 122, 61, 0.45));
}

.starting-path-anchor:hover,
.starting-path-anchor.selected {
    fill: #e8f8e6;
    stroke-width: 1.6;
}

.board-path-anchor-label {
    font-size: 4px;
    font-weight: 700;
    fill: var(--accent-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.board-path-point-meta {
    font-size: 2.2px;
    fill: rgba(44, 62, 80, 0.78);
    font-weight: 700;
}

.board-stage-guide {
    stroke: rgba(44, 62, 80, 0.22);
    stroke-width: 0.6;
    stroke-dasharray: 1.5 1.5;
}

.board-stage-warning-list {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    pointer-events: none;
}

.board-stage-warning,
.board-stage-ok {
    padding: 7px 9px;
    border-radius: 10px;
    font-size: 0.75rem;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(92, 71, 44, 0.18);
    color: var(--accent-color);
}

.board-stage-warning {
    background: rgba(255, 247, 232, 0.94);
    border-color: rgba(191, 133, 45, 0.4);
}

.board-decor,
.board-preview-decor {
    position: absolute;
    transform: translate(-50%, -50%);
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 0;
}

.board-decor {
    opacity: 0.95;
}

.board-preview-decor.selected {
    box-shadow: 0 0 0 3px rgba(44, 62, 80, 0.14);
}

.board-decor-icon {
    font-size: 0.85rem;
    font-weight: 800;
}

.board-decor-image {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    pointer-events: none;
}

.board-decor-text-only {
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--accent-color);
    white-space: nowrap;
    text-align: center;
    line-height: 1;
}

.board-decor-name {
    position: absolute;
    top: calc(100% + 3px);
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    font-size: 0.65rem;
    color: var(--accent-color);
    font-weight: 700;
}

.board-decor-tree,
.board-preview-decor.board-decor-tree {
    background: #dff2df;
    color: #2d6a36;
}

.board-decor-house,
.board-preview-decor.board-decor-house {
    background: #f5e2d7;
    color: #8d4d28;
}

.board-decor-lake,
.board-preview-decor.board-decor-lake {
    background: #dceef8;
    color: #2f6c9d;
}

.board-decor-mountain,
.board-preview-decor.board-decor-mountain {
    background: #ece8e0;
    color: #5e564a;
}

.board-decor-garden,
.board-preview-decor.board-decor-garden {
    background: #efe3f8;
    color: #6b4385;
}

.board-decor-town,
.board-preview-decor.board-decor-town {
    background: #f4efcc;
    color: #8b6b13;
}

.board-decor-node .board-decor-base {
    fill: #fff7ef;
    stroke: #8c775b;
    stroke-width: 0.7;
}

.board-decor-node .board-decor-base.text-node {
    fill: rgba(255, 255, 255, 0.88);
    stroke: rgba(44, 62, 80, 0.2);
}

.board-decor-node.selected .board-decor-base {
    fill: #f5c76c;
}

.board-decor-glyph {
    font-size: 4.6px;
    font-weight: 800;
    fill: var(--accent-color);
}

.board-decor-label {
    font-size: 3.4px;
    font-weight: 700;
    fill: var(--accent-color);
}

.board-decor-text-node {
    font-size: 3.3px;
}

.board-preview-cell {
    position: absolute;
    width: 34px;
    height: 34px;
    transform: translate(-50%, -50%);
    border: 1px solid #d9e1e8;
    border-radius: 999px;
    background: #f7f9fb;
    padding: 0;
    font: inherit;
    font-size: 0.68em;
    font-weight: 700;
    color: var(--accent-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.board-preview-cell.tone-neutral {
    background: #f7f9fb;
    color: var(--accent-color);
}

.board-preview-cell.tone-income {
    background: #e6f6ec;
    border-color: #7bc692;
    color: #1f7a3d;
}

.board-preview-cell.tone-education {
    background: #efe2cc;
    border-color: #c9a977;
    color: #7a5730;
}

.board-preview-cell.tone-health {
    background: #fde8e6;
    border-color: #e39a92;
    color: #b33b2e;
}

.board-preview-cell.tone-election {
    background: #fff3c9;
    border-color: #d8b645;
    color: #8a6500;
}

.board-preview-cell.selected {
    background: #eaf1f8;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(44, 62, 80, 0.1);
}

.persona-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.persona-toggle-row {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.list-item:hover {
    transform: translateY(-1px);
    background: #eef3f8;
}

.editor-main label,
.editor-main h4,
.editor-main h5 {
    display: block;
    margin: 0 0 8px;
}

.editor-main textarea {
    min-height: 120px;
    resize: vertical;
}

.editor-intro-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.editor-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    align-items: start;
}

.editor-form-grid > .form-section:last-child:nth-child(odd) {
    grid-column: 1 / -1;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 12px;
    align-items: center;
    margin-bottom: 14px;
}

.card-identity-row {
    align-items: end;
}

.checkbox-stack {
    display: flex;
    flex-direction: column;
    justify-content: end;
    gap: 6px;
    min-height: 100%;
}

.checkbox-stack label {
    margin: 0;
}

.form-row-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-row-2x2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.deck-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.deck-badge.smarts {
    background: rgba(52, 152, 219, 0.12);
    color: var(--education-color);
}

.deck-badge.income {
    background: rgba(39, 174, 96, 0.12);
    color: var(--income-color);
}

.deck-badge.health {
    background: rgba(231, 76, 60, 0.12);
    color: var(--health-color);
}

.editor-card-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}

.editor-card-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
    color: var(--text-secondary);
    font-size: 0.82rem;
}

.editor-card-meta small {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.form-section,
.sub-section {
    background: #f8f9fb;
    border: 1px solid #eceff3;
    border-radius: 14px;
    padding: 16px;
    margin: 18px 0;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 20px;
}

.form-actions.compact-actions {
    justify-content: flex-start;
    gap: 8px;
    margin-top: 12px;
}

.builder-panel select,
.builder-panel input[type="text"] {
    width: 100%;
}

.policy-item {
    position: relative;
    background: #f8f9fb;
    border: 1px solid #eceff3;
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 12px;
}

.remove-policy {
    position: absolute;
    top: 10px;
    right: 10px;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    .game-layout { flex-direction: column; align-items: center; }
    .editor-layout { flex-direction: column; }
    .editor-sidebar { width: 100%; flex-basis: auto; }
    .builder-welcome { grid-template-columns: 1fr; }
    .board-tile-editor-layout { grid-template-columns: 1fr; }
    .board-tile-editor-panel { position: static; }
    .editor-intro-grid,
    .editor-form-grid,
    .form-row-3,
    .form-row-2x2 { grid-template-columns: 1fr; }
}

/* Play Mode Selector */
.mode-selector { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.mode-btn { background: #f0f0f0; border: 2px solid transparent; padding: 8px 16px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 0.85em; transition: 0.2s; }
.mode-btn:hover { background: #e0e0e0; }
.mode-btn.active { background: var(--accent-color); color: white; border-color: var(--accent-color); }
.field-help { font-size: 0.8em; color: var(--text-secondary); margin: 6px 0 0 0; font-style: italic; }

/* Companion player setup inputs */
.companion-player-input-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.companion-player-input-row input { flex: 1; padding: 8px 12px; border: 1px solid #ddd; border-radius: 8px; font-size: 0.95em; }
.player-color-dot { width: 16px; height: 16px; border-radius: 50%; flex-shrink: 0; }
.btn-small-outline { background: none; border: 1px solid #ccc; padding: 5px 12px; border-radius: 6px; cursor: pointer; font-size: 0.8em; font-weight: 600; }
.btn-small-outline:hover { border-color: var(--accent-color); color: var(--accent-color); }

/* Companion game layout */
.companion-layout { min-height: 100vh; background: var(--bg-color); display: flex; flex-direction: column; }

.companion-header { display: flex; justify-content: space-between; align-items: center; background: var(--accent-color); color: white; padding: 12px 24px; gap: 16px; flex-wrap: wrap; }
.companion-society-status { display: flex; align-items: center; gap: 20px; font-size: 0.9em; flex-wrap: wrap; }
.companion-gen-label { font-family: 'Playfair Display', serif; font-size: 1.3em; font-weight: 700; }
.companion-president { font-weight: 600; opacity: 0.9; }
.companion-invest { opacity: 0.8; font-size: 0.9em; }
.companion-header-actions { display: flex; gap: 10px; flex-shrink: 0; }
.btn-outline-small { background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.5); color: white; padding: 6px 14px; border-radius: 6px; cursor: pointer; font-weight: 600; font-size: 0.85em; transition: 0.2s; }
.btn-outline-small:hover { background: rgba(255,255,255,0.25); }
.btn-small { padding: 6px 14px; border-radius: 6px; cursor: pointer; font-size: 0.85em; font-weight: 600; }

/* Narrator section */
.narrator-section { background: white; padding: 24px; border-bottom: 1px solid #eee; }
.narrator-active-info { font-size: 1.3em; font-family: 'Playfair Display', serif; margin-bottom: 16px; }
.narrator-age-label { font-size: 0.75em; color: var(--text-secondary); font-family: 'Inter', sans-serif; font-weight: 400; margin-left: 8px; }

/* Big across-the-table turn banner */
.narrator-turn-banner { display: flex; align-items: center; gap: 14px; padding: 16px 20px; border-radius: 16px; background: color-mix(in srgb, var(--turn-color) 12%, white); border: 2px solid var(--turn-color); }
.narrator-turn-dot { width: 28px; height: 28px; border-radius: 50%; background: var(--turn-color); flex-shrink: 0; box-shadow: 0 0 0 4px color-mix(in srgb, var(--turn-color) 25%, transparent); }
.narrator-turn-name { font-family: 'Playfair Display', serif; font-size: 2em; font-weight: 700; color: var(--turn-color); line-height: 1; }
.narrator-turn-sub { font-size: 0.7em; color: var(--text-secondary); margin-left: auto; text-transform: uppercase; letter-spacing: 1px; font-family: 'Inter', sans-serif; text-align: right; }

/* App dice animation */
.narrator-dice-display { display: flex; flex-wrap: wrap; gap: 18px; justify-content: center; align-items: center; margin: 4px 0 18px; }
.narrator-dice-display .die { font-size: 3.4em; line-height: 1; color: #34495e; transition: transform 0.15s, color 0.2s, opacity 0.2s; }
.narrator-dice-display .die.rolling { animation: die-shake 0.18s infinite; }
.narrator-dice-display .die.die-low { color: var(--accent-color); transform: scale(1.2); }
.narrator-dice-display .die.die-high { color: #b9b9b9; opacity: 0.5; }
.narrator-dice-caption { width: 100%; text-align: center; margin: 0; font-size: 0.8em; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--accent-color); }
@keyframes die-shake { 0% { transform: translateY(0) rotate(-9deg); } 50% { transform: translateY(-5px) rotate(9deg); } 100% { transform: translateY(0) rotate(-9deg); } }
.stepper-label { font-size: 0.8em; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: #888; margin: 0 0 10px 0; }
.narrator-roll-btns { display: flex; gap: 10px; margin-bottom: 16px; }
.roll-step-btn { width: 52px; height: 52px; border-radius: 12px; border: 2px solid #ddd; background: white; font-size: 1.4em; font-weight: 700; cursor: pointer; transition: 0.15s; }
.roll-step-btn:hover { border-color: var(--accent-color); color: var(--accent-color); }
.roll-step-btn.selected { background: var(--accent-color); color: white; border-color: var(--accent-color); transform: scale(1.08); }
.narrator-land-row { display: flex; align-items: center; gap: 16px; }
.narrator-land-row .btn-success-large { width: auto; padding: 12px 28px; }

/* Narrator card display */
.narrator-card-display { margin-top: 20px; background: #f8f9fa; border-radius: 16px; padding: 28px; border-left: 6px solid var(--education-color); }
.narrator-card-flavor { font-size: 1.2em; line-height: 1.6; margin: 12px 0 20px 0; color: var(--text-primary); }
.narrator-stat-grid { display: flex; gap: 12px; margin-bottom: 20px; }
.narrator-stat-box { background: white; border: 1px solid #eee; border-radius: 10px; padding: 10px 16px; text-align: center; min-width: 60px; }
.narrator-stat-box small { display: block; font-size: 0.7em; text-transform: uppercase; letter-spacing: 1px; color: #888; }
.narrator-stat-box strong { font-size: 1.3em; }
.narrator-card-actions { display: flex; gap: 12px; }
.narrator-card-actions .btn-success { padding: 12px 32px; font-size: 1em; }
.narrator-card-actions .btn-danger-outline { padding: 12px 24px; font-size: 1em; }

/* Companion player grid */
.companion-player-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; padding: 20px; flex: 1; }
.companion-player-card { background: white; border-radius: 12px; padding: 16px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.companion-player-card.companion-player-dead { opacity: 0.6; }
.companion-player-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.companion-player-score { font-family: 'Playfair Display', serif; font-size: 1.2em; font-weight: 700; color: var(--income-color); }
.companion-stat-row { display: flex; justify-content: space-between; align-items: center; padding: 5px 0; border-bottom: 1px solid #f0f0f0; }
.companion-stat-row:last-of-type { border-bottom: none; }
.companion-stat-label { font-size: 0.75em; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: #999; width: 24px; }
.companion-stat-controls { display: flex; align-items: center; gap: 8px; }
.companion-stat-value { font-weight: 700; font-size: 1em; min-width: 28px; text-align: center; }
.stat-adj-btn { width: 26px; height: 26px; border-radius: 50%; border: 1px solid #ddd; background: #f8f8f8; font-size: 1em; cursor: pointer; display: flex; align-items: center; justify-content: center; font-weight: 700; transition: 0.15s; }
.stat-adj-btn:hover { background: var(--accent-color); color: white; border-color: var(--accent-color); }
.companion-achievements { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 10px; }
.achievement-pill { background: #eef2ff; color: #4455cc; font-size: 0.65em; font-weight: 700; padding: 2px 7px; border-radius: 10px; }
.survivor-badge { background: var(--income-color); color: white; font-size: 0.65em; font-weight: 700; padding: 2px 7px; border-radius: 10px; letter-spacing: 0.5px; }
.dead-badge { background: #eee; color: #888; font-size: 0.65em; font-weight: 600; padding: 2px 7px; border-radius: 10px; }

/* Play-mode selector: grouped by physical vs digital play */
#setup-mode-selector { display: flex; gap: 14px; flex-wrap: wrap; }
.mode-group { flex: 1 1 260px; border: 1px solid #ddd; border-radius: 10px; padding: 10px; background: #fafafa; display: flex; flex-direction: column; gap: 8px; }
.mode-group-title { font-weight: 700; font-size: 0.85em; color: #555; padding: 2px 4px; }
.mode-group .mode-btn { text-align: left; width: 100%; display: block; }
.mode-btn small { display: block; font-weight: 400; font-size: 0.82em; opacity: 0.75; margin-top: 3px; line-height: 1.3; }
.mode-btn.active small { opacity: 0.95; }

/* Physical-board mechanics: trade squares (white) and death-spiral gates */
.square[data-type="trade"] { border-color: #6c7a89; background: #ffffff; color: #34495e; border-style: dashed; }
.board-tile-segment.tone-trade { fill: #ffffff; stroke: #5d6d7e; stroke-dasharray: 0.5 0.3; }
.board-tile-segment.tone-gate { fill: #ece6f3; stroke: #6c3483; stroke-width: 0.3; }
.board-tile-marker.tone-trade { fill: #ffffff; stroke: #5d6d7e; stroke-width: 0.55; }
.board-tile-marker.tone-gate { fill: #8e44ad; }
.board-tile-legend .dot.tone-trade { background: #ffffff; border-color: #5d6d7e; }
.board-tile-legend .dot.tone-gate { background: #8e44ad; }
.board-tile-segment-label.trade { fill: #34495e; }
.board-tile-segment-label.gate { fill: #6c3483; }

/* Scenery depth cue in the board designer: props that print UNDER the path
   are drawn hollow, props that print OVER it are solid. */
.board-decor-node.under-path .board-decor-base { fill-opacity: 0.25; stroke-dasharray: 1.2 0.8; }
.board-decor-node.over-path .board-decor-base { fill-opacity: 0.85; }
