/* KICE DB Dashboard Styles - Obsidian Style */

@font-face {
    font-family: 'Paperozi';
    src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/2408-3@1.0/Paperlogy-1Thin.woff2') format('woff2');
    font-weight: 100;
    font-display: swap;
}

@font-face {
    font-family: 'Paperozi';
    src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/2408-3@1.0/Paperlogy-2ExtraLight.woff2') format('woff2');
    font-weight: 200;
    font-display: swap;
}

@font-face {
    font-family: 'Paperozi';
    src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/2408-3@1.0/Paperlogy-3Light.woff2') format('woff2');
    font-weight: 300;
    font-display: swap;
}

@font-face {
    font-family: 'Paperozi';
    src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/2408-3@1.0/Paperlogy-4Regular.woff2') format('woff2');
    font-weight: 400;
    font-display: swap;
}

@font-face {
    font-family: 'Paperozi';
    src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/2408-3@1.0/Paperlogy-5Medium.woff2') format('woff2');
    font-weight: 500;
    font-display: swap;
}

@font-face {
    font-family: 'Paperozi';
    src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/2408-3@1.0/Paperlogy-6SemiBold.woff2') format('woff2');
    font-weight: 600;
    font-display: swap;
}

@font-face {
    font-family: 'Paperozi';
    src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/2408-3@1.0/Paperlogy-7Bold.woff2') format('woff2');
    font-weight: 700;
    font-display: swap;
}

@font-face {
    font-family: 'Paperozi';
    src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/2408-3@1.0/Paperlogy-8ExtraBold.woff2') format('woff2');
    font-weight: 800;
    font-display: swap;
}

@font-face {
    font-family: 'Paperozi';
    src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/2408-3@1.0/Paperlogy-9Black.woff2') format('woff2');
    font-weight: 900;
    font-display: swap;
}

:root {
    /* Color Palette - Deep Navy Glass with Dual Accents */
    --bg-base: #070b14;
    --bg-surface: rgba(255, 255, 255, 0.06);
    --bg-sidebar: rgba(255, 255, 255, 0.04);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;

    --accent-cyan: #06b6d4;
    --accent-magenta: #d946ef;

    --border-color: rgba(255, 255, 255, 0.10);
    --border-light: rgba(255, 255, 255, 0.20);

    --hover-bg: rgba(255, 255, 255, 0.05);
    --active-bg: rgba(255, 255, 255, 0.10);

    --font-sans: 'Paperozi', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

body {
    background:
        radial-gradient(ellipse 70% 55% at 8% 30%, rgba(6, 182, 212, 0.14) 0%, transparent 68%),
        radial-gradient(ellipse 55% 65% at 92% 12%, rgba(217, 70, 239, 0.12) 0%, transparent 65%),
        radial-gradient(ellipse 50% 50% at 55% 90%, rgba(99, 102, 241, 0.10) 0%, transparent 60%),
        var(--bg-base);
    background-attachment: fixed;
    color: var(--text-main);
    font-family: var(--font-sans);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* Glassmorphism Helper Refined */
.glass {
    background: var(--bg-surface);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border: 1px solid var(--border-color);
    border-top: 1px solid rgba(255, 255, 255, 0.20);
    border-radius: 12px;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

/* Main Content Layout (Single Column) */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    padding: 0.5rem 2rem 2rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    flex-direction: column;
}

/* Top Navigation & Branding */
.top-nav-container {
    padding: 1rem 0 0 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.brand-container {
    margin-bottom: 0.5rem;
}

.brand-kice {
    font-size: 1.2rem;
    font-family: 'Paperozi', sans-serif;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 6px;
    margin-bottom: -15px;
    display: block;
    opacity: 0.7;
    text-align: center;
}

.brand {
    font-size: 5rem;
    font-family: 'Paperozi', sans-serif;
    font-weight: 900;
    color: var(--text-main);
    letter-spacing: -2px;
    margin: 0;
    text-shadow: 0 4px 20px rgba(255, 255, 255, 0.1);
    text-align: center;
}

.brand span {
    color: var(--accent-cyan) !important;
}

.brand-subtitle {
    font-size: 0.8rem;
    letter-spacing: 2px;
    font-family: 'Courier New', Courier, monospace;
    opacity: 0.9;
    background: linear-gradient(135deg, var(--accent-magenta) 0%, var(--accent-cyan) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: bold;
    text-align: center;
}

/* Search Mode Pills */
.search-mode-pills {
    display: flex;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.5rem;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    border-top: 1px solid rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.search-pill {
    padding: 0.6rem 1.8rem;
    border-radius: 999px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: transparent;
    border: 1px solid transparent;
}

.search-pill:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.search-pill.active {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.15), rgba(217, 70, 239, 0.15));
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Huge Search Input Containers */
.huge-search-wrapper {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    position: relative;
    display: none;
    flex-direction: column;
    gap: 1rem;
}

.huge-search-wrapper.active {
    display: flex;
}

.huge-search-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-light);
    border-top: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 20px;
    padding: 1.5rem 5rem 1.5rem 2rem;
    font-size: 1.3rem;
    color: var(--text-main);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    transition: all 0.3s;
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.40),
        inset 0 1px 0 rgba(255, 255, 255, 0.14);
    font-family: inherit;
}

.huge-search-input:focus {
    outline: none;
    border-color: var(--accent-magenta);
    box-shadow: 0 0 0 2px rgba(217, 70, 239, 0.2), 0 12px 40px rgba(0, 0, 0, 0.5);
}

.huge-search-input:-webkit-autofill,
.huge-search-input:-webkit-autofill:hover,
.huge-search-input:-webkit-autofill:focus,
.huge-search-input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px rgba(15, 15, 25, 0.95) inset !important;
    -webkit-text-fill-color: var(--text-main) !important;
    transition: background-color 5000s ease-in-out 0s;
}

.search-icon-btn {
    position: absolute;
    right: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--accent-cyan);
    cursor: pointer;
    padding: 0.5rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-icon-btn:hover {
    color: var(--accent-magenta);
    transform: translateY(-50%) scale(1.1);
}

/* Keyword & Expression Helpers inside wrapper */
.search-helper-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    padding: 0 0.5rem;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 0.8rem;
    margin-top: 0.5rem;
}

.search-helper-text span {
    flex: 0 1 auto;
    text-align: left;
    white-space: nowrap;
}


.search-helper-text svg {
    cursor: pointer;
    color: var(--accent-cyan);
    transition: color 0.2s;
}

.search-helper-text svg:hover {
    color: var(--accent-magenta);
}

/* Split Pane Layout for Concepts */
.split-pane-layout {
    display: none;
    grid-template-columns: 320px 1fr;
    gap: 1.5rem;
    margin-top: 1rem;
    height: 650px;
    margin-bottom: 2rem;
}

.split-pane-layout.active {
    display: grid;
}

.pane-box {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-top: 1px solid rgba(255, 255, 255, 0.20);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.30),
        inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.pane-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent-cyan);
    margin-bottom: 1rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pane-content {
    flex: 1;
    overflow-y: auto;
    padding-right: 0.5rem;
}

/* Obsidian File Explorer Navigation */
.obs-file-explorer {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.9rem;
    user-select: none;
}

.obs-nav-folder-title,
.obs-nav-item {
    display: flex;
    align-items: center;
    padding: 4px 6px;
    border-radius: 5px;
    color: var(--text-main);
    cursor: pointer;
    transition: background-color 0.1s ease;
}

.obs-nav-folder-title:hover,
.obs-nav-item:hover {
    background-color: var(--hover-bg);
}

.obs-nav-folder-title.active,
.obs-nav-item.active {
    background-color: var(--active-bg);
    color: #fff;
}

.obs-nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    font-size: 0.7rem;
    color: var(--text-muted);
    transition: transform 0.1s ease;
}

.obs-nav-toggle.collapsed {
    transform: rotate(-90deg);
}

.obs-nav-title {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 400;
}

.obs-nav-folder-children {
    display: block;
    margin-left: 12px;
    padding-left: 4px;
    border-left: 1px solid var(--border-color);
}

