/* ==================== CSS Variables (Light Theme) ==================== */
:root {
    --bg-body-start: #f0f4f8;
    --bg-body-end: #e2e8f0;
    --bg-card: #ffffff;
    --bg-card-alt: #f7fafc;
    --bg-input: #ffffff;
    --bg-input-alt: #edf2f7;
    --bg-table-header: #edf2f7;
    --bg-table-stripe-odd: #ffffff;
    --bg-table-stripe-even: #fafafa;
    --bg-upload: #f7fafc;
    --bg-field-group: #f7fafc;
    --bg-msg-ok: #c6f6d5;
    --bg-msg-err: #fed7d7;
    --bg-msg-warn: #feebc8;
    --bg-tooltip: #2d3748;
    --bg-floating-header: #4299e1;
    --text-primary: #2d3748;
    --text-secondary: #718096;
    --text-muted: #a0aec0;
    --text-heading: #1a202c;
    --text-msg-ok: #22543d;
    --text-msg-err: #742a2a;
    --text-msg-warn: #744210;
    --text-on-accent: #ffffff;
    --border-color: #cbd5e0;
    --border-light: #e2e8f0;
    --border-input: #cbd5e0;
    --accent: #4299e1;
    --accent-hover: #3182ce;
    --accent-light: rgba(66, 153, 225, 0.1);
    --danger: #f56565;
    --danger-hover: #e53e3e;
    --success: #48bb78;
    --success-hover: #38a169;
    --warning: #ed8936;
    --warning-hover: #dd6b20;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --font-mono: 'Consolas', 'Monaco', 'Courier New', monospace;
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* ==================== Dark Theme ==================== */
[data-theme="dark"] {
    --bg-body-start: #0f172a;
    --bg-body-end: #1e293b;
    --bg-card: #1e293b;
    --bg-card-alt: #273548;
    --bg-input: #1a2332;
    --bg-input-alt: #1e293b;
    --bg-table-header: #1a2332;
    --bg-table-stripe-odd: #1e293b;
    --bg-table-stripe-even: #223048;
    --bg-upload: #1a2332;
    --bg-field-group: #1a2332;
    --bg-msg-ok: #14532d;
    --bg-msg-err: #450a0a;
    --bg-msg-warn: #451a03;
    --bg-tooltip: #0f172a;
    --bg-floating-header: #2d6aa0;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-heading: #f1f5f9;
    --text-msg-ok: #bbf7d0;
    --text-msg-err: #fecaca;
    --text-msg-warn: #fed7aa;
    --text-on-accent: #ffffff;
    --border-color: #334155;
    --border-light: #273548;
    --border-input: #334155;
    --accent: #60a5fa;
    --accent-hover: #3b82f6;
    --accent-light: rgba(59, 130, 246, 0.15);
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
}

/* ==================== Reset & Base ==================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background: linear-gradient(135deg, var(--bg-body-start) 0%, var(--bg-body-end) 100%);
    color: var(--text-primary);
    padding: 40px 60px;
    min-height: 100vh;
    line-height: 1.5;
    margin-left: 0;
    transition: background 0.3s ease, color 0.3s ease;
}

/* ==================== Theme Switcher ==================== */
#theme-switcher {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--bg-card);
    border-radius: 24px;
    padding: 8px;
    box-shadow: var(--shadow);
    display: flex;
    gap: 8px;
    z-index: 1000;
    transition: background 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid var(--border-color);
}

.theme-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    background: transparent;
}

.theme-btn:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-hover);
}

.theme-btn.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(66, 153, 225, 0.2);
}

