/* QL-Animation Studio Styles */

:root {
    --sidebar-width: 525px;
}

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

body {
    font-family: Roboto, 'Noto Sans JP', 'Noto Sans KR', 'Noto Sans SC', 'Noto Sans Symbols', 'Noto Color Emoji', sans-serif;
    height: 100vh;
    overflow: hidden;
    transition: background-color 0.3s, color 0.3s;
    background-color: var(--studio-bg);
    color: var(--md-sys-color-on-surface);
}

body.theme-dark {
    --studio-bg: var(--md-sys-color-surface-container-low);
    --editor-bg: #1e1e1e;
    --editor-text: #d4d4d4;
    --editor-header: #333;
    --editor-border: #444;
    --accent-color: var(--md-sys-color-primary);
    --preview-bg: #000;
}

body.theme-light {
    --studio-bg: var(--md-sys-color-surface-container-low);
    --editor-bg: #fff;
    --editor-text: #000;
    --editor-header: #f3f3f3;
    --editor-border: #ccc;
    --accent-color: var(--md-sys-color-primary);
    --preview-bg: #fff;
}

button, input, select, textarea {
    font-family: inherit;
}

button {
    cursor: pointer;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.primary-btn, .secondary-btn, .tertiary-btn, .danger-btn {
    padding: 12px 24px;
    border-radius: var(--md-sys-shape-full);
    font-weight: 500;
    font-size: 0.9rem;
}

.primary-btn {
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
}

.secondary-btn {
    background-color: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
}

.tertiary-btn {
    background-color: var(--md-sys-color-tertiary-container);
    color: var(--md-sys-color-on-tertiary-container);
}

.danger-btn {
    background-color: var(--md-sys-color-error);
    color: var(--md-sys-color-on-error);
}

.primary-btn:hover, .secondary-btn:hover, .tertiary-btn:hover, .danger-btn:hover {
    filter: brightness(1.1);
    box-shadow: var(--md-sys-elevation-1);
    transform: translateY(-1px);
}

.primary-btn:active, .secondary-btn:active, .tertiary-btn:active, .danger-btn:active {
    transform: translateY(0);
}

#studio-app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
.studio-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--md-sys-spacing-1) var(--md-sys-spacing-2);
    background-color: var(--md-sys-color-surface-container);
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--md-sys-spacing-2);
}

.back-link {
    color: var(--md-sys-color-on-surface);
    text-decoration: none;
    display: flex;
    align-items: center;
    padding: 8px;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.back-link:hover {
    background-color: var(--md-sys-color-surface-container-highest);
}

.header-left h1 {
    font-size: var(--md-sys-typescale-title-large-size);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.film-icon {
    font-size: 1.5rem;
    color: var(--md-sys-color-primary);
}

.privacy-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: 16px;
    padding: 2px 8px;
    border-radius: 12px;
    background-color: var(--md-sys-color-surface-container);
    color: var(--md-sys-color-primary);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: help;
    border: 1px solid var(--md-sys-color-primary-container);
    transition: background-color 0.2s;
    white-space: nowrap;
}

.privacy-badge:hover {
    background-color: var(--md-sys-color-primary-container);
}

.privacy-badge .material-symbols-outlined {
    font-size: 16px;
}

@media (width <= 900px) {
    .privacy-text {
        display: none;
    }

    .privacy-badge {
        padding: 4px;
    }
}

/* Theme Switch */
.theme-switch-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 16px;
}

.theme-switch-wrapper .material-symbols-outlined {
    font-size: 1.2rem;
    color: var(--md-sys-color-on-surface-variant);
}

.theme-switch {
    display: inline-block;
    height: 24px;
    position: relative;
    width: 48px;
}

.theme-switch input {
    display: none;
}

.slider {
    background-color: var(--md-sys-color-outline-variant);
    cursor: pointer;
    inset: 0;
    position: absolute;
    transition: 0.4s;
}

.slider::before {
    background-color: #fff;
    bottom: 4px;
    content: "";
    height: 16px;
    left: 4px;
    position: absolute;
    transition: 0.4s;
    width: 16px;
}

input:checked + .slider {
    background-color: var(--md-sys-color-primary);
}