.obs-nav-folder-children.collapsed {
    display: none;
}

/* Main Content */


/* View Sections */
.view-section {
    display: none;
    flex: 1;
    flex-direction: column;
    animation: fadeIn 0.4s ease-out forwards;
}

.view-section.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* KPI Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.kpi-card {
    padding: 1.75rem;
    background: var(--bg-surface);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border: 1px solid var(--border-color);
    border-top: 1px solid rgba(255, 255, 255, 0.20);
    border-radius: 12px;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.12);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s;
    position: relative;
    overflow: hidden;
}

/* Gradient line on the side like Mockup 24 concept column */
.kpi-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(135deg, var(--accent-magenta) 0%, var(--accent-cyan) 100%);
    opacity: 0.8;
}

.kpi-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    border-color: rgba(255, 255, 255, 0.2);
}

.kpi-card h3 {
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.kpi-value {
    font-size: 2.5rem;
    font-weight: 600;
    font-family: 'Courier New', monospace;
    color: var(--text-main);
    margin-bottom: 0.5rem;
    text-shadow: 0 4px 12px rgba(255, 255, 255, 0.1);
}

.kpi-desc {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Charts Grid */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
}

.chart-card {
    padding: 1.75rem;
    background: var(--bg-surface);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border: 1px solid var(--border-color);
    border-top: 1px solid rgba(255, 255, 255, 0.20);
    border-radius: 12px;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.chart-card h3 {
    font-size: 1.25rem;
    color: var(--text-main);
    font-weight: 500;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Lists */
.ranking-list {
    list-style: none;
}

.ranking-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.875rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.ranking-list li:last-child {
    border-bottom: none;
}

.ranking-item {
    display: flex;
    flex-direction: column;
}

.ranking-name {
    font-weight: 500;
    color: var(--text-main);
}

.ranking-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.ranking-count {
    background: rgba(6, 182, 212, 0.15);
    color: var(--accent-cyan);
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
}

/* Search Section in Sidebar */
.sidebar-search {
    display: flex;
    gap: 0.4rem;
    margin-bottom: 1.5rem;
    padding: 0 0.2rem;
}

#sidebar-order-list li {
    margin-bottom: 6px;
    border-radius: 6px;
    transition: margin 0.18s ease;
}

#sidebar-order-list li.dragging {
    opacity: 0.5;
    background: rgba(255, 255, 255, 0.1);
    transform: scale(0.98);
}

/* Enhancing drag-and-drop dropzone visualization without layout shifting (prevents jiggling) */
#sidebar-order-list li.drag-insert-before,
#sidebar-order-list li.drag-insert-after {
    position: relative;
}

#sidebar-order-list li.drag-insert-before::before {
    content: '';
    position: absolute;
    top: -2px;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent-blue, #5b8dee);
    border-radius: 2px;
    z-index: 10;
    box-shadow: 0 0 4px rgba(91, 141, 238, 0.6);
}

#sidebar-order-list li.drag-insert-after::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent-blue, #5b8dee);
    border-radius: 2px;
    z-index: 10;
    box-shadow: 0 0 4px rgba(91, 141, 238, 0.6);
}
.sidebar-search input {
    flex: 1;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.5rem 0.8rem;
    color: var(--text-main);
    font-size: 0.85rem;
    font-family: inherit;
    transition: all 0.2s ease;
}

.sidebar-search input:focus {
    outline: none;
    border-color: var(--accent-blue);
    background: rgba(0, 0, 0, 0.4);
}

.sidebar-search button {
    background: var(--accent-blue);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 0 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 0 10px rgba(120, 82, 238, 0.3);
}

.sidebar-search button:hover {
    background: var(--accent-purple);
    transform: translateY(-1px);
    box-shadow: 0 0 12px rgba(155, 114, 245, 0.4);
}

.sidebar-search button:active {
    transform: translateY(0) scale(0.96);
}

/* Results Table */
.results-container {
    padding: 1.5rem;
    min-height: 400px;
    overflow-x: auto;
}

.placeholder-text {
    text-align: center;
    color: var(--text-muted);
    padding: 3rem 0;
    font-style: italic;
}

.search-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.95rem;
}

.sidebar-item-pid {
    font-size: 0.9rem;
    color: var(--text-main);
    font-weight: 500;
}

/* End dropzone for easily moving to the end of the list */
.drag-drop-zone-end.drag-over {
    height: 30px !important;
    border: 2px dashed var(--accent-blue);
    background: rgba(139, 92, 246, 0.1);
    border-radius: 6px;
    margin-top: 6px;
}

.search-table th {
    padding: 1.2rem 1rem;
    background: rgba(0, 0, 0, 0.4);
    color: var(--text-muted);
    font-weight: normal;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color);
    text-align: center;
}

.search-table td {
    padding: 2rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    vertical-align: top;
    color: var(--text-muted);
}

/* Fix problem ID column width and prevent text wrapping */
/* Use explicit CSS classes so rowspan doesn't confuse nth-child selectors */
.search-table th.col-probid,
.search-table td.col-probid {
    width: 20%;
    min-width: 160px;
    padding: 0.8rem 1rem;
    text-align: center;
    vertical-align: middle;
}

.search-table th.col-step,
.search-table td.col-step {
    width: 48%;
    padding: 0.8rem 1rem;
    vertical-align: top;
    text-align: left;
}

/* Reduce the concept column width */
.search-table th.col-concept,
.search-table td.col-concept {
    width: 30%;
    padding: 0.8rem 1.5rem 0.8rem 1rem;
    vertical-align: top;
    text-align: left;
}

.prob-id-glass-tag {
    display: block;
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    padding: 0.4rem 0.8rem;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--text-main);
    font-family: 'Courier New', monospace;
    font-weight: 600;
    font-size: 0.95rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    transition: all 0.2s ease;
}

.prob-id-glass-tag:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-cyan);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(6, 182, 212, 0.2);
}




.search-table tr {
    transition: background 0.15s;
}

/* Group hover: JS adds/removes .group-hovered on all rows of the same problem */
.search-table tr.group-hovered td {
    background: rgba(255, 255, 255, 0.04);
}

.search-table tr.group-hovered td.col-probid {
    background: rgba(217, 70, 239, 0.05);
}

/* Individual row: apply a stronger highlight to the exact hovered step row */
.search-table tr.group-hovered:hover td.col-step,
.search-table tr.group-hovered:hover td.col-concept {
    background: rgba(255, 255, 255, 0.09);
}