.theme-btn[data-theme="light"] {
    background: linear-gradient(135deg, #b8ddf5 0%, #ecc9dd 100%);
}

.theme-btn[data-theme="dark"] {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ==================== Brand Watermark ==================== */
.title-brand-wrap {
    position: relative;
}

.brand-watermark {
    display: inline-block;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-decoration: none;
    color: var(--accent);
    background: var(--accent-light);
    border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
    border-radius: 999px;
    padding: 4px 12px;
    margin-bottom: 12px;
    transition: all 0.2s ease;
}

.brand-watermark:hover {
    color: var(--accent-hover);
    background: color-mix(in srgb, var(--accent) 18%, var(--bg-card));
}

code {
    background: var(--bg-input-alt);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: #c53030;
    border: 1px solid var(--border-color);
}

[data-theme="dark"] code {
    color: #f87171;
}

small {
    line-height: 1.4;
}

/* ==================== Typography ==================== */
h1 {
    text-align: center;
    margin-bottom: 8px;
    color: var(--text-heading);
    font-size: 32px;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 32px;
    font-weight: 400;
}

/* ==================== Layout ==================== */
.container {
    max-width: 1700px;
    margin: 0 auto;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.card.card-compact {
    padding: 16px 24px;
}

.card-title {
    color: var(--text-primary);
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-compact .card-title {
    margin-bottom: 12px;
}

.card-title .badge {
    background: var(--accent);
    color: var(--text-on-accent);
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 12px;
    font-weight: 600;
}

/* ==================== Buttons ==================== */
button {
    padding: 8px 18px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    letter-spacing: -0.2px;
    background: var(--bg-input-alt);
    color: var(--text-primary);
}

button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-teal {
    background: var(--accent);
    color: #ffffff;
}

.btn-teal:hover:not(:disabled) {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(66, 153, 225, 0.3);
}

.btn-blue {
    background: var(--accent);
    color: #ffffff;
}

.btn-blue:hover:not(:disabled) {
    background: var(--accent-hover);
    box-shadow: 0 4px 12px rgba(66, 153, 225, 0.3);
}

.btn-green {
    background: var(--success);
    color: #ffffff;
}

.btn-green:hover:not(:disabled) {
    background: var(--success-hover);
    box-shadow: 0 4px 12px rgba(72, 187, 120, 0.3);
}

.btn-orange {
    background: var(--warning);
    color: #ffffff;
}

.btn-orange:hover:not(:disabled) {
    background: var(--warning-hover);
    box-shadow: 0 4px 12px rgba(237, 137, 54, 0.3);
}

.btn-gray {
    background: var(--bg-input-alt);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-gray:hover:not(:disabled) {
    background: var(--border-light);
}

.btn-red {
    background: var(--danger);
    color: #ffffff;
}

.btn-red:hover:not(:disabled) {
    background: var(--danger-hover);
    box-shadow: 0 4px 12px rgba(245, 101, 101, 0.3);
}

.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
}

.btn-icon {
    padding: 4px 10px;
    font-size: 14px;
    line-height: 1;
}

.btn-xs {
    padding: 3px 8px;
    font-size: 10px;
}

.btn-purple {
    background: #718096;
    color: #ffffff;
}

.btn-purple:hover:not(:disabled) {
    background: #4a5568;
    box-shadow: 0 4px 12px rgba(113, 128, 150, 0.3);
}

/* ==================== Forms ==================== */
.disk-config-row {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    flex-wrap: wrap;
    min-height: auto;
}

.disk-config-form {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    align-items: flex-end;
    flex: 1;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    letter-spacing: -0.2px;
}

.label-with-tooltip {
    display: flex;
    align-items: center;
    gap: 4px;
}

.tooltip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    color: #ffffff;
    font-size: 11px;
    cursor: help;
    position: relative;
}

.tooltip-icon:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-tooltip);
    color: #ffffff;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 11px;
    white-space: pre-line;
    z-index: 1000;
    pointer-events: none;
    font-weight: 400;
    letter-spacing: 0;
    line-height: 1.5;
    min-width: 280px;
    text-align: left;
    box-shadow: var(--shadow-lg);
}

.tooltip-icon:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--bg-tooltip);
    z-index: 1000;
}