input:checked + .slider::before {
    transform: translateX(24px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round::before {
    border-radius: 50%;
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--md-sys-spacing-2);
}

.sample-select, .lang-select {
    padding: 8px 12px;
    border-radius: var(--md-sys-shape-extra-small);
    border: 1px solid var(--md-sys-color-outline);
    background-color: var(--md-sys-color-surface-container-highest);
    color: var(--md-sys-color-on-surface);
    font-size: 0.9rem;
}

/* Main Layout */
.studio-main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.editor-pane {
    flex: 1;
    overflow-y: auto;
    padding: var(--md-sys-spacing-2);
    display: flex;
    flex-direction: column;
    gap: var(--md-sys-spacing-2);
}

.top-row {
    display: flex;
    gap: var(--md-sys-spacing-2);
}

.metadata-section {
    flex: 2;
}

.config-section {
    flex: 1;
}

.preview-pane {
    width: var(--sidebar-width);
    border-left: 1px solid var(--md-sys-color-outline-variant);
    background-color: var(--md-sys-color-surface-container-lowest);
    padding: var(--md-sys-spacing-2);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.sticky-preview {
    display: flex;
    flex-direction: column;
    gap: var(--md-sys-spacing-2);
    flex: 1;
}

/* Cards */
.card {
    background-color: var(--md-sys-color-surface-container);
    color: var(--md-sys-color-on-surface);
    border-radius: var(--md-sys-shape-medium);
    padding: var(--md-sys-spacing-2);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-left: 4px solid var(--md-sys-color-primary);
    transition: background-color 0.3s, color 0.3s, border-color 0.3s;
}

.config-section.card {
    border-left-color: var(--md-sys-color-tertiary);
}

.preview-section.card {
    border-left-color: var(--md-sys-color-secondary);
}

.section-title {
    font-size: 1rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--md-sys-color-primary);
    margin: 0;
}

.section-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--md-sys-spacing-1-5);
}

.input-group-inline {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 0.85rem;
}

.checkbox-inline {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    user-select: none;
}

.lang-select-small {
    padding: 2px 4px;
    font-size: 0.85rem;
    border-radius: 4px;
    background: var(--md-sys-color-surface-container-highest);
    border: 1px solid var(--md-sys-color-outline-variant);
    color: var(--md-sys-color-on-surface);
}

.section-title .material-symbols-outlined {
    font-size: 1.2rem;
}

/* Inputs */
.input-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--md-sys-spacing-1-5);
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.input-group.full-width {
    grid-column: span 2;
}

.input-group label {
    font-size: 0.8rem;
    color: var(--md-sys-color-on-surface-variant);
}

.input-group input, .input-group select {
    padding: 10px;
    border-radius: var(--md-sys-shape-extra-small);
    border: 1px solid var(--md-sys-color-outline-variant);
    background-color: var(--md-sys-color-surface-container-lowest);
    color: var(--md-sys-color-on-surface);
    width: 100%;
}

.switch-container {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 0;
}

.switch-label {
    font-size: 0.85rem;
}

/* Code Editors */
.code-section {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 200px;
}

.editor-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--editor-header);
    border-radius: var(--md-sys-shape-medium) var(--md-sys-shape-medium) 0 0;
    border: 1px solid var(--editor-border);
    border-bottom: none;
}

.search-bar.hidden {
    display: none !important;
}

.code-tabs {
    display: flex;
}

.code-tab {
    padding: 10px 20px;
    border: none;
    background: none;
    color: var(--md-sys-color-on-surface-variant);
    cursor: pointer;
    font-size: 0.85rem;
    border-right: 1px solid var(--editor-border);
}

.code-tab.active {
    background-color: var(--editor-bg);
    color: var(--md-sys-color-on-surface);
    border-bottom: 2px solid var(--accent-color);
}

.editor-tools {
    display: flex;
    gap: 4px;
    padding: 0 8px;
}


.search-bar {
    background-color: var(--md-sys-color-surface-container-high);
    padding: 8px;
    display: flex;
    gap: 8px;
    align-items: center;
    border: 1px solid var(--editor-border);
    border-bottom: none;
}

.search-bar input {
    padding: 4px 8px;
    font-size: 0.85rem;
    border-radius: 4px;
    border: 1px solid var(--md-sys-color-outline-variant);
    background-color: var(--md-sys-color-surface-container-lowest);
    color: var(--md-sys-color-on-surface);
    flex: 1;
}

.search-bar button {
    padding: 4px 12px;
    font-size: 0.8rem;
    border-radius: 4px;
}

.code-editors {
    flex: 1;
    background-color: var(--editor-bg);
    border-radius: 0 0 var(--md-sys-shape-medium) var(--md-sys-shape-medium);
    position: relative;
    border: 1px solid var(--editor-border);
    overflow: hidden;
}

.editor-container {
    display: none;
    flex-direction: column;
    height: 100%;
    position: absolute;
    inset: 0;
}

.editor-container.active {
    display: flex;
}