.text-ellipsis {
    max-width: 250px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.latex-font {
    font-family: var(--font-sans);
    color: #e2e8f0;
}

/* Tags */
.tag {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
}

.tag-cyan {
    background: rgba(6, 182, 212, 0.15);
    color: var(--accent-cyan);
    border: 1px solid rgba(6, 182, 212, 0.3);
}

.tag-magenta {
    background: rgba(217, 70, 239, 0.15);
    color: var(--accent-magenta);
    border: 1px solid rgba(217, 70, 239, 0.3);
}

/* Skeletons */
.skeleton-loader {
    width: 100%;
    height: 48px;
    border-radius: 8px;
    background: linear-gradient(90deg,
            rgba(255, 255, 255, 0.03) 25%,
            rgba(255, 255, 255, 0.08) 50%,
            rgba(255, 255, 255, 0.03) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

/* Split View Container for Concepts View */
.split-view-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.concept-results-panel {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* Concept Results Panel */
.concept-badge-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.concept-badge {
    padding: 0.5rem 1rem;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.concept-badge:hover {
    border-color: var(--accent-magenta);
    background: rgba(217, 70, 239, 0.1);
}

.concept-badge.selected {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.2), rgba(217, 70, 239, 0.2));
    border-color: var(--accent-cyan);
    color: #fff;
}

.badge-ref {
    color: var(--accent-cyan);
    font-weight: 500;
    margin-right: 0.5rem;
}

.fade-hr {
    border: 0;
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.2), transparent);
    margin: 1.5rem 0;
}

.mt-3 {
    margin-top: 1.5rem;
}

/* Custom Tooltip System */
.tooltip-container {
    position: relative;
    display: inline-block;
    cursor: default;
    width: 100%;
}

.custom-tooltip {
    visibility: hidden;
    opacity: 0;
    position: fixed;
    z-index: 10000;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(60px) saturate(200%);
    -webkit-backdrop-filter: blur(60px) saturate(200%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-top: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 14px;
    color: rgba(226, 232, 240, 0.92);
    padding: 1.1rem 1.3rem;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.16),
        0 12px 40px rgba(0, 0, 0, 0.50),
        0 2px 12px rgba(0, 0, 0, 0.30);
    width: max-content;
    max-width: 520px;
    font-size: 0.88rem;
    line-height: 1.65;
    white-space: normal;
    text-align: left;
    transition: opacity 0.18s ease;
    pointer-events: none;
}

/* Tooltip Markdown Styling */
.custom-tooltip p {
    margin-bottom: 0.65rem;
}

.custom-tooltip p:last-child {
    margin-bottom: 0;
}

.custom-tooltip strong {
    color: var(--accent-cyan);
    font-weight: 600;
}

.custom-tooltip ul,
.custom-tooltip ol {
    margin: 0.5rem 0 0.65rem 1.1rem;
}

.custom-tooltip li {
    margin-bottom: 0.2rem;
}

.custom-tooltip blockquote {
    border-left: 2px solid var(--accent-magenta);
    background: rgba(217, 70, 239, 0.07);
    padding: 0.45rem 0.75rem;
    margin: 0.5rem 0;
    border-radius: 4px;
    font-style: italic;
    color: rgba(203, 213, 225, 0.85);
}

/* Tooltip Table Styling */
.custom-tooltip table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.65rem 0;
    font-size: 0.82rem;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.10);
}

.custom-tooltip th,
.custom-tooltip td {
    padding: 0.4rem 0.65rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    text-align: left;
}

.custom-tooltip th {
    background: rgba(6, 182, 212, 0.14);
    color: var(--accent-cyan);
    font-weight: 600;
}

.custom-tooltip tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.04);
}

.custom-tooltip code {
    background: rgba(6, 182, 212, 0.1);
    padding: 0.12rem 0.35rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.82rem;
    color: var(--accent-cyan);
}

.custom-tooltip-right {
    left: auto;
    right: 0;
    transform: translateX(0);
}

.custom-tooltip-left {
    left: 0;
    transform: translateX(0);
}

.tooltip-container:hover .custom-tooltip {
    visibility: visible;
    opacity: 1;
}



/* ========================================================================= */
/* Problem Cart & Print Modal Styles */
/* ========================================================================= */

/* Problem Cart (Right Sidebar) */
#problem-cart {
    position: fixed;
    top: 0;
    bottom: 0;
    right: 0;
    width: 240px;
    background: var(--bg-surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-left: 1px solid var(--border-color);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.4);
    z-index: 100;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    padding: 4.5rem 1.5rem 1.5rem 1.5rem;
    display: flex;
    flex-direction: column;
}

#problem-cart.open {
    transform: translateX(0);
}

#cart-toggle-btn {
    position: absolute;
    top: 120px;
    left: -40px;
    transform: translateY(-50%);
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-right: none;
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
    padding: 16px 4px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-muted);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.2);
}

#cart-toggle-icon {
    transition: transform 0.3s ease;
}

#problem-cart.open #cart-toggle-icon {
    transform: rotate(180deg);
}

#cart-toggle-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

#cart-badge {
    background: var(--accent-purple);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
}

.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.cart-btn {
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: filter 0.2s, transform 0.1s;
    font-family: inherit;
}

.cart-btn:hover {
    filter: brightness(1.1);
}

.cart-btn:active {
    transform: scale(0.96);
}

#cart-items-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    align-content: flex-start;
    align-items: flex-start;
}

.cart-item-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(167, 139, 250, 0.15);
    border: 1px solid rgba(167, 139, 250, 0.3);
    color: #c4b5fd;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    position: relative;
}

/* Thumbnail tooltip shown on cart item hover */
.cart-thumb-tooltip {
    display: none;
    position: fixed;
    z-index: 9999;
    background: #1e293b;
    border: 1px solid rgba(167, 139, 250, 0.5);
    border-radius: 8px;
    padding: 5px 5px 5px 5px;
    pointer-events: none;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.6);
}

.cart-thumb-tooltip img {
    display: block;
    max-width: 220px;
    max-height: 180px;
    border-radius: 4px;
    object-fit: contain;
}

.cart-item-remove {
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.cart-item-remove:hover {
    opacity: 1;
    color: white;
}

/* In-table cart styling */
.in-cart {
    background: rgba(167, 139, 250, 0.2) !important;
    border-color: rgba(167, 139, 250, 0.5) !important;
    color: #ddd6fe !important;
}

.in-cart::after {
    content: ' ✓';
    font-size: 0.8em;
}

/* Print Preview Modal */
#print-preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

#print-preview-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.9);
    /* Dark slate replacing standard black/grey */
    backdrop-filter: blur(4px);
    z-index: -1;
}

/* 인쇄 미리보기 열릴 때 활용팁 버튼 숨김 */
body.preview-open #global-actions-left {
    display: none !important;
}

#print-preview-header {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(60px) saturate(200%);
    -webkit-backdrop-filter: blur(60px) saturate(200%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.10);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.16),
        0 4px 32px rgba(0, 0, 0, 0.50);
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    z-index: 10;
    flex-shrink: 0;
    gap: 2.5rem;
}

.print-header-title {
    display: none;
}

.print-header-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* Pill Groups */
.print-header-pill-group {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.print-header-pill-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    font-family: var(--font-sans);
    white-space: nowrap;
    letter-spacing: 0.03em;
}

.print-header-pills {
    display: flex;
    gap: 0.25rem;
    background: rgba(255, 255, 255, 0.04);
    padding: 0.28rem;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    border-top: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow:
        inset 0 1px 3px rgba(0, 0, 0, 0.25),
        0 1px 0 rgba(255, 255, 255, 0.06);
}

.print-pill {
    padding: 0.28rem 0.85rem;
    border-radius: 999px;
    font-size: 0.80rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    background: transparent;
    border: 1px solid transparent;
    font-family: var(--font-sans);
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.print-pill:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.06);
}

.print-pill.active {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.18), rgba(217, 70, 239, 0.18));
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.30);
}

.print-header-pill-divider {
    width: 1px;
    height: 28px;
    background: rgba(255, 255, 255, 0.10);
    flex-shrink: 0;
}

.print-header-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    margin-left: 2rem;
}

.print-btn-pdf {
    padding: 6px 16px;
    border: 1px solid rgba(6, 182, 212, 0.35);
    border-top: 1px solid rgba(6, 182, 212, 0.55);
    border-radius: 6px;
    font-size: 0.83rem;
    font-weight: 600;
    font-family: var(--font-sans);
    cursor: pointer;
    background: rgba(6, 182, 212, 0.12);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--accent-cyan);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.10);
    transition: background 0.2s, border-color 0.2s, box-shadow 0.2s, transform 0.1s;
    letter-spacing: 0.03em;
}

.print-btn-pdf:hover {
    background: rgba(6, 182, 212, 0.20);
    border-color: rgba(6, 182, 212, 0.55);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 0 14px rgba(6, 182, 212, 0.18);
}
.print-btn-pdf:active { transform: scale(0.96); }

.print-btn-close {
    padding: 6px 14px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 500;
    font-family: var(--font-sans);
    cursor: pointer;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-muted);
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.print-btn-close:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--border-light);
    color: var(--text-main);
}
.print-btn-close:active { transform: scale(0.96); }

/* Print preview 2-column layout: sidebar + scroll area */
#print-preview-layout {
    flex: 1;
    display: flex;
    flex-direction: row;
    overflow: hidden;
}

#print-sidebar {
    width: 250px;
    flex-shrink: 0;
    background: #0f172a;
    border-right: 1px solid #1e293b;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 14px 10px;
}

.sidebar-title {
    color: #64748b;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 10px;
    padding: 0 2px;
}