.form-group input,
.form-group select {
    padding: 9px 12px;
    border: 1px solid var(--border-input);
    border-radius: 8px;
    font-size: 14px;
    background: var(--bg-input);
    color: var(--text-primary);
    transition: all 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.form-group input[type="text"] {
    width: 100%;
}

.form-group select {
    min-width: 100%;
    width: 100%;
}

.form-group input::placeholder {
    color: var(--text-muted);
}

/* ==================== Partition Table ==================== */
.partition-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.partition-table th {
    background: var(--bg-table-header);
    color: var(--text-primary);
    padding: 12px 10px;
    text-align: left;
    white-space: nowrap;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: -0.2px;
    position: sticky;
    top: 0;
    border: none;
    z-index: 10;
    border-bottom: 1px solid var(--border-color);
}

.partition-table td {
    padding: 10px 10px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.partition-table tbody tr {
    transition: all 0.2s;
    position: relative;
    border-left: 4px solid transparent;
}

.partition-table tbody tr:hover {
    background: var(--bg-card-alt);
}

.partition-table input,
.partition-table select {
    padding: 7px 10px;
    border: 1px solid var(--border-input);
    border-radius: 6px;
    font-size: 13px;
    background: var(--bg-input);
    color: var(--text-primary);
    transition: all 0.2s;
}

.partition-table input:focus,
.partition-table select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.partition-table .col-num {
    width: 30px;
    text-align: center;
    font-weight: 600;
    color: var(--text-secondary);
}

.partition-table .col-name input {
    width: 100px;
}

.partition-table .col-name input::placeholder {
    color: var(--text-muted);
    font-style: italic;
}

.partition-table .col-start input {
    width: 75px;
}

.partition-table .col-size input {
    width: 65px;
}

.partition-table .col-start select,
.partition-table .col-size select {
    width: 52px;
    padding: 5px;
    border: 1px solid var(--border-input);
    border-radius: 6px;
    font-size: 11px;
    background: var(--bg-input);
    color: var(--text-primary);
}

.partition-table .col-type select {
    width: 140px;
}

.partition-table .col-format select {
    width: 60px;
}

.partition-table .col-uuid {
    width: 165px;
}

.partition-table .col-uuid input {
    width: 155px;
    font-size: 11px;
    font-family: 'SF Mono', 'Monaco', 'Courier New', monospace;
}

.partition-table .col-actions {
    width: 90px;
    text-align: center;
    white-space: nowrap;
}

.partition-wrapper {
    max-height: 420px;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
}

.partition-wrapper::-webkit-scrollbar {
    width: 10px;
}

.partition-wrapper::-webkit-scrollbar-track {
    background: var(--bg-input-alt);
    border-radius: 5px;
}

.partition-wrapper::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 5px;
}

.partition-wrapper::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ==================== Disk Visualization ==================== */
.disk-bar-container {
    margin-top: 18px;
}

.disk-bar {
    display: flex;
    height: 36px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    background: var(--bg-input-alt);
}

.disk-bar-seg {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: #ffffff;
    font-weight: 600;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    min-width: 2px;
    transition: all 0.2s;
}

.disk-bar-seg:hover {
    opacity: 0.85;
    z-index: 1;
    transform: scaleY(1.05);
}

.disk-bar-free {
    height: 100%;
    background: var(--bg-input-alt);
}

.disk-bar-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 12px;
    font-size: 13px;
}

.disk-bar-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
}

.disk-bar-legend-color {
    width: 16px;
    height: 16px;
    border-radius: 4px;
}

/* ==================== JSON Panel ==================== */
.json-panel {
    margin-top: 12px;
}

.json-panel textarea {
    width: 100%;
    height: 200px;
    background: var(--bg-input-alt);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 14px;
    font-family: var(--font-mono);
    font-size: 12px;
    resize: vertical;
    transition: all 0.2s;
}

.json-panel textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

/* ==================== Messages ==================== */
.msg {
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
    margin-bottom: 12px;
    font-weight: 500;
}

.msg code {
    background: rgba(0, 0, 0, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 11px;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.msg-ok {
    background: var(--bg-msg-ok);
    color: var(--text-msg-ok);
    border: 1px solid #9ae6b4;
}

[data-theme="dark"] .msg-ok {
    border-color: #166534;
}

.msg-err {
    background: var(--bg-msg-err);
    color: var(--text-msg-err);
    border: 1px solid #fc8181;
}

[data-theme="dark"] .msg-err {
    border-color: #7f1d1d;
}

.msg-warn {
    background: var(--bg-msg-warn);
    color: var(--text-msg-warn);
    border: 1px solid #f6ad55;
}

[data-theme="dark"] .msg-warn {
    border-color: #78350f;
}

/* ==================== Stats ==================== */
.stats {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.stat {
    background: var(--accent);
    color: #ffffff;
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(66, 153, 225, 0.2);
}

/* ==================== Utilities ==================== */
.hidden {
    display: none;
}

.collapsible-trigger {
    cursor: pointer;
    user-select: none;
}

.collapsible-trigger:hover {
    opacity: 0.8;
}

.collapse-icon {
    display: inline-block;
    transition: transform 0.15s;
    margin-right: 4px;
}

.collapse-icon.collapsed {
    transform: rotate(-90deg);
}

.col-addr {
    font-size: 11px;
    color: var(--accent);
    font-family: var(--font-mono);
    white-space: nowrap;
    font-weight: 600;
}

.warn-emoji {
    margin-left: 2px;
    font-size: 13px;
    cursor: help;
}

/* ==================== Tabs ==================== */
.tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    justify-content: center;
}

.tab {
    padding: 12px 24px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: -0.3px;
    min-width: 200px;
    text-align: center;
}

.tab:hover {
    color: var(--text-primary);
    background: var(--accent-light);
}

.tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    font-weight: 600;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ==================== Parser Layout ==================== */
.parser-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    height: calc(100vh - 300px);
    min-height: 600px;
}

.hex-viewer-panel,
.fields-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px;
    overflow-y: auto;
}