.editor-header {
    background-color: var(--editor-header);
    padding: 4px 12px;
    font-size: 0.75rem;
    color: var(--md-sys-color-on-surface-variant);
    font-family: monospace;
    flex-shrink: 0;
}

.editor-body {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.editor-gutter {
    width: 40px;
    background-color: var(--editor-header);
    color: var(--md-sys-color-on-surface-variant);
    font-family: 'Fira Code', monospace;
    font-size: 12px;
    padding-top: 12px;
    text-align: right;
    padding-right: 8px;
    user-select: none;
    border-right: 1px solid var(--editor-border);
}

.editor-content-wrapper {
    position: relative;
    flex: 1;
    min-width: 0;
}

.editor-textarea, .editor-highlight {
    position: absolute;
    inset: 0;
    margin: 0;
    padding: 12px;
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
    border: none;
    white-space: pre;
    overflow: auto;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    font-variant-ligatures: none;
    font-feature-settings: "liga" 0, "calt" 0;
}

.editor-textarea {
    background-color: transparent;
    color: transparent;
    caret-color: var(--editor-text);
    resize: none;
    outline: none;
    z-index: 2;
}

.editor-highlight {
    background-color: var(--editor-bg);
    color: var(--editor-text);
    z-index: 1;
    pointer-events: none;
    white-space: pre-wrap;
    overflow-wrap: break-word;
}

.editor-textarea.no-wrap,
.editor-highlight.no-wrap {
    white-space: pre;
    overflow-wrap: normal;
}

.editor-textarea:not(.no-wrap),
.editor-highlight:not(.no-wrap) {
    white-space: pre-wrap;
    overflow-wrap: break-word;
}

/* Syntax Highlighting */
.hl-keyword {
    color: #569cd6;
    font-weight: bold;
}

.hl-string {
    color: #ce9178;
}

.hl-number {
    color: #b5cea8;
}

.hl-comment {
    color: #6a9955;
    font-style: italic;
}

.hl-function {
    color: #dcdcaa;
}

.hl-variable {
    color: #9cdcfe;
}

.hl-bracket {
    color: #ffd700;
}

body.theme-light .hl-keyword { color: #00f; }
body.theme-light .hl-string { color: #a31515; }
body.theme-light .hl-number { color: #098658; }
body.theme-light .hl-comment { color: #008000; }
body.theme-light .hl-function { color: #795e26; }
body.theme-light .hl-variable { color: #001080; }
body.theme-light .hl-bracket { color: #af00db; }

/* Console */
.console-section {
    margin-top: 12px;
    border-left-color: var(--md-sys-color-error) !important;
    display: flex;
    flex-direction: column;
    transition: height 0.3s ease;
    height: 200px;
    flex-shrink: 0;
    overflow: hidden;
}

.console-section.collapsed {
    height: 48px;
}

.console-section.collapsed #clear-console {
    display: none;
}

.console-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 8px;
    cursor: pointer;
    user-select: none;
}

.console-controls {
    display: flex;
    gap: 4px;
}

.console-output {
    flex: 1;
    background-color: #000;
    color: #eee;
    font-family: 'Fira Code', monospace;
    font-size: 12px;
    padding: 8px;
    overflow-y: auto;
    border-radius: 4px;
    margin-top: 4px;
}

.console-line {
    margin-bottom: 4px;
    word-break: break-all;
}

.console-line.error { color: #ff5252; }
.console-line.warn { color: #ffca28; }
.console-line.info { color: #4fc3f7; }

/* Preview Area */
.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.preview-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.preview-color-selector, .preview-speed-selector {
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.preview-color-selector label, .preview-speed-selector label {
    font-size: 0.8rem;
    color: var(--md-sys-color-on-surface-variant);
}

.color-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.color-preset {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.2s, border-color 0.2s;
}

.color-preset:hover {
    transform: scale(1.2);
}

.color-preset.active {
    border-color: var(--md-sys-color-on-surface);
}

.icon-btn {
    background: none;
    border: none;
    padding: 4px;
    color: var(--md-sys-color-on-surface-variant);
    border-radius: 50%;
    transition: background-color 0.2s;
    width: 32px;
    height: 32px;
}

.icon-btn:hover,
.icon-btn.active {
    background-color: var(--md-sys-color-surface-container-highest);
}

.icon-btn.active {
    color: var(--md-sys-color-primary);
    box-shadow: inset 0 0 0 1px var(--md-sys-color-outline-variant);
}

.icon-btn .material-symbols-outlined {
    font-size: 1.2rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    cursor: pointer;
}

#preview-container {
    position: relative;
    width: 100%;
    height: 150px;
    background-color: var(--preview-bg);
    border-radius: var(--md-sys-shape-small);
    overflow: hidden;
    margin-bottom: 12px;
    transition: background-color 0.3s;
}

#raw-canvas-container {
    position: relative;
    width: 100%;
    height: 150px;
    background-color: var(--md-sys-color-surface-container-high);
    background-image: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 10px,
        rgba(128, 128, 128, 0.2) 10px,
        rgba(128, 128, 128, 0.2) 11px,
        transparent 11px,
        transparent 20px
    );
    border-radius: var(--md-sys-shape-small);
    overflow: hidden;
    margin-bottom: 12px;
    transition: background-color 0.3s;
}

#raw-canvas-container.hidden {
    display: none;
}

#animation-canvas, #raw-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

#exclusion-simulator {
    position: absolute;
    top: 40px;
    left: 40px;
    width: 120px;
    height: 40px;
    background-color: rgba(25, 118, 210, 0.3);
    border: 2px dashed #1976d2;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: move;
    z-index: 10;
}

.exclusion-label {
    font-size: 10px;
    pointer-events: none;
    user-select: none;
}

/* Resizers */
.resizer {
    position: absolute;
    width: 8px;
    height: 8px;
    background-color: #1976d2;
}

.resizer.nw {
    top: -4px;
    left: -4px;
    cursor: nw-resize;
}

.resizer.ne {
    top: -4px;
    right: -4px;
    cursor: ne-resize;
}

.resizer.sw {
    bottom: -4px;
    left: -4px;
    cursor: sw-resize;
}

.resizer.se {
    bottom: -4px;
    right: -4px;
    cursor: se-resize;
}

/* Metrics */
.metrics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.metric-item {
    background-color: var(--md-sys-color-surface-container-highest);
    padding: 8px;
    border-radius: var(--md-sys-shape-extra-small);
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 48px;
}

.metric-text {
    display: flex;
    flex-direction: column;
}

.metric-label {
    font-size: 0.7rem;
    color: var(--md-sys-color-on-surface-variant);
    text-transform: uppercase;
}

.metric-value {
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
    font-weight: bold;
}

.speed-slider {
    width: 100%;
    height: 6px;
    background: var(--md-sys-color-surface-container-highest);
    border-radius: 3px;
    outline: none;
    appearance: none;
}

.speed-slider::-webkit-slider-thumb {
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--md-sys-color-primary);
    border-radius: 50%;
    cursor: pointer;
}

.speed-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--md-sys-color-primary);
    border-radius: 50%;
    cursor: pointer;
}

/* Analog Meter */
.analog-meter {
    width: 60px;
    height: 40px;
    background-color: #fdf5e6; /* Yellowish background */
    border: 1px solid var(--md-sys-color-outline);
    border-radius: 2px;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

.analog-meter::before {
    content: "";
    position: absolute;
    inset: 4px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    pointer-events: none;
}

.meter-needle {
    position: absolute;
    bottom: -5px;
    left: 50%;
    width: 1.5px;
    height: 35px;
    background-color: #d32f2f;
    transform-origin: bottom center;
    transform: translateX(-50%) rotate(-45deg);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2;
}

.meter-needle::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: -2.5px;
    width: 6px;
    height: 6px;
    background-color: #333;
    border-radius: 50%;
}

/* Tape Deck */
.tape-deck {
    margin-top: 16px;
    background-color: var(--md-sys-color-surface-container-high);
    border: 2px solid var(--md-sys-color-outline);
    border-radius: var(--md-sys-shape-medium);
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.tape-controls-frame {
    padding: 16px;
    background: linear-gradient(135deg, #e0e0e0 0%, #bdbdbd 50%, #e0e0e0 100%);
    background-size: 2px 100%; /* Hairline simulation */
    background-color: #ccc;
    position: relative;
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.8), 0 2px 5px rgba(0, 0, 0, 0.3);
}

body.theme-dark .tape-controls-frame {
    background: linear-gradient(135deg, #444 0%, #222 50%, #444 100%);
    background-size: 2px 100%;
    background-color: #333;
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.1), 0 2px 5px rgba(0, 0, 0, 0.5);
}

/* Hairline effect with pseudo-element */
.tape-controls-frame::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: repeating-linear-gradient(
        90deg,
        rgba(0, 0, 0, 0.05) 0,
        rgba(0, 0, 0, 0.05) 1px,
        transparent 1px,
        transparent 2px
    );
    pointer-events: none;
    opacity: 0.5;
}

.tape-counter-wrapper {
    display: flex;
    justify-content: flex-end;
}

.tape-counter {
    background-color: #111;
    color: #0f0;
    font-family: 'Fira Code', monospace;
    font-size: 1.1rem;
    padding: 2px 6px;
    border-radius: 2px;
    border: 1px solid #333;
    min-width: 55px;
    text-align: center;
    box-shadow: inset 0 0 5px rgba(0, 255, 0, 0.5);
    text-shadow: 0 0 2px rgba(0, 255, 0, 0.8);
}

.tape-controls {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.tape-btn {
    flex: 1;
    height: 48px;
    background-color: #eee;
    border: 1px solid #999;
    border-bottom: 3px solid #666;
    border-radius: 4px;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.1s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.tape-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    filter: grayscale(1);
    background-color: #ccc;
    border-bottom-color: #999;
}

body.theme-dark .tape-btn {
    background-color: #444;
    border-color: #666;
    border-bottom-color: #111;
    color: #eee;
}

.tape-btn:hover:not(:disabled) {
    background-color: #fff;
}

.tape-btn:active:not(:disabled) {
    border-bottom-width: 1px;
    transform: translateY(2px);
    box-shadow: none;
}

body.theme-dark .tape-btn:disabled {
    background-color: #2a2a2a;
    border-bottom-color: #000;
}

body.theme-dark .tape-btn:hover:not(:disabled) {
    background-color: #555;
}

.tape-btn.primary {
    background-color: #d1e2ff;
    color: #002d6b;
    border-color: #7baaf7;
    border-bottom-color: #3b78e7;
}

body.theme-dark .tape-btn.primary {
    background-color: #004a77;
    color: #c2e7ff;
    border-color: #00639b;
    border-bottom-color: #035;
}

.tape-btn .material-symbols-outlined {
    font-size: 24px;
    font-variation-settings: 'FILL' 1;
}

#pause-btn.active .material-symbols-outlined {
    animation: pulse-pause 1.5s infinite;
    color: var(--md-sys-color-error);
}

@keyframes pulse-pause {
    0% { opacity: 1; }
    50% { opacity: 0.3; }
    100% { opacity: 1; }
}

/* Actions */
.action-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 12px;
}

.action-section.sticky-footer {
    padding: 16px 0;
    background-color: var(--md-sys-color-surface-container-lowest);
    border-top: 1px solid var(--md-sys-color-outline-variant);
    margin-top: auto;
    position: sticky;
    bottom: calc(-1 * var(--md-sys-spacing-2));
    z-index: 10;
}

.action-footer-spacer {
    flex-grow: 1;
}

.action-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}