#sidebar-order-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-item {
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 6px;
    color: #e2e8f0;
    font-size: 0.78rem;
    user-select: none;
    cursor: pointer;
    overflow: hidden;
    transition: background 0.15s, border-color 0.15s, margin 0.18s ease;
}

.sidebar-drag-handle {
    cursor: grab;
    padding-right: 4px;
    color: #8b9bb4;
    font-size: 1.1rem;
    user-select: none;
}

.sidebar-item:hover {
    background: rgba(167, 139, 250, 0.07);
    border-color: rgba(167, 139, 250, 0.18);
}

/* 선택된 항목: 강조 + 위아래 여백 확장 */
.sidebar-item.selected {
    border-color: rgba(167, 139, 250, 0.5);
    background: rgba(167, 139, 250, 0.12);
    margin-top: 8px;
    margin-bottom: 8px;
}

/* 항목 본문 행 (번호 + ID + 삭제) */
.sidebar-item-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 6px;
}

/* 위로/아래로 버튼: 평소 높이 0으로 숨김, 선택 시 확장 */
.sidebar-move-up,
.sidebar-move-down {
    width: 100%;
    height: 0;
    overflow: hidden;
    opacity: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: #a78bfa;
    font-size: 0.62rem;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: height 0.18s ease, opacity 0.15s ease;
    font-family: inherit;
}

.sidebar-item.selected .sidebar-move-up,
.sidebar-item.selected .sidebar-move-down {
    height: 20px;
    opacity: 1;
}

.sidebar-move-up:hover:not(:disabled),
.sidebar-move-down:hover:not(:disabled) {
    background: rgba(167, 139, 250, 0.18);
    color: #c4b5fd;
}

.sidebar-move-up:disabled,
.sidebar-move-down:disabled {
    opacity: 0.2 !important;
    cursor: default;
}

/* 삭제(×) 버튼 */
.sidebar-item-remove {
    margin-left: auto;
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    color: #64748b;
    font-size: 0.9rem;
    padding: 0 3px;
    line-height: 1;
    border-radius: 3px;
    transition: color 0.15s, background 0.15s;
}

.sidebar-item-remove:hover {
    color: #f87171;
    background: rgba(248, 113, 113, 0.12);
}

.sidebar-item-num {
    background: #1e293b;
    color: #94a3b8;
    border-radius: 4px;
    padding: 1px 5px;
    font-size: 0.7rem;
    min-width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-item-pid {
    font-size: 0.73rem;
    color: #c4b5fd;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

#print-preview-scroll-area {
    flex: 1;
    overflow-y: auto;
    display: flex;
    justify-content: center;
    padding: 2rem 0;
}


#print-preview-content {
    background: transparent;
    width: 100%;
    max-width: 250mm;
    /* A wider container than A4 to show margins comfortably if needed */
    display: flex;
    flex-direction: column;
    align-items: center;
}

#print-preview-body {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* CSAT Layout Styles */
.csat-page {
    width: 210mm;
    height: 296mm; /* Reduced from 297mm to prevent Chrome print subpixel overflow */
    background: #ffffff;
    margin: 0 auto 2rem auto;
    padding: 10mm 15mm 18mm 15mm;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    position: relative;
    page-break-after: always;
    overflow: hidden;
}

.csat-page:last-child {
    page-break-after: auto;
}

/* Header Page 1 */
.csat-header-page1 {
    text-align: center;
    margin-bottom: 20px;
}

.csat-header-page1 .h1-top {
    display: flex;
    justify-content: center;
    /* Centered as requested */
    align-items: flex-end;
    margin-bottom: 3px;
}

.csat-header-page1 .exam-period {
    font-size: 1.1rem;
    font-weight: 600;
    /* Thinned from 800 */
    border: 1px solid #000;
    border-radius: 20px;
    padding: 2px 12px;
    margin-bottom: 0px;
    color: #000;
    position: absolute;
    left: 0;
    bottom: 6px;
}

.csat-header-page1 .exam-title {
    font-size: 1.5rem;
    font-weight: 500;
    /* Thinned from bold */
    color: #000;
}

.csat-header-page1 .exam-type {
    font-size: 1.2rem;
    font-weight: 600;
    /* Thinned from 800 */
    border: 1px solid #000;
    padding: 2px 8px;
    margin-bottom: 0px;
    color: #000;
    position: absolute;
    right: 0;
    bottom: 6px;
}

.csat-header-page1 .h1-main {
    font-size: 3rem;
    font-weight: 600;
    /* Thinned from 900 */
    letter-spacing: 0.5rem;
    margin-bottom: 0px;
    color: #000;
    width: 100%;
    text-align: center;
}

.csat-header-page1 .h1-divider {
    border-top: 3px solid #000;
}

/* Header Normal (Page 2+) */
.csat-header-normal {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 15px;
    padding-bottom: 5px;
    border-bottom: 2px solid #000;
    position: relative;
}

.csat-header-normal .page-num {
    font-size: 1.8rem;
    font-weight: 600;
    /* Thinned from bold */
    color: #000;
}

.csat-header-normal .h-main {
    font-size: 2rem;
    font-weight: 600;
    /* Thinned from 900 */
    letter-spacing: 0.3rem;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: 5px;
    color: #000;
}

.csat-header-normal .h-type {
    font-size: 1.2rem;
    font-weight: 600;
    /* Thinned from 800 */
    border: 1px solid #000;
    padding: 1px 6px;
    margin-bottom: 2px;
    color: #000;
}

.csat-columns {
    display: flex;
    flex: 1;
    position: relative;
    min-height: 0;
}

.csat-col {
    flex: 1;
    display: grid;
    grid-template-rows: 1fr 1fr;
    gap: 15px;
    padding: 0 10px;
    min-height: 0;
}

.csat-vline {
    width: 1px;
    background-color: #000;
    margin: 0 10px;
    flex-shrink: 0;
}

/* Item Container & Labels */
.csat-item-container {
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.csat-item-container.is-long {
    grid-row: 1 / span 2;
}

/* ── Row 1: pid + 정답 (일반 흐름) ── */
.csat-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    padding-bottom: 2px;
    min-height: 0;
}

/* ── Image area: num-box overlay 포함 ── */
.csat-img-area {
    flex: 1;
    position: relative;
    overflow: visible;
    min-height: 0;
}

/* ── num-box: absolute overlay on image ── */
.csat-num-overlay {
    position: absolute;
    /* ★ 미세조정 포인트: 원본 문항번호와 겹치도록 top/left 조절 */
    top: 5px;
    left: -6px;
    z-index: 2;
}

.csat-num-box {
    display: block;
    font-size: 0.74rem;
    font-weight: 600;
    border: 1px solid #fff;
    padding: 1px 3px;
    /* ★ 미세조정 포인트: "30"까지 담을 고정 너비, 숫자에 따라 박스 크기 변하지 않음 */
    width: 28px;
    min-height: 21px;
    text-align: center;
    box-sizing: border-box;
    /* 이미지 위 흰 배경으로 원본 번호 차폐 */
    background: white;
    color: #000;
}

.csat-meta-left {
    display: flex;
    align-items: center;
    gap: 4px;
}

.csat-seq-num {
    font-size: 0.92rem;
    font-weight: 700;
    color: #000;
    flex-shrink: 0;
}

.csat-db-id-tag {
    display: inline-block;
    font-size: 0.75rem;
    color: #000;
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
}

/* Footer elements */
.csat-footer {
    position: absolute;
    top: 281mm; /* A4(296, downsized) - 15 = 281. Prevent chrome fragmentation push */
    left: 15mm;
    right: 15mm;
    height: 15mm;
    padding-bottom: 7mm;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    background: white;
    z-index: 10;
    border-top: none;
    font-size: 8.5pt;
    color: #555;
    font-family: var(--font-batang, "KoPubBatang", "Batang", "Myungjo", serif);
}

