/* ===== CSS Variables & Reset ===== */
:root {
    --primary: #6C5CE7;
    --primary-light: #A29BFE;
    --primary-dark: #5A4BD1;
    --secondary: #00CEC9;
    --accent: #FD79A8;
    --accent2: #FDCB6E;
    --success: #00B894;
    --danger: #E17055;
    --bg: #0F0E17;
    --bg-card: #1A1930;
    --bg-card2: #232046;
    --surface: #2D2B55;
    --text: #FFFFFE;
    --text-secondary: #A7A9BE;
    --text-muted: #72738C;
    --radius: 16px;
    --radius-sm: 10px;
    --radius-xs: 6px;
    --shadow: 0 8px 32px rgba(0,0,0,0.3);
    --shadow-lg: 0 16px 48px rgba(0,0,0,0.4);
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font: 'Noto Sans KR', sans-serif;
    /* Chart colors */
    --chart-1: #6C5CE7;
    --chart-2: #00CEC9;
    --chart-3: #FD79A8;
    --chart-4: #FDCB6E;
    --chart-5: #00B894;
    --chart-6: #E17055;
    --chart-7: #74B9FF;
    --chart-8: #A29BFE;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--surface); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ===== Header ===== */
#main-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(15, 14, 23, 0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(108, 92, 231, 0.15);
    padding: 0 24px;
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: var(--transition);
}
.logo:hover { transform: scale(1.03); }
.logo-icon { font-size: 28px; }
.logo h1 { font-size: 18px; font-weight: 700; background: linear-gradient(135deg, var(--primary-light), var(--secondary)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

.header-nav { display: flex; gap: 4px; }

.nav-btn {
    display: flex; align-items: center; gap: 6px;
    padding: 8px 16px; border: none; border-radius: var(--radius-sm);
    background: transparent; color: var(--text-secondary);
    font-family: var(--font); font-size: 14px; font-weight: 500;
    cursor: pointer; transition: var(--transition);
}
.nav-btn:hover { background: var(--surface); color: var(--text); }
.nav-btn.active { background: var(--primary); color: white; }
.nav-icon { font-size: 16px; }

/* ===== Pages ===== */
.page { display: none; animation: fadeIn 0.4s ease; }
.page.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

.page-container { max-width: 720px; margin: 0 auto; padding: 40px 24px 80px; }
.page-container.wide { max-width: 960px; }

.page-header { margin-bottom: 32px; }
.page-header h2 { font-size: 28px; font-weight: 800; margin-bottom: 8px; }
.page-header p { color: var(--text-secondary); font-size: 15px; }

/* ===== Buttons ===== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 12px 24px; border: none; border-radius: var(--radius-sm);
    font-family: var(--font); font-size: 15px; font-weight: 600;
    cursor: pointer; transition: var(--transition);
    text-decoration: none; white-space: nowrap;
}
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: white; box-shadow: 0 4px 16px rgba(108, 92, 231, 0.35); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 24px rgba(108, 92, 231, 0.5); }
.btn-secondary { background: var(--surface); color: var(--text); }
.btn-secondary:hover { background: var(--bg-card2); }
.btn-ghost { background: transparent; color: var(--primary-light); border: 1px dashed var(--primary-light); }
.btn-ghost:hover { background: rgba(108, 92, 231, 0.1); }
.btn-lg { padding: 16px 32px; font-size: 17px; border-radius: var(--radius); }
.btn-sm { padding: 8px 16px; font-size: 13px; }
.btn-icon { width: 36px; height: 36px; border-radius: 50%; border: none; background: var(--surface); color: var(--text-muted); font-size: 16px; cursor: pointer; transition: var(--transition); display: flex; align-items: center; justify-content: center; }
.btn-icon:hover:not(:disabled) { background: var(--danger); color: white; }
.btn-icon:disabled { opacity: 0.3; cursor: not-allowed; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #c0392b; }

/* ===== Hero ===== */
.hero {
    max-width: 1200px; margin: 0 auto;
    display: grid; grid-template-columns: 1fr 1fr;
    align-items: center; gap: 40px;
    padding: 60px 24px 40px;
    min-height: calc(100vh - 240px);
}

.hero-badge {
    display: inline-block; padding: 6px 16px;
    background: rgba(108, 92, 231, 0.15); border: 1px solid rgba(108, 92, 231, 0.3);
    border-radius: 50px; font-size: 13px; font-weight: 600;
    color: var(--primary-light); margin-bottom: 20px;
}

.hero-title { font-size: 42px; font-weight: 900; line-height: 1.3; margin-bottom: 16px; }
.gradient-text { background: linear-gradient(135deg, var(--primary-light), var(--secondary), var(--accent)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.hero-desc { color: var(--text-secondary); font-size: 16px; line-height: 1.8; margin-bottom: 32px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.hero-visual { position: relative; height: 400px; }

.floating-card {
    position: absolute; padding: 20px 24px;
    background: var(--bg-card); border: 1px solid rgba(108, 92, 231, 0.2);
    border-radius: var(--radius); box-shadow: var(--shadow);
    display: flex; flex-direction: column; align-items: center; gap: 12px;
    animation: float 4s ease-in-out infinite;
}
.floating-card span { font-size: 13px; font-weight: 600; color: var(--text-secondary); }

.card-bar { top: 20px; left: 10%; animation-delay: 0s; }
.card-pie { top: 50%; right: 5%; animation-delay: 1.3s; }
.card-line { bottom: 10%; left: 20%; animation-delay: 2.6s; }

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
}

.mini-bar { display: flex; align-items: flex-end; gap: 6px; height: 60px; }
.mini-bar .bar { width: 16px; border-radius: 4px 4px 0 0; transition: var(--transition); }
.mini-bar .bar:nth-child(1) { background: var(--chart-1); }
.mini-bar .bar:nth-child(2) { background: var(--chart-2); }
.mini-bar .bar:nth-child(3) { background: var(--chart-3); }
.mini-bar .bar:nth-child(4) { background: var(--chart-4); }

.mini-pie {
    width: 64px; height: 64px; border-radius: 50%;
    background: conic-gradient(var(--chart-1) 0% 35%, var(--chart-2) 35% 60%, var(--chart-3) 60% 80%, var(--chart-4) 80% 100%);
}

.mini-line { width: 80px; height: 40px; color: var(--chart-2); }

/* ===== Steps ===== */
.steps-section { max-width: 1000px; margin: 0 auto; padding: 40px 24px 80px; }
.section-title { font-size: 24px; font-weight: 800; text-align: center; margin-bottom: 32px; }

.steps-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.step-card {
    position: relative; padding: 28px 20px; text-align: center;
    background: var(--bg-card); border: 1px solid rgba(108, 92, 231, 0.12);
    border-radius: var(--radius); transition: var(--transition);
}
.step-card:hover { transform: translateY(-4px); border-color: var(--primary); box-shadow: 0 8px 32px rgba(108, 92, 231, 0.15); }
.step-num { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: white; font-size: 14px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.step-icon { font-size: 36px; margin-bottom: 12px; }
.step-card h4 { font-size: 16px; font-weight: 700; margin-bottom: 8px; }
.step-card p { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }

/* ===== Create Form ===== */
.create-form { display: flex; flex-direction: column; gap: 28px; }
.form-group { display: flex; flex-direction: column; gap: 8px; }
.form-group label { font-size: 15px; font-weight: 700; }

.form-group input[type="text"], .form-group input[type="number"] {
    width: 100%; padding: 14px 18px;
    background: var(--surface); border: 2px solid transparent;
    border-radius: var(--radius-sm); color: var(--text);
    font-family: var(--font); font-size: 15px;
    transition: var(--transition); outline: none;
}
.form-group input:focus { border-color: var(--primary); background: var(--bg-card2); }
.char-count { text-align: right; font-size: 12px; color: var(--text-muted); }

#options-container { display: flex; flex-direction: column; gap: 10px; }
.option-row { display: flex; align-items: center; gap: 10px; animation: fadeIn 0.3s ease; }
.option-num { width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: white; font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.option-input { flex: 1; padding: 12px 16px; background: var(--surface); border: 2px solid transparent; border-radius: var(--radius-sm); color: var(--text); font-family: var(--font); font-size: 14px; outline: none; transition: var(--transition); }
.option-input:focus { border-color: var(--primary); }

.form-actions { display: flex; justify-content: center; padding-top: 8px; }

/* ===== Surveys List ===== */
.surveys-list { display: flex; flex-direction: column; gap: 12px; }
.survey-card {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 24px;
    background: var(--bg-card); border: 1px solid rgba(108, 92, 231, 0.12);
    border-radius: var(--radius); cursor: pointer;
    transition: var(--transition);
}
.survey-card:hover { border-color: var(--primary); transform: translateX(4px); box-shadow: 0 4px 16px rgba(108,92,231,0.12); }
.survey-card-info h4 { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.survey-card-info p { font-size: 13px; color: var(--text-secondary); }
.survey-card-actions { display: flex; gap: 8px; }

.empty-state { text-align: center; padding: 60px 20px; }
.empty-icon { font-size: 64px; margin-bottom: 16px; }
.empty-state h3 { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.empty-state p { color: var(--text-secondary); margin-bottom: 24px; }

/* ===== Vote Page ===== */
.vote-mode-tabs { display: flex; gap: 4px; margin-bottom: 24px; background: var(--surface); border-radius: var(--radius-sm); padding: 4px; }
.tab-btn { flex: 1; padding: 12px; border: none; border-radius: var(--radius-xs); background: transparent; color: var(--text-secondary); font-family: var(--font); font-size: 14px; font-weight: 600; cursor: pointer; transition: var(--transition); }
.tab-btn.active { background: var(--primary); color: white; }

.vote-mode { display: none; }
.vote-mode.active { display: block; }

.vote-info { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.vote-total { font-size: 15px; color: var(--text-secondary); }
.vote-total strong { color: var(--primary-light); font-size: 20px; }

.vote-buttons { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 24px; }

.vote-btn {
    padding: 20px; border: 2px solid rgba(108, 92, 231, 0.2);
    border-radius: var(--radius); background: var(--bg-card);
    color: var(--text); font-family: var(--font); font-size: 16px;
    font-weight: 600; cursor: pointer; transition: var(--transition);
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    position: relative; overflow: hidden;
}
.vote-btn:hover { border-color: var(--primary); transform: scale(1.03); }
.vote-btn:active { transform: scale(0.97); }
.vote-btn .vote-btn-count { font-size: 28px; font-weight: 800; color: var(--primary-light); }
.vote-btn .vote-btn-label { font-size: 14px; color: var(--text-secondary); }

.vote-btn-ripple {
    position: absolute; border-radius: 50%;
    background: rgba(108, 92, 231, 0.3);
    animation: ripple 0.6s ease-out forwards;
    pointer-events: none;
}
@keyframes ripple { to { transform: scale(4); opacity: 0; } }

.vote-live-bar { display: flex; flex-direction: column; gap: 10px; }
.live-bar-row { display: flex; align-items: center; gap: 12px; }
.live-bar-label { width: 80px; font-size: 13px; font-weight: 600; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-bar-track { flex: 1; height: 28px; background: var(--surface); border-radius: 14px; overflow: hidden; position: relative; }
.live-bar-fill { height: 100%; border-radius: 14px; transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1); min-width: 0; display: flex; align-items: center; justify-content: flex-end; padding-right: 10px; font-size: 12px; font-weight: 700; }
.live-bar-value { font-size: 13px; font-weight: 700; width: 36px; text-align: left; color: var(--text-secondary); }

.manual-inputs { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.manual-row { display: flex; align-items: center; gap: 12px; }
.manual-row label { flex: 1; font-size: 15px; font-weight: 600; }
.manual-row input[type="number"] { width: 100px; padding: 10px 14px; background: var(--surface); border: 2px solid transparent; border-radius: var(--radius-xs); color: var(--text); font-family: var(--font); font-size: 16px; font-weight: 700; text-align: center; outline: none; transition: var(--transition); }
.manual-row input:focus { border-color: var(--primary); }

.vote-actions { display: flex; gap: 12px; margin-top: 32px; justify-content: center; flex-wrap: wrap; }

/* ===== Graph Page ===== */
.graph-tabs { display: flex; gap: 4px; margin-bottom: 24px; flex-wrap: wrap; background: var(--surface); border-radius: var(--radius-sm); padding: 4px; }
.graph-tab { padding: 10px 16px; border: none; border-radius: var(--radius-xs); background: transparent; color: var(--text-secondary); font-family: var(--font); font-size: 13px; font-weight: 600; cursor: pointer; transition: var(--transition); white-space: nowrap; }
.graph-tab.active { background: var(--primary); color: white; }

.chart-container {
    background: var(--bg-card); border: 1px solid rgba(108, 92, 231, 0.12);
    border-radius: var(--radius); padding: 32px;
    margin-bottom: 32px; min-height: 400px;
    display: flex; align-items: center; justify-content: center;
}
.chart-container canvas { max-height: 420px; }

/* ===== Band Chart ===== */
.band-chart { width: 100%; }
.band-title { font-size: 18px; font-weight: 700; text-align: center; margin-bottom: 24px; }
.band-bar-wrapper { margin-bottom: 20px; }
.band-bar-outer { width: 100%; height: 48px; border-radius: 12px; overflow: hidden; display: flex; background: var(--surface); }
.band-segment { height: 100%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: white; transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1); min-width: 0; overflow: hidden; }
.band-legend { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 16px; }
.band-legend-item { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.band-legend-color { width: 16px; height: 16px; border-radius: 4px; }

/* ===== Pictograph ===== */
.pictograph-chart { width: 100%; }
.pictograph-title { font-size: 18px; font-weight: 700; text-align: center; margin-bottom: 8px; }
.pictograph-key { text-align: center; color: var(--text-secondary); font-size: 14px; margin-bottom: 24px; }
.pictograph-row { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; padding: 8px 0; }
.pictograph-label { width: 100px; font-size: 14px; font-weight: 600; text-align: right; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pictograph-icons { display: flex; flex-wrap: wrap; gap: 4px; font-size: 22px; line-height: 1; }
.pictograph-half { opacity: 0.4; }
.pictograph-count { font-size: 13px; color: var(--text-secondary); margin-left: 8px; font-weight: 600; }

/* ===== Data Table ===== */
.data-summary { margin-bottom: 32px; }
.data-summary h3 { font-size: 18px; font-weight: 700; margin-bottom: 16px; }
.data-table { width: 100%; border-collapse: collapse; background: var(--bg-card); border-radius: var(--radius); overflow: hidden; }
.data-table th, .data-table td { padding: 14px 20px; text-align: center; }
.data-table th { background: var(--surface); font-size: 14px; font-weight: 700; color: var(--text-secondary); }
.data-table td { border-top: 1px solid rgba(108, 92, 231, 0.08); font-size: 14px; }
.data-table tbody tr:hover { background: rgba(108, 92, 231, 0.05); }
.data-table tfoot td { border-top: 2px solid var(--primary); font-weight: 700; background: rgba(108, 92, 231, 0.05); }

.graph-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ===== Mode Toggle ===== */
.mode-toggle { display: flex; gap: 4px; margin-bottom: 20px; background: var(--surface); border-radius: var(--radius-sm); padding: 4px; }
.mode-btn { flex: 1; padding: 12px 20px; border: none; border-radius: var(--radius-xs); background: transparent; color: var(--text-secondary); font-family: var(--font); font-size: 15px; font-weight: 700; cursor: pointer; transition: var(--transition); }
.mode-btn.active { background: linear-gradient(135deg, var(--primary), var(--secondary)); color: white; }

/* ===== Builder Display ===== */
.builder-display { margin-bottom: 32px; }
.builder-container { background: var(--bg-card); border: 1px solid rgba(108,92,231,0.12); border-radius: var(--radius); padding: 24px; min-height: 300px; position: relative; overflow: hidden; }
.builder-actions { display: flex; justify-content: center; margin: 20px 0; }
.builder-feedback { margin-top: 16px; }

.bb-hint { text-align: center; color: var(--accent2); font-size: 14px; font-weight: 600; margin-bottom: 20px; padding: 10px; background: rgba(253,203,110,0.08); border-radius: var(--radius-xs); }

/* Axis Settings */
.bb-axis-settings { display: flex; justify-content: center; gap: 20px; margin-bottom: 20px; background: rgba(108, 92, 231, 0.05); padding: 12px; border-radius: var(--radius-sm); flex-wrap: wrap; }
.bb-axis-settings label { font-size: 13px; font-weight: 600; color: var(--text-secondary); display: flex; align-items: center; gap: 8px; }
.bb-axis-inp { background: var(--bg-main); border: 1px solid rgba(108, 92, 231, 0.2); border-radius: 4px; padding: 6px 8px; font-size: 13px; color: var(--text-main); width: 80px; transition: border-color 0.2s, box-shadow 0.2s; }
.bb-axis-inp:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(108, 92, 231, 0.2); }

/* ===== Bar Builder ===== */
.bb-wrapper { display: flex; gap: 0; user-select: none; }
.bb-yaxis { display: flex; flex-direction: column; width: 36px; flex-shrink: 0; }
.bb-yl { flex: 1; display: flex; align-items: center; justify-content: flex-end; padding-right: 8px; font-size: 11px; color: var(--text-muted); min-height: 20px; }
.bb-cols { display: flex; flex: 1; gap: 2px; border-left: 2px solid var(--text-muted); border-bottom: 2px solid var(--text-muted); padding: 0 16px; }
.bb-cols.line-mode .bb-cell { cursor: crosshair; }
.bb-col { flex: 1; display: flex; flex-direction: column; position: relative; }
.bb-cell { flex: 1; min-height: 20px; border-top: 1px solid rgba(108,92,231,0.06); cursor: pointer; transition: background 0.15s; border-radius: 2px; }
.bb-cell:hover { filter: brightness(1.4); }
.bb-cell.filled { box-shadow: inset 0 0 0 1px rgba(255,255,255,0.1); }
.bb-cell.dot { position: relative; }
.bb-cell.dot::after { content: ''; position: absolute; top: 50%; left: 50%; width: 14px; height: 14px; border-radius: 50%; background: var(--primary); border: 3px solid white; transform: translate(-50%,-50%); z-index: 2; box-shadow: 0 2px 8px rgba(108,92,231,0.5); }
.bb-val { text-align: center; padding: 4px 0; font-size: 13px; font-weight: 800; color: var(--primary-light); }
.bb-labels { display: flex; padding: 0 16px 0 54px; }
.bb-lb { flex: 1; text-align: center; font-size: 12px; font-weight: 600; padding: 4px 2px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.line-svg { position: absolute; top: 0; left: 0; pointer-events: none; z-index: 3; }

/* ===== Line Chart 전용 — 셀 높이 고정, Y축 정렬 ===== */
.lc-yaxis { display: flex; flex-direction: column; width: 36px; flex-shrink: 0; }
.lc-yl { display: flex; align-items: center; justify-content: flex-end;
          padding-right: 8px; font-size: 11px; color: var(--text-muted);
          box-sizing: border-box; border-top: 1px solid rgba(108,92,231,0.10); }
.lc-zero { border-top: 2px solid var(--text-muted); color: var(--text-muted); font-size: 10px; }
.lc-col { display: flex; flex-direction: column; }
/* bb-wrapper에 border-bottom을 추가해 0 축선을 표현 */
.bb-wrapper { border-bottom: 2px solid var(--text-muted); }
/* 값 표시 행 */
.lc-vals { display: flex; margin-top: 4px; padding: 0 16px 0 54px; }
.lc-val-cell { flex: 1; text-align: center; font-size: 13px; font-weight: 800;
               color: var(--primary-light); padding: 2px 0; }

/* ===== Percent Builder (Pie/Band) ===== */
.bp-band-interactive {
    width: 100%;
    height: 48px;
    border-radius: 12px;
    position: relative;
    background: #e0e0e0;
    margin: 20px 0;
}
.bp-band-track {
    width: 100%;
    height: 100%;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
}
.bp-seg {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.4);
    transition: width 0.1s;
}
.band-handle {
    position: absolute;
    top: -6px;
    width: 14px;
    height: 60px;
    background: #ffffff;
    border: 3px solid var(--primary);
    border-radius: 7px;
    cursor: ew-resize;
    transform: translateX(-50%);
    z-index: 10;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    transition: border-color 0.2s, background-color 0.2s, transform 0.1s;
}
.band-handle:hover {
    background: #efedfd;
    transform: translateX(-50%) scaleY(1.05);
}
.band-handle.active {
    background: var(--primary);
    border-color: #ffffff;
}
.band-handle.snapped {
    border-color: #00B894;
    background: #ffffff;
}
.band-handle.snapped:hover {
    background: #e6faf5;
}

.bp-pie-interactive {
    width: 240px;
    height: 240px;
    border-radius: 50%;
    position: relative;
    margin: 30px auto;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}
.bp-pie-track {
    width: 100%;
    height: 100%;
    border-radius: 50%;
}
.pie-handle {
    position: absolute;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #ffffff;
    border: 3px solid var(--primary);
    cursor: pointer;
    transform: translate(-50%, -50%);
    z-index: 10;
    box-shadow: 0 4px 8px rgba(0,0,0,0.25);
    transition: border-color 0.2s, background-color 0.2s, transform 0.1s;
}
.pie-handle:hover {
    transform: translate(-50%, -50%) scale(1.15);
    background: #efedfd;
}
.pie-handle.active {
    background: var(--primary);
    border-color: #ffffff;
}
.pie-handle.snapped {
    border-color: #00B894;
    background: #ffffff;
}
.pie-handle.snapped:hover {
    background: #e6faf5;
    transform: translate(-50%, -50%) scale(1.15);
}

.bp-check-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 24px;
    background: rgba(108, 92, 231, 0.04);
    padding: 16px;
    border-radius: 12px;
    border: 1px solid rgba(108, 92, 231, 0.08);
}
.bp-check-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    padding: 8px 12px;
    background: var(--bg-card);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}
.bp-check-status {
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
}
.bp-check-status.ok {
    color: #00B894;
}
.bp-check-status.yet {
    color: var(--text-muted);
}
.bp-check-status.wrong {
    color: #d63031;
}

/* ===== Pictograph Builder ===== */
.bp-picto-settings { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; font-size: 14px; font-weight: 600; }
.bp-picto-settings select { padding: 8px 12px; background: var(--surface); border: 2px solid transparent; border-radius: var(--radius-xs); color: var(--text); font-family: var(--font); font-size: 15px; outline: none; cursor: pointer; }
.bp-picto-settings select:focus { border-color: var(--primary); }
.picto-current-icon { font-size: 32px; width: 52px; height: 52px; border: 2px solid var(--primary); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; transition: var(--transition); display: inline-flex; align-items: center; justify-content: center; }
.picto-current-icon:hover { transform: scale(1.1); background: var(--bg-card2); border-color: var(--accent); }
.bp-picto-key { text-align: center; color: var(--text-secondary); font-size: 14px; font-weight: 600; margin-bottom: 16px; padding: 8px; background: rgba(108,92,231,0.08); border-radius: var(--radius-xs); }
.bp-picto-rows { display: flex; flex-direction: column; gap: 12px; }
.bp-pr { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--surface); border-radius: var(--radius-sm); }
.bp-pr-label { width: 80px; font-size: 14px; font-weight: 600; text-align: right; flex-shrink: 0; }
.bp-pr-icons { flex: 1; font-size: 24px; line-height: 1.3; letter-spacing: 2px; min-height: 32px; }
.bp-pr-btns { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.bp-pr-btns .btn-icon { background: var(--bg-card2); font-size: 18px; font-weight: 700; }
.bp-pr-btns .btn-icon:hover { background: var(--primary); color: white; }
.bp-pr-count { font-size: 13px; font-weight: 700; color: var(--text-secondary); min-width: 40px; text-align: center; }

/* ===== Per-item Icon Picker ===== */
.bp-pr-header { display: flex; align-items: center; gap: 8px; flex-shrink: 0; width: 120px; }
.bp-pr-header .bp-pr-label { flex: 1; }
.picto-icon-btn { font-size: 20px !important; background: var(--bg-card2) !important; cursor: pointer; transition: var(--transition); }
.picto-icon-btn:hover { transform: scale(1.2); background: var(--primary) !important; }
.bp-icon-picker { margin: -4px 0 8px 0; padding: 12px; background: var(--bg-card2); border: 1px solid rgba(108,92,231,0.2); border-radius: var(--radius-sm); animation: fadeIn 0.2s ease; }
.bp-icon-grid { display: flex; flex-direction: column; gap: 8px; }
.bp-icon-cat { font-size: 12px; font-weight: 700; color: var(--text-muted); margin-top: 4px; }
.bp-icon-cat:first-child { margin-top: 0; }
.bp-icon-opt { width: 38px; height: 38px; border: 2px solid transparent; border-radius: 8px; background: var(--surface); font-size: 20px; cursor: pointer; transition: var(--transition); display: inline-flex; align-items: center; justify-content: center; margin: 2px; }
.bp-icon-opt:hover { border-color: var(--primary); transform: scale(1.15); }
.bp-icon-opt.active { border-color: var(--primary); background: rgba(108,92,231,0.2); }

/* ===== Big / Small Pictograph Icons ===== */
.picto-big-icon { font-size: 36px; line-height: 1; vertical-align: middle; }
.picto-sm-icon { font-size: 20px; line-height: 1; vertical-align: middle; opacity: 0.85; }
.picto-sep { color: var(--text-muted); font-size: 24px; margin: 0 4px; vertical-align: middle; opacity: 0.4; }
.picto-empty { color: var(--text-muted); font-size: 14px; }
.picto-legend-item { display: inline-flex; align-items: center; gap: 4px; margin-right: 16px; font-size: 13px; color: var(--text-secondary); }
.picto-legend-item small { color: var(--text-muted); }

/* ===== Dual Button Group (Big/Small controls) ===== */
.bp-pr-dual-btns { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.bp-btn-group { display: flex; align-items: center; gap: 4px; background: var(--bg-card); border-radius: var(--radius-xs); padding: 4px 8px; }
.bp-btn-group .btn-icon { width: 28px; height: 28px; font-size: 16px; background: var(--bg-card2); }
.bp-btn-group .btn-icon:hover { background: var(--primary); color: white; }
.bp-btn-label { font-size: 11px; font-weight: 700; color: var(--text-muted); white-space: nowrap; }
.bp-btn-val { font-size: 15px; font-weight: 800; color: var(--primary-light); min-width: 20px; text-align: center; }

/* ===== Builder Feedback ===== */
.bf-score { text-align: center; font-size: 24px; font-weight: 800; margin-bottom: 16px; padding: 16px; background: var(--bg-card); border-radius: var(--radius); }
.bf-table { width: 100%; border-collapse: collapse; background: var(--bg-card); border-radius: var(--radius); overflow: hidden; }
.bf-table th, .bf-table td { padding: 12px 16px; text-align: center; font-size: 14px; }
.bf-table th { background: var(--surface); font-weight: 700; color: var(--text-secondary); }
.bf-table td { border-top: 1px solid rgba(108,92,231,0.08); }
.bf-ok td { color: var(--success); }
.bf-wrong td { color: var(--danger); }
.bf-perfect { text-align: center; margin-top: 16px; padding: 16px; background: rgba(0,184,148,0.1); border: 1px solid rgba(0,184,148,0.3); border-radius: var(--radius-sm); font-weight: 700; color: var(--success); font-size: 16px; }
.bf-retry { text-align: center; margin-top: 16px; padding: 12px; color: var(--text-secondary); font-size: 14px; }


/* ===== Presentation Mode ===== */
.present-mode {
    position: fixed; inset: 0; z-index: 1000;
    background: var(--bg); padding: 32px;
    display: none; flex-direction: column;
}
.present-mode.active { display: flex !important; }

.present-header { text-align: center; margin-bottom: 16px; flex-shrink: 0; }
.present-header h2 { font-size: 32px; font-weight: 900; }
.present-header p { color: var(--text-secondary); font-size: 15px; margin-top: 4px; }

.present-chart-container { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 0; padding: 8px; }
.present-chart-container canvas { max-height: 100%; max-width: 100%; }
.present-chart-container .band-chart, .present-chart-container .pictograph-chart { width: 80%; max-width: 800px; }

.present-controls {
    display: flex; align-items: center; justify-content: center; gap: 16px;
    padding: 16px 0 8px; flex-shrink: 0;
}
.present-btn { width: 48px; height: 48px; border-radius: 50%; border: 2px solid var(--surface); background: var(--bg-card); color: var(--text); font-size: 18px; cursor: pointer; transition: var(--transition); display: flex; align-items: center; justify-content: center; }
.present-btn:hover { border-color: var(--primary); background: var(--primary); }
.present-exit { border-color: var(--danger); }
.present-exit:hover { background: var(--danger); }
.present-indicator { font-size: 14px; font-weight: 600; color: var(--text-secondary); min-width: 120px; text-align: center; }

.present-table-container { flex-shrink: 0; max-height: 180px; overflow-y: auto; margin-top: 8px; }
.present-table { font-size: 13px; }

/* ===== Toast ===== */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
    padding: 14px 24px; border-radius: var(--radius-sm);
    background: var(--bg-card2); border: 1px solid var(--primary);
    color: var(--text); font-size: 14px; font-weight: 500;
    box-shadow: var(--shadow); animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
    max-width: 360px;
}
.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-12px); } }

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .hero { grid-template-columns: 1fr; text-align: center; padding: 40px 20px 20px; min-height: auto; }
    .hero-visual { display: none; }
    .hero-title { font-size: 28px; }
    .hero-actions { justify-content: center; }
    .steps-grid { grid-template-columns: repeat(2, 1fr); }
    .header-inner { height: 56px; }
    .logo h1 { font-size: 15px; }
    .nav-text { display: none; }
    .nav-btn { padding: 8px 12px; }
    .vote-buttons { grid-template-columns: repeat(2, 1fr); }
    .present-mode { padding: 16px; }
    .present-header h2 { font-size: 22px; }
}

@media (max-width: 480px) {
    .steps-grid { grid-template-columns: 1fr; }
    .graph-tabs { flex-direction: column; }
    .chart-container { padding: 16px; min-height: 300px; }
}