.full-width {
    width: 100%;
}


/* Modal */
.modal {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal.hidden {
    display: none;
}

.modal-content {
    background-color: var(--md-sys-color-surface-container);
    padding: var(--md-sys-spacing-3);
    border-radius: var(--md-sys-shape-large);
    max-width: 500px;
    width: 90%;
    position: relative;
    box-shadow: var(--md-sys-elevation-3);
    display: flex;
    flex-direction: column;
}

.modal h2 {
    margin-bottom: 1rem;
    color: var(--md-sys-color-primary);
}

.pr-guide-body ol {
    margin: 1.5rem 0;
    padding-left: 1.5rem;
}

.pr-guide-body li {
    margin-bottom: 1rem;
    line-height: 1.5;
}

.pr-guide-body code {
    background-color: var(--md-sys-color-surface-container-highest);
    padding: 2px 4px;
    border-radius: 4px;
}

.pr-guide-body a {
    color: var(--md-sys-color-primary);
    text-decoration: underline;
    font-weight: 500;
}

.pr-guide-body a:hover {
    filter: brightness(1.2);
}

.note {
    font-size: 0.9rem;
    color: var(--md-sys-color-on-surface-variant);
    font-style: italic;
    margin-bottom: 1.5rem;
}

.close-modal-btn {
    align-self: center;
    width: auto;
    min-width: 120px;
}

.close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    cursor: pointer;
    background: none;
    padding: 4px;
    border-radius: 50%;
}

.close-btn:hover {
    background-color: var(--md-sys-color-surface-container-highest);
}

/* Toast */
#toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--md-sys-color-inverse-surface);
    color: var(--md-sys-color-inverse-on-surface);
    padding: 12px 24px;
    border-radius: var(--md-sys-shape-full);
    z-index: 2000;
    font-size: 0.9rem;
}

#toast.hidden {
    display: none;
}

/* Responsive */
@media (width <= 900px) {
    .studio-main {
        flex-direction: column;
        overflow-y: auto;
    }

    .preview-pane {
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--md-sys-color-outline-variant);
    }


    body.theme-dark {
        overflow-y: auto;
    }
}