.footer-page-box {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 54px;
    height: 30px;
    /* Reduced height */
    border: 1px solid #000;
    /* Flipped diagonal: top-left to bottom-right */
    background: linear-gradient(to bottom right, transparent 48.5%, #000 48.5%, #000 51.5%, transparent 51.5%);
}

.footer-page-total {
    position: absolute;
    bottom: 1px;
    right: 4px;
    font-size: 0.7rem;
    font-weight: bold;
    color: #000;
}

.footer-page-current {
    position: absolute;
    top: 1px;
    left: 7px;
    font-size: 0.7rem;
    font-weight: bold;
    color: #000;
}

.footer-copyright {
    font-size: 0.65rem;
    /* Smaller */
    font-weight: normal;
    /* Less heavy */
    letter-spacing: -0.5px;
    margin-left: auto;
    padding-right: 5px;
    color: #64748b;
    /* Lighter color */
}

.csat-prob-img {
    width: 100%;
    height: auto;
    display: block;
    mix-blend-mode: multiply;
    /* 인쇄 선명도 최적화 (B 방식) */
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    /* ★ 미세조정 포인트: 확대 비율 (1.00 = 원본, 1.05 = 5% 확대) */
    transform: scale(1.08);
    /* top-left 고정 → 우측·하단으로 overflow → clip-path로 클립 */
    transform-origin: top left;
    clip-path: inset(0);
}

.csat-inline-answer {
    font-size: 0.85rem;
    color: #000;
    font-weight: normal;
    font-family: inherit;
}

.csat-ans-table-end {
    width: 100%;
    margin-bottom: 10px;
    border-collapse: collapse;
    text-align: center;
    font-size: 0.85rem;
    table-layout: fixed;
    /* Enforces equal width for columns */
}

.csat-ans-table-end th,
.csat-ans-table-end td {
    border: 1px solid #111;
    padding: 6px 2px;
    color: #000;
}

.csat-ans-header {
    background-color: #f1f5f9;
    width: 40px;
    color: #000;
}

.csat-ans-val {
    font-weight: normal;
    /* No bold */
    color: #000;
    /* Pure black */
}

/* ── 해설지 전용 스타일 ──────────────────────────────────────────────────── */

/* 해설지 열: grid 해제 후 flex 세로 배치로 가변 높이 처리 */
.csat-col.csat-exp-col {
    display: flex;
    flex-direction: column;
    gap: 12px;
    grid-template-rows: none;
    overflow: visible;
    min-width: 0;
    /* flex min-width:auto 로 인한 열 불균등 방지 */
}

/* 해설지 문항 블록 */
.csat-exp-item {
    border-bottom: 1px solid #ccc;
    padding-bottom: 10px;
}

.csat-exp-item:last-child {
    border-bottom: none;
}


.csat-exp-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.csat-exp-item-header-left {
    display: flex;
    align-items: center;
    gap: 6px;
}

.csat-exp-answer {
    font-size: 0.68rem;
    font-weight: 700;
    color: #000;
    white-space: nowrap;
}

.csat-exp-item-steps {
    padding-left: 4px;
}

/* 스텝 블록 */
.csat-exp-step {
    margin-bottom: 7px;
}

/* 스텝 타이틀: 굵은 글씨 */
.csat-exp-step-title {
    font-size: 0.62rem;
    font-weight: 700;
    color: #111;
    margin-bottom: 3px;
}

/* 스텝 해설: 얇은 글씨 */
.csat-exp-step-body {
    font-size: 0.61rem;
    font-weight: 300;
    color: #222;
    line-height: 1.55;
}

/* 인쇄 시 스텝 블록 줄바꿈 방지 */
@media print {
    .csat-exp-item {
        break-inside: avoid;
    }

    .csat-exp-step {
        break-inside: avoid;
    }
}

/* ========================================================================= */
@page {
    size: A4 portrait;
    margin: 0;
}

@media print {
    /* #kice-print-root 외 모든 요소 숨김 */
    body > *:not(#kice-print-root) {
        display: none !important;
    }

    body {
        background: #ffffff !important;
        margin: 0 !important;
        padding: 0 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    img {
        image-rendering: -webkit-optimize-contrast !important;
        image-rendering: crisp-edges !important;
    }

    #kice-print-root {
        display: block !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .csat-page {
        box-shadow: none !important;
        margin: 0 !important;
        padding: 10mm 15mm !important;
        width: 210mm !important;
        min-height: auto !important;
        height: 296mm !important;
        overflow: hidden !important;
        position: relative !important;
        break-after: page !important;
        page-break-after: always !important;
    }

    .csat-page:last-child {
        break-after: auto !important;
        page-break-after: auto !important;
    }
}
#custom-alert-modal, #custom-confirm-modal, #custom-prompt-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 30000;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    background: rgba(7, 11, 20, 0.55);
}

.custom-alert-content {
    background: rgba(15, 23, 42, 0.97);
    border: 1px solid rgba(139, 92, 246, 0.25);
    border-radius: 14px;
    padding: 1.5rem 1.75rem 1.4rem;
    width: 90%;
    max-width: 320px;
    text-align: center;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
    transform: scale(0.93);
    opacity: 0;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#custom-alert-modal.show .custom-alert-content,
#custom-confirm-modal.show .custom-alert-content,
#custom-prompt-modal.show .custom-alert-content {
    transform: scale(1);
    opacity: 1;
}

.custom-alert-icon {
    margin: 0 auto 1rem;
    width: 44px;
    height: 44px;
    background: rgba(139, 92, 246, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #a78bfa;
}

.custom-alert-message {
    font-size: 0.92rem;
    color: #e2e8f0;
    margin-bottom: 1.4rem;
    line-height: 1.65;
    word-break: keep-all;
    letter-spacing: 0.01em;
}

/* ── 팝업 버튼 공통 ── */
.custom-alert-btn {
    border: none;
    padding: 7px 18px;
    border-radius: 7px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.18s;
    color: #fff;
    letter-spacing: 0.01em;
}

/* primary: 보라 (alert 확인) */
.custom-alert-btn.cmodal-btn-primary,
.custom-alert-btn:not([class*="cmodal-btn-"]) {
    background: rgba(139, 92, 246, 0.85);
}
.custom-alert-btn.cmodal-btn-primary:hover {
    background: rgba(139, 92, 246, 1);
    box-shadow: 0 3px 10px rgba(139, 92, 246, 0.4);
    transform: translateY(-1px);
}

/* safe: 시안 (저장·불러오기 등 안전한 액션) */
.custom-alert-btn.cmodal-btn-safe {
    background: rgba(6, 182, 212, 0.8);
}
.custom-alert-btn.cmodal-btn-safe:hover {
    background: rgba(6, 182, 212, 1);
    box-shadow: 0 3px 10px rgba(6, 182, 212, 0.4);
    transform: translateY(-1px);
}

/* danger: 붉은 (삭제·교체 등 위험 액션) */
.custom-alert-btn.cmodal-btn-danger {
    background: rgba(220, 38, 38, 0.82);
}
.custom-alert-btn.cmodal-btn-danger:hover {
    background: rgba(239, 68, 68, 1);
    box-shadow: 0 3px 10px rgba(239, 68, 68, 0.4);
    transform: translateY(-1px);
}

/* neutral: 회색 (취소) */
.custom-alert-btn.cmodal-btn-neutral {
    background: rgba(255, 255, 255, 0.07);
    color: #94a3b8;
    border: 1px solid rgba(255, 255, 255, 0.1);
}
.custom-alert-btn.cmodal-btn-neutral:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #cbd5e1;
    transform: translateY(-1px);
}

.custom-prompt-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    padding: 0.55rem 0.85rem;
    color: #e2e8f0;
    font-size: 0.88rem;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}
.custom-prompt-input:focus {
    border-color: rgba(139, 92, 246, 0.5);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.1);
}