/* ==================== Hex Viewer ==================== */
.hex-viewer {
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.6;
    min-width: 800px;
}

.hex-viewer-panel {
    overflow-x: auto;
}

.hex-line {
    display: flex;
    gap: 12px;
    margin-bottom: 4px;
    padding: 2px 4px;
    border-radius: 6px;
    transition: all 0.15s;
    min-width: 750px;
    white-space: nowrap;
}

.hex-offset {
    color: var(--text-secondary);
    font-weight: 600;
    min-width: 80px;
    flex-shrink: 0;
}

.hex-bytes {
    color: var(--text-primary);
    letter-spacing: 1px;
    display: flex;
    gap: 0;
    flex-wrap: nowrap;
    min-width: 480px;
    flex-shrink: 0;
}

.hex-byte {
    padding: 0 1px;
    cursor: pointer;
    transition: all 0.1s;
}

.hex-byte:hover {
    background: var(--bg-input-alt);
}

.hex-byte.highlighted {
    background: var(--accent);
    color: #ffffff;
    font-weight: 600;
    border-radius: 3px;
    padding: 0 2px;
}

.hex-ascii {
    color: var(--text-muted);
    min-width: 180px;
    flex-shrink: 0;
}

/* ==================== Field Groups ==================== */
.field-group {
    margin-bottom: 16px;
    padding: 14px;
    background: var(--bg-field-group);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    transition: all 0.2s;
}

.field-group:hover {
    border-color: var(--border-color);
    box-shadow: var(--shadow);
}

.field-group.active {
    border-color: var(--accent);
    background: var(--accent-light);
}

[data-theme="dark"] .field-group.active {
    background: rgba(59, 130, 246, 0.12);
}

.field-group-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.field-group-title:hover {
    color: var(--accent);
}

.field-group-content {
    overflow: hidden;
}

.field-group-content.collapsed {
    display: none;
}

.field-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 10px;
    font-size: 13px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    margin-bottom: 2px;
}

.field-item:nth-child(odd) {
    background: var(--bg-table-stripe-odd);
}

.field-item:nth-child(even) {
    background: var(--bg-table-stripe-even);
}

.field-item:hover {
    background: var(--accent-light);
    transform: translateX(2px);
}

.field-item.selected {
    background: var(--accent-light);
    border-left: 3px solid var(--accent);
    padding-left: 7px;
    box-shadow: 0 2px 6px rgba(66, 153, 225, 0.15);
}

.field-name {
    color: var(--text-secondary);
    font-weight: 500;
    cursor: help;
}

.field-size {
    color: var(--text-muted);
    font-size: 11px;
    margin-left: 6px;
    font-weight: 400;
}

.field-value {
    color: var(--text-primary);
    font-family: var(--font-mono);
    word-break: break-all;
    font-weight: 500;
}

/* ==================== Upload Area ==================== */
.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px;
    text-align: center;
    background: var(--bg-upload);
    margin-bottom: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.upload-area:hover {
    background: var(--bg-card-alt);
    border-color: var(--accent);
}

.upload-area.dragover {
    background: var(--accent-light);
    border-color: var(--accent);
}

.upload-area.compact {
    padding: 12px 20px;
    border-width: 1px;
    border-style: solid;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.upload-area.compact h3 {
    font-size: 14px;
    margin: 0;
    font-weight: 500;
}

.upload-area.compact p {
    display: none;
}

/* ==================== Responsive ==================== */
@media (max-width: 1400px) {
    .disk-config-form {
        grid-template-columns: repeat(3, 1fr);
    }

    .hex-ascii {
        display: none;
    }

    .hex-viewer {
        min-width: 600px;
    }

    .hex-line {
        min-width: 550px;
    }

    .hex-bytes {
        min-width: 450px;
    }
}

@media (max-width: 1100px) {
    .parser-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto;
        height: auto;
    }

    .hex-viewer-panel {
        max-height: 500px;
    }

    .fields-panel {
        max-height: 600px;
    }
}