/* Link Icon Styling */
.neon-link-icon {
    color: var(--accent-cyan, #06b6d4);
    filter: drop-shadow(0 0 4px rgba(6, 182, 212, 0.4));
    transition: all 0.2s ease;
}

.neon-link-icon:hover {
    color: var(--accent-magenta, #ec4899);
    filter: drop-shadow(0 0 6px rgba(236, 72, 153, 0.6));
    transform: scale(1.1);
}

/* ── Auth Modal ────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(3, 7, 18, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 20000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.modal-overlay.show {
    opacity: 1;
}

.modal-content {
    background: var(--bg-card, #141d2e);
    border: 1px solid rgba(6, 182, 212, 0.2);
    border-radius: 16px;
    padding: 2rem 2rem 1.8rem 2rem;
    width: 90%;
    max-width: 400px;
    position: relative;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6), 0 0 40px rgba(6, 182, 212, 0.05);
    transform: translateY(12px);
    transition: transform 0.25s ease;
}

.modal-overlay.show .modal-content {
    transform: translateY(0);
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: var(--text-muted, #94a3b8);
    font-size: 1.2rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--text-color, #e2e8f0);
}
/* ── 오류 신고 모달 ───────────────────────────────────── */
#error-report-overlay {
  position: fixed; inset: 0; background: rgba(7,11,20,0.85); backdrop-filter: blur(8px);
  z-index: 2000; display: none; align-items: center; justify-content: center; padding: 20px;
}
.error-modal-card {
  background: #1a1d24; border: 1px solid rgba(255,255,255,0.1); border-radius: 20px;
  width: 100%; max-width: 600px; padding: 30px;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5); position: relative; max-height: 90vh; display: flex; flex-direction: column;
}
.error-modal-close {
  position: absolute; top: 15px; right: 20px; background: none; border: none; color: #94a3b8; font-size: 1.5rem; cursor: pointer;
}
.error-modal-close:hover { color: #fff; }
.error-banner {
  background: rgba(6,182,212,0.15); color: var(--accent-cyan); padding: 12px; border-radius: 10px; font-weight: 700; text-align: center; margin-bottom: 20px; line-height: 1.6;
}
.error-row { margin-bottom: 20px; }
.error-row-title { font-size: 0.8rem; color: #94a3b8; font-weight: 700; margin-bottom: 8px; }
.error-yr-btns, .error-exam-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.yr-wrap { display: inline-flex; }
.error-split-btns { display: flex; outline: 1px solid rgba(255,255,255,0.1); border-radius: 6px; overflow: hidden; }
.split-btn { 
  background: rgba(255,255,255,0.05); color: #e2e8f0; border: none; padding: 6px 12px; font-size: 0.8rem; cursor: pointer; font-family: var(--font-sans);
  border-right: 1px solid rgba(255,255,255,0.1); transition: background 0.2s;
}
.split-btn:last-child { border-right: none; }
.split-btn:hover { background: rgba(255,255,255,0.15); }
.split-btn.selected { background: rgba(6,182,212,0.25); color: #fff; font-weight: 700; }

.error-btn {
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); color: #e2e8f0;
  padding: 6px 12px; border-radius: 6px; cursor: pointer; font-size: 0.85rem; transition: background 0.2s; font-family: var(--font-sans);
}
.error-btn:hover { background: rgba(255,255,255,0.1); }
.error-btn.selected { background: rgba(6,182,212,0.25); border-color: var(--accent-cyan); color: #fff; font-weight: 700; }
.error-grid {
  display: flex; flex-direction: column; gap: 10px; overflow-y: auto; flex: 1; padding-right: 5px;
}
.error-grid-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
.error-prob-btn {
  background: #2a2d36; border: 1px solid transparent; color: #d1d5db; 
  width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem; cursor: pointer; transition: all 0.15s; font-family: var(--font-sans); padding: 0;
}
.error-prob-btn:hover:not(.reported):not(:disabled) { background: #374151; }
.error-prob-btn.selected { background: rgba(6,182,212,0.25); border-color: var(--accent-cyan); color: #fff; font-weight: 700; }
.error-prob-btn.reported, .error-prob-btn:disabled { opacity: 0.4; cursor: not-allowed; text-decoration: line-through; }
.error-submit-btn {
  width: 100%; background: var(--accent-cyan); color: #030712; border: none; padding: 14px; border-radius: 10px;
  font-size: 1rem; font-weight: 700; cursor: pointer; margin-top: 20px; transition: opacity 0.2s; font-family: var(--font-sans);
}
.error-submit-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.error-submit-btn:not(:disabled):hover { opacity: 0.85; }
.error-hr { height: 1px; background: rgba(255,255,255,0.1); margin: 6px 0; }
.err-cart-item {
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.2);
  color: #f8fafc; font-size: 0.75rem; padding: 4px 8px; border-radius: 6px;
  display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-sans); margin-bottom: 4px;
}
.err-cart-rm {
  cursor: pointer; color: #94a3b8; font-size: 0.9rem; line-height: 1; margin-top: -2px;
}
.err-cart-rm:hover { color: #fff; }
.error-group-label { width: 70px; font-size: 0.75rem; color: #64748b; font-weight: 600; display: flex; align-items: center; justify-content: flex-end; padding-right: 6px;}

.nav-report-btn {
  margin-left: auto;
  font-size: 0.82rem; font-weight: 600; font-family: var(--font-sans);
  color: var(--text-main); background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border-color);
  padding: 0.45rem 1.1rem; border-radius: 8px; cursor: pointer;
  transition: all 0.2s;
  display: flex; align-items: center; gap: 6px;
}
.nav-report-btn:hover { background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.3); }

/* ── 문항지 세트 기능 ─────────────────────────────────────── */

/* 장바구니 패널 재편 */
.my-sets-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    width: calc(100% - 1.6rem);
    margin: 0.5rem 0.8rem 0.3rem;
    padding: 0.5rem 0.9rem;
    background: rgba(6, 182, 212, 0.08);
    border: 1px solid rgba(6, 182, 212, 0.2);
    border-radius: 8px;
    color: var(--accent-cyan);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
    text-align: left;
}
.my-sets-btn:hover { background: rgba(6, 182, 212, 0.14); }

#cart-restore-banner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.3rem 0.8rem;
    padding: 0.45rem 0.8rem;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.25);
    border-radius: 7px;
    font-size: 0.78rem;
    color: #f59e0b;
}

.cart-section-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 0.5rem 0.8rem 0.25rem;
}

.cart-items-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 0 0.5rem;
    min-height: 0;
}

.cart-footer {
    display: flex;
    gap: 0.5rem;
    padding: 0.6rem 0.8rem;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    flex-shrink: 0;
}

.cart-footer #preview-btn {
    flex: 1;
}

.cart-more-btn {
    flex-shrink: 0;
}

/* 세트 목록 뷰 */
.sets-view-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.8rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    flex-shrink: 0;
}

.sets-back-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.2rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
}
.sets-back-btn:hover { color: var(--text-color); }

.sets-view-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-color);
}

.set-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.5rem 0.4rem;
    border-radius: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    transition: background 0.12s;
}
.set-item:hover { background: rgba(255, 255, 255, 0.04); }

.set-item-main {
    flex: 1;
    cursor: pointer;
    min-width: 0;
}

.set-item-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 5px;
}

.set-item-meta {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.badge-temp {
    display: inline-block;
    padding: 1px 5px;
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border-radius: 3px;
    font-size: 0.65rem;
    font-weight: 700;
    flex-shrink: 0;
}

.set-fav-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.2);
    cursor: pointer;
    font-size: 1rem;
    padding: 0.2rem;
    line-height: 1;
    flex-shrink: 0;
    transition: color 0.15s;
}
.set-fav-btn:hover { color: #f59e0b; }
.set-fav-btn.active { color: #f59e0b; }

.set-del-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.2);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0.2rem;
    line-height: 1;
    flex-shrink: 0;
}
.set-del-btn:hover { color: #f87171; }

/* 마이페이지 모달 */
.mypage-tab {
    flex: 1;
    padding: 0.7rem;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    font-family: inherit;
    transition: color 0.15s, border-color 0.15s;
}
.mypage-tab:hover { color: var(--text-color); }
.mypage-tab.active {
    color: var(--accent-cyan);
    border-bottom-color: var(--accent-cyan);
}

/* ══════════════════════════════════════════════════════════
   모바일 UX — @media (pointer: coarse) 전용
   PC/Mac 기존 스타일에 영향 없음
   ══════════════════════════════════════════════════════════ */

/* ── Step G: PC hover 효과를 pointer:fine으로 격리 ── */
@media (pointer: fine) {
    #history-back-btn:hover,
    #history-fwd-btn:hover {
        background: rgba(217, 70, 239, 0.25) !important;
    }
    #preview-btn:hover {
        background: linear-gradient(90deg, rgba(217,70,239,0.4), rgba(6,182,212,0.4)) !important;
    }
    #cart-kebab-menu button:hover {
        background: rgba(6, 182, 212, 0.1) !important;
    }
    #cart-kebab-menu button:last-child:hover {
        background: rgba(239, 68, 68, 0.1) !important;
    }
    .step-title-clickable:hover {
        opacity: 1 !important;
    }
    .tip-modal-close-btn:hover {
        color: #f8fafc !important;
    }
}

/* Inspector 패널은 터치 기기 전용 — PC에서 노출 방지 */
#inspector-panel { display: none; }

@media (pointer: coarse) {
    /* ── Step A: 기존 fixed 요소 숨김 ── */
    #global-actions-left,
    #auth-app-section {
        display: none !important;
    }

    /* 브랜드 타이틀 숨김 */
    .brand-container {
        display: none;
    }

    /* 헤더 상단 여백 — 앱바가 일반 흐름에 포함되므로 별도 여백 불필요 */
    .top-nav-container {
        gap: 1rem;
        padding-left: 0.8rem;
        padding-right: 0.8rem;
    }

    /* 오류 신고 버튼: 모바일에서 레이아웃 깨짐 방지 */
    .nav-report-btn {
        display: none !important;
    }

    /* ── Step A: 앱바 (일반 흐름, 스크롤 시 밀려남) ── */
    .mobile-appbar {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        position: static;
        height: 48px;
        padding: 0 1rem;
        background: var(--bg-surface);
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        border-bottom: 1px solid var(--border-color);
        box-sizing: border-box;
    }

    .mobile-appbar-logo {
        font-family: 'Paperozi', sans-serif;
        font-size: 1.4rem;
        font-weight: 900;
        letter-spacing: -1px;
        color: var(--text-main);
    }
    .mobile-appbar-logo span {
        color: var(--accent-cyan);
    }

    .mobile-appbar-login-btn {
        background: rgba(255, 255, 255, 0.08);
        border: 1px solid rgba(255, 255, 255, 0.12);
        color: var(--text-main);
        padding: 0.3rem 0.85rem;
        border-radius: 8px;
        cursor: pointer;
        font-size: 0.8rem;
        font-weight: 600;
        font-family: inherit;
    }

    /* ── Step B: 검색 탭 + 검색창 ── */
    .search-pill {
        padding: 0.5rem 0.75rem;
        font-size: 0.82rem;
    }

    .huge-search-input {
        padding: 0.9rem 3.5rem 0.9rem 1.2rem;
        font-size: 1rem;
        border-radius: 14px;
    }

    .search-icon-btn {
        right: 1rem;
    }

    .huge-search-wrapper {
        max-width: 100%;
    }

    .main-content {
        padding: 0.5rem 0.8rem 6rem 0.8rem;
    }

    /* ── Step D: 장바구니 — 사이드바 → 바텀시트 ── */
    #problem-cart {
        top: auto !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        height: 70vh;
        height: 70dvh;
        transform: translateY(100%) !important;
        border-left: none !important;
        border-top: 1px solid var(--border-color);
        border-radius: 20px 20px 0 0;
        padding: 1.2rem 1rem 2rem 1rem !important;
        z-index: 9000;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }

    #problem-cart.open {
        transform: translateY(0) !important;
    }

    #cart-toggle-btn {
        display: none !important;
    }

    /* ── Step D: FAB ── */
    #cart-fab {
        display: flex;
        position: fixed;
        bottom: 1.5rem;
        right: 1.2rem;
        width: 42px;
        height: 42px;
        border-radius: 50%;
        background: var(--accent-cyan);
        color: #030712;
        border: none;
        cursor: pointer;
        align-items: center;
        justify-content: center;
        font-size: 1.1rem;
        box-shadow: 0 3px 12px rgba(6, 182, 212, 0.45);
        z-index: 10000;
        transition: transform 0.18s;
    }

    #cart-fab:active {
        transform: scale(0.90);
    }

    #cart-fab-badge {
        position: absolute;
        top: -4px;
        right: -4px;
        background: var(--accent-magenta);
        color: #fff;
        border-radius: 999px;
        font-size: 0.68rem;
        font-weight: 700;
        min-width: 18px;
        height: 18px;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0 4px;
        pointer-events: none;
    }

    /* ── Step C: Inspector 패널 ── */
    #inspector-panel {
        display: block;
        position: fixed;
        bottom: 0; left: 0; right: 0;
        max-height: 55vh;
        max-height: 55dvh;
        background: var(--bg-surface);
        border-top: 1px solid var(--border-color);
        border-radius: 16px 16px 0 0;
        z-index: 9500;
        overflow-y: auto;
        overflow-x: hidden;
        padding: 0 1rem 2rem 1rem;
        transform: translateY(100%);
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
                    max-height 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        -webkit-overflow-scrolling: touch;
    }

    #inspector-panel.open {
        transform: translateY(0);
    }

    /* 확장 모드: 최대 높이로 늘리고 내부 스크롤 허용 */
    #inspector-panel.expanded {
        max-height: 88vh;
        max-height: 88dvh;
        overflow-y: auto;
    }

    /* 드래그 핸들 */
    #inspector-drag-handle {
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 1rem 0 0.6rem;
        cursor: grab;
        touch-action: none;
    }

    #inspector-drag-bar {
        width: 44px;
        height: 5px;
        background: rgba(255, 255, 255, 0.25);
        border-radius: 999px;
    }

    #inspector-panel-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 0.7rem;
        padding: 0.3rem 0 0.6rem;
        border-bottom: 1px solid var(--border-color);
        position: sticky;
        top: 0;
        background: var(--bg-surface);
        touch-action: none;
        z-index: 1;
    }

    #inspector-panel-title {
        font-size: 0.82rem;
        color: var(--text-muted);
        flex: 1;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        padding-right: 0.5rem;
    }

    /* 장바구니 아이콘 버튼 */
    #inspector-cart-btn {
        background: none;
        border: none;
        color: var(--text-muted);
        cursor: pointer;
        padding: 0.25rem;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 6px;
        flex-shrink: 0;
        transition: color 0.15s, background 0.15s;
    }

    #inspector-cart-btn:active {
        background: rgba(255, 255, 255, 0.08);
    }

    #inspector-panel-body {
        font-size: 0.88rem;
        line-height: 1.7;
        color: var(--text-main);
    }

    /* Inspector 안의 이미지: 좁은 폰 세로 모드에서만 너비 제한 */
    #inspector-panel-body img {
        height: auto;
        display: block;
        border-radius: 6px;
    }
}

/* 좁은 폰 세로 모드: 이미지 화면 너비 안으로 제한 */
@media (pointer: coarse) and (max-width: 767px) and (orientation: portrait) {
    #inspector-panel-body img {
        max-width: 100%;
    }
}

/* 아이패드 or 가로 모드: 원본 크기 허용, 패널 내 가로 스크롤 */
@media (pointer: coarse) and (min-width: 768px),
       (pointer: coarse) and (orientation: landscape) {
    #inspector-panel-body img {
        max-width: none;
        width: auto;
    }
    #inspector-panel {
        overflow-x: auto;
    }
}