@media (max-width: 900px) {
    body {
        padding: 70px 20px 30px;
    }

    .disk-config-form {
        grid-template-columns: repeat(2, 1fr);
    }

    .partition-table {
        font-size: 12px;
    }

    .partition-table .col-type select {
        width: 100px;
    }

    .partition-table .col-uuid {
        width: auto;
    }

    .partition-table .col-uuid input {
        width: 100px;
    }

    .tabs {
        flex-wrap: wrap;
    }

    .tab {
        min-width: auto;
        flex: 1;
    }
}

@media (max-width: 600px) {
    body {
        padding: 60px 8px 16px;
    }

    h1 {
        font-size: 22px;
    }

    .subtitle {
        font-size: 12px;
        margin-bottom: 20px;
    }

    .disk-config-form {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .card {
        padding: 14px;
    }

    .card.card-compact {
        padding: 10px 14px;
    }

    .card-title {
        font-size: 15px;
        flex-wrap: wrap;
    }

    .partition-wrapper {
        max-height: 300px;
        border-radius: 8px;
    }

    .partition-table {
        font-size: 11px;
    }

    .partition-table th,
    .partition-table td {
        padding: 5px 4px;
    }

    .partition-table .col-start input,
    .partition-table .col-size input {
        width: 42px;
        font-size: 11px;
    }

    .partition-table .col-size select,
    .partition-table .col-start select {
        width: 40px;
        font-size: 10px;
        padding: 4px;
    }

    .partition-table .col-type select {
        width: 70px;
        font-size: 11px;
    }

    .partition-table .col-format select {
        width: 46px;
        font-size: 11px;
    }

    .partition-table .col-uuid input {
        width: 55px;
        font-size: 9px;
    }

    .partition-table .col-name input {
        width: 60px;
    }

    .partition-table .col-actions {
        width: auto;
    }

    .partition-table .col-uuid {
        width: auto;
    }

    .btn-icon {
        padding: 2px 5px;
        font-size: 10px;
    }

    .tab {
        padding: 10px 12px;
        font-size: 12px;
        min-width: auto;
        flex: 1;
    }

    .parser-layout {
        min-height: auto;
    }

    .upload-area {
        padding: 20px 12px;
    }

    .upload-area h3 {
        font-size: 14px;
    }

    .disk-bar {
        height: 28px;
    }

    .disk-bar-seg {
        font-size: 9px;
    }

    .disk-bar-legend {
        font-size: 11px;
        gap: 8px;
    }

    .stat {
        font-size: 11px;
        padding: 5px 10px;
    }

    #theme-switcher {
        top: 8px;
        right: 8px;
        padding: 4px 6px;
        gap: 4px;
        border-radius: 16px;
    }

    .theme-btn {
        width: 30px;
        height: 30px;
        font-size: 13px;
    }

    .brand-watermark {
        font-size: 11px;
        padding: 2px 8px;
        margin-bottom: 8px;
    }
}

@media (max-width: 400px) {
    body {
        padding: 55px 4px 12px;
    }

    h1 {
        font-size: 19px;
    }

    .card {
        padding: 10px;
        border-radius: 10px;
        margin-bottom: 10px;
    }

    .card.card-compact {
        padding: 8px 10px;
    }

    .disk-config-form {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .tabs {
        margin-bottom: 12px;
    }

    .tab {
        padding: 8px 10px;
        font-size: 11px;
    }

    .partition-table {
        font-size: 10px;
    }

    .partition-table th {
        font-size: 10px;
    }

    .partition-table .col-start input,
    .partition-table .col-size input {
        width: 36px;
        font-size: 10px;
        padding: 4px 5px;
    }

    .partition-table .col-start select,
    .partition-table .col-size select {
        width: 34px;
        font-size: 9px;
    }

    .partition-table .col-type select {
        width: 60px;
        font-size: 10px;
    }

    .partition-table .col-uuid input {
        width: 44px;
        font-size: 8px;
    }

    .partition-table .col-name input {
        width: 48px;
    }

    .btn-icon {
        padding: 2px 4px;
        font-size: 9px;
    }

    .btn-sm {
        padding: 4px 8px;
        font-size: 10px;
    }

    .btn-xs {
        padding: 2px 5px;
        font-size: 9px;
    }

    .upload-area {
        padding: 16px 10px;
    }
}