@media (pointer: coarse) {

    /* ── Step E: 성취기준 split-pane → 탭 전환 ── */
    .split-pane-layout.active {
        display: flex !important;
        flex-direction: column;
        height: auto;
        gap: 0;
    }

    .split-pane-layout .pane-box {
        border-radius: 0;
        min-height: 350px;
    }

    .split-pane-layout .pane-box:first-child {
        border-radius: 12px 12px 0 0;
        border-bottom: none;
    }

    .split-pane-layout .pane-box:last-child {
        border-radius: 0 0 12px 12px;
    }

    .split-pane-layout .pane-box.mobile-hidden {
        display: none !important;
    }

    .mobile-split-tabs {
        display: flex;
        background: var(--bg-surface);
        border: 1px solid var(--border-color);
        border-top: none;
        border-bottom: none;
    }

    .mobile-split-tab {
        flex: 1;
        padding: 0.6rem;
        text-align: center;
        font-size: 0.85rem;
        color: var(--text-muted);
        cursor: pointer;
        border: none;
        background: none;
        border-bottom: 2px solid transparent;
        font-family: inherit;
        transition: color 0.15s, border-color 0.15s;
    }

    .mobile-split-tab.active {
        color: var(--accent-cyan);
        border-bottom-color: var(--accent-cyan);
    }

    /* ── Step F: 통계 카드 4열 → 2열 ── */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* ── Step H: .glass backdrop-filter 제거 (iOS fixed 버그 방지) ── */
    .glass {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }

    /* ── 3번: 바텀시트 불투명도 ── */
    #inspector-panel {
        background: rgba(10, 14, 26, 0.97) !important;
        border-top: 1px solid rgba(6, 182, 212, 0.2);
    }

    #problem-cart {
        background: rgba(10, 14, 26, 0.97) !important;
        border-top: 1px solid rgba(6, 182, 212, 0.2) !important;
    }

    /* ── 2번: 검색결과 카드 뷰 ── */
    .mobile-card-list {
        display: flex;
        flex-direction: column;
        gap: 0.55rem;
    }

    .result-card {
        background: var(--bg-surface);
        border: 1px solid var(--border-color);
        border-top: 1px solid rgba(255, 255, 255, 0.12);
        border-radius: 12px;
        padding: 0.8rem 0.9rem;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    }

    .result-card-header {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        margin-bottom: 0.55rem;
        padding-bottom: 0.5rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
        flex-wrap: wrap;
    }

    .result-card-pid {
        font-family: 'Courier New', monospace;
        font-weight: 700;
        font-size: 0.88rem;
        color: var(--text-main);
        background: rgba(255, 255, 255, 0.06);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 6px;
        padding: 0.25rem 0.65rem;
        cursor: pointer;
        user-select: none;
        transition: background 0.15s, border-color 0.15s;
    }

    .result-card-pid:active {
        background: rgba(6, 182, 212, 0.15);
        border-color: var(--accent-cyan);
    }

    .result-card-pid.in-cart {
        background: rgba(6, 182, 212, 0.12);
        border-color: rgba(6, 182, 212, 0.4);
        color: var(--accent-cyan);
    }

    .result-card-score {
        font-size: 0.7rem;
        color: var(--text-muted);
        margin-left: auto;
    }

    .result-card-steps {
        display: flex;
        flex-direction: column;
        gap: 0;
    }

    .result-card-step {
        display: flex;
        align-items: flex-start;
        gap: 0.5rem;
        padding: 0.45rem 0.3rem;
        font-size: 0.84rem;
        border-radius: 6px;
        cursor: pointer;
        border-bottom: 1px solid rgba(255, 255, 255, 0.04);
        line-height: 1.45;
        transition: background 0.12s;
    }

    .result-card-step:last-child {
        border-bottom: none;
    }

    .result-card-step:active {
        background: rgba(255, 255, 255, 0.06);
    }

    .result-card-step-num {
        font-size: 0.72rem;
        color: var(--accent-magenta);
        min-width: 22px;
        text-align: right;
        flex-shrink: 0;
        padding-top: 1px;
        font-weight: 600;
    }

    .result-card-step-link {
        color: var(--accent-magenta);
        opacity: 0.6;
        cursor: pointer;
        flex-shrink: 0;
        padding-top: 2px;
    }

    /* ── 인쇄 미리보기: 모바일에서 full-screen ── */
    #print-preview-header {
        position: fixed;
        top: 0; left: 0; right: 0;
        z-index: 11000;
        overflow-x: auto;
    }

    /* ── 기출표현 검색결과: 컬럼 헤더 숨김 ── */
    #expression-col-header {
        display: none !important;
    }

    /* ── 기출표현 카드: 세로 레이아웃 ── */
    .expression-result-card {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 6px !important;
        padding: 12px 14px !important;
    }

    .expression-result-card .exp-pid-span {
        width: auto !important;
        min-width: unset !important;
        font-size: 0.78rem !important;
    }

    .expression-result-card .exp-text-span {
        font-size: 0.88rem !important;
        min-width: 0 !important;
        width: 100% !important;
    }
}


/* ── 이메일 인증 배너 ────────────────────────────────────────── */
#sticky-bars {
    position: sticky;
    top: 0;
    z-index: 9999;
}

#global-actions-left,
#auth-app-section {
    top: 1.2rem;
}

@media (pointer: fine) {
    #sticky-bars {
        padding-top: 4.5rem;
        position: relative;
    }
}

#verify-banner {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.6rem 1rem;
    background: linear-gradient(90deg, rgba(245,158,11,0.18), rgba(245,158,11,0.1));
    border-bottom: 1px solid rgba(245,158,11,0.4);
    font-size: 0.82rem;
    flex-wrap: wrap;
    box-sizing: border-box;
}
.verify-banner-msg {
    flex: 1;
    color: #fcd34d;
    min-width: 0;
}
.verify-banner-link {
    color: #06b6d4;
    font-weight: 700;
    text-decoration: underline;
    white-space: nowrap;
    cursor: pointer;
}
.verify-banner-close {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0 0.2rem;
    line-height: 1;
}

/* ── 게시판 ────────────────────────────────────────────── */
.board-filter-pill {
  padding: 0.28rem 0.75rem;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.18s;
}
.board-filter-pill:hover { background: rgba(255,255,255,0.09); color: var(--text-color); }
.board-filter-pill.active { background: rgba(6,182,212,0.15); border-color: rgba(6,182,212,0.4); color: #67e8f9; }

#board-table td { padding: 0.6rem 0.5rem; border-bottom: 1px solid rgba(255,255,255,0.05); vertical-align: middle; }
#board-table tr:last-child td { border-bottom: none; }
#board-table tr:not(.board-notice-row):hover td { background: rgba(255,255,255,0.03); }
#board-table tr { cursor: pointer; }
.board-notice-row td { background: rgba(6,182,212,0.04); font-weight: 600; }
.board-type-badge {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  white-space: nowrap;
}
.board-type-notice { background: rgba(6,182,212,0.15); color: #67e8f9; }
.board-type-edit   { background: rgba(168,85,247,0.15); color: #c084fc; }
.board-type-question { background: rgba(250,204,21,0.12); color: #fde047; }
.board-type-error  { background: rgba(239,68,68,0.12); color: #f87171; }

.board-page-btn {
  padding: 0.3rem 0.65rem;
  border-radius: 6px;
  font-size: 0.78rem;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
  color: var(--text-muted);
  cursor: pointer;
}
.board-page-btn.active { background: rgba(6,182,212,0.15); border-color: rgba(6,182,212,0.35); color: #67e8f9; }

.board-write-btn {
  padding: 0.32rem 0.85rem;
  border-radius: 7px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s;
}

/* 댓글 */
.bd-comment { background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06); border-radius: 9px; padding: 0.7rem 0.9rem; }
.bd-reply   { background: rgba(255,255,255,0.015); border: 1px solid rgba(255,255,255,0.04); border-radius: 8px; padding: 0.6rem 0.8rem; margin-top: 0.4rem; margin-left: 1.5rem; }
.bd-comment-meta { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 0.3rem; display: flex; align-items:center; gap: 0.6rem; }
.bd-comment-content { font-size: 0.85rem; line-height: 1.6; white-space: pre-wrap; }
.bd-reply-btn { background: none; border: none; color: var(--text-muted); font-size: 0.75rem; cursor: pointer; padding: 0; text-decoration: underline; }
.bd-del-btn { background: none; border: none; color: #f87171; font-size: 0.75rem; cursor: pointer; padding: 0; }

/* 아코디언 활성 행 */
.board-row-active td { background: rgba(6,182,212,0.06) !important; }
#board-accordion-row td { cursor: default; }
#board-accordion-inner { transition: max-height 0.3s ease; }
