:root {
    color-scheme: light dark;
    font-family:
        'Inter',
        'SF Pro Text',
        -apple-system,
        BlinkMacSystemFont,
        'Segoe UI',
        sans-serif;
    --ui-font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', 'Segoe UI',
        sans-serif;
    --ui-font-size: 15px;
    --sidebar-width: 420px;
    --toolbar-height: 64px;
    --header-height: 45px;
    --border-color: rgba(0, 0, 0, 0.1);
    --bg-muted: #f5f5f7;
    --bg-sidebar: #ffffff;
    --accent: #007aff;
}

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

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg-muted);
    color: #111;
}

.site-header {
    background: #ffffff !important;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08) !important;
    box-shadow: 0 8px 30px rgba(15, 23, 42, 0.04) !important;
    position: sticky;
    top: 0;
    z-index: 20;
    /* Fixed typography to prevent preview styles from affecting header */
    font-family: var(--ui-font-family) !important;
    font-size: var(--ui-font-size) !important;
    line-height: 1.4 !important;
    color: #111 !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Ensure all header children are isolated from typography styles */
.site-header * {
    box-sizing: border-box;
}

.site-header a {
    text-decoration: none !important;
    background-image: none !important;
    box-shadow: none !important;
}

.site-header a:hover,
.site-header a:focus,
.site-header a:active {
    text-decoration: none !important;
    background-image: none !important;
    box-shadow: none !important;
}

.brand-nav {
    /* max-width: 1200px; */
    margin: 0 22px !important;
    padding: 0 !important;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    /* Fixed typography */
    font-family: var(--ui-font-family) !important;
    font-size: var(--ui-font-size) !important;
    line-height: 1.4 !important;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700 !important;
    font-size: 21px !important; /* 1.4rem * 15px base = 21px */
    color: #0b1f33 !important;
    text-decoration: none !important;
    background-image: none !important;
    box-shadow: none !important;
    /* Fixed typography */
    font-family: var(--ui-font-family) !important;
    line-height: 1.4 !important;
    margin: 0 !important;
    padding: 0 !important;
}

.logo-mark {
    width: 42px;
    height: 42px;
    box-shadow: none !important;
    position: relative;
}

.brand-links {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    /* Fixed typography */
    font-family: var(--ui-font-family) !important;
    font-size: var(--ui-font-size) !important;
    line-height: 1.4 !important;
    margin: 0 !important;
}

.brand-links a {
    color: #6b7280 !important;
    text-decoration: none !important;
    font-weight: 500 !important;
    transition: color 0.2s ease;
    font-size: 14px !important; /* 0.95rem * 15px base ≈ 14px */
    /* Fixed typography */
    font-family: var(--ui-font-family) !important;
    line-height: 1.4 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
}

.brand-links a:hover {
    color: #0aa0d2 !important;
    text-decoration: none !important;
    background-image: none !important;
    box-shadow: none !important;
}

.app-shell {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - var(--header-height));
    height: calc(100vh - var(--header-height));
    overflow: hidden;
}

.workspace {
    flex: 1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--sidebar-width);
    grid-template-rows: 1fr;
    overflow: hidden;
    min-height: 0;
    height: calc(100vh - var(--toolbar-height) - var(--header-height));
}

.preview-pane {
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
    background: transparent;
    min-height: 0;
    overflow: hidden;
}

.preview-toolbar {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
    /* background: #fafafa; */
}

/* When viewport is too narrow for 3 columns, wrap to single column */
/* Minimum: 3 columns × 200px + 2 gaps × 12px + padding 30px = 654px */
@media (max-width: 680px) {
    .preview-toolbar {
        grid-template-columns: 1fr;
    }
}

.preview-toolbar label {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    display: block;
    margin-bottom: 4px;
    color: #555;
}

.preview-toolbar input,
.preview-toolbar select,
.preview-toolbar textarea {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.55rem 0.75rem;
    font-size: 0.95rem;
}

.preview-toolbar select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23555' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 12px;
    padding-right: 2.5rem;
}

.preview-toolbar__title-group {
    position: relative;
}

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

.preview-toolbar__title-wrapper input {
    flex: 1;
}

.metadata-toggle {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    color: #555;
    transition: all 0.2s ease;
    padding: 0;
}

.metadata-toggle:hover {
    background: var(--bg-muted);
    border-color: var(--accent);
    color: var(--accent);
}

.metadata-toggle svg {
    transition: transform 0.2s ease;
}

.metadata-toggle[aria-expanded='true'] svg {
    transform: rotate(-90deg);
}

.metadata-section {
    grid-column: 1 / -1;
    display: none;
    grid-template-columns: minmax(0, 200px) 1fr;
    gap: 12px 16px;
    padding-top: 0;
    border-top: none;
    margin-top: 0;
    opacity: 0;
    align-items: start;
    transition:
        opacity 0.3s ease,
        padding-top 0.3s ease,
        margin-top 0.3s ease;
}

.metadata-section[aria-hidden='false'] {
    display: grid;
    opacity: 1;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    margin-top: 12px;
}

.metadata-section label {
    display: block;
    margin-bottom: 0;
    text-align: right;
    padding-top: 0.55rem;
    padding-right: 12px;
}

.metadata-section input,
.metadata-section textarea {
    width: 100%;
    margin-bottom: 0;
}

.metadata-section textarea {
    resize: vertical;
    height: auto;
    min-height: 3.5em;
    max-height: 5.5em;
    overflow-y: auto;
    font-family: inherit;
    line-height: 1.4;
}

.metadata-section .optional {
    color: #777;
    font-size: 0.8rem;
    font-weight: normal;
    text-transform: none;
    letter-spacing: normal;
}

@media (max-width: 940px) {
    .metadata-section {
        grid-template-columns: minmax(0, 200px) 1fr;
    }
}

#metadata-author {
    width: auto !important;
}

.preview-canvas {
    flex: 1;
    overflow: auto;
    padding: 0;
    position: relative;
    background: transparent;
    min-height: 0;
}

.preview-content {
    max-width: 760px;
    margin: 0 auto;
}

/* Make #wrapper fill .preview-canvas completely */
#wrapper {
    width: 100%;
    max-width: none;
    height: 100%;
    min-height: 100%;
    margin: 0;
    box-sizing: border-box;
}

.preview-content img {
    width: 100%;
    height: auto;
    margin: 1rem 0;
}

/* Fix footnote list items: make paragraph inline so marker stays on same line */
.footnotes li p {
    display: inline;
}

.mode-toggle {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 12px !important;
    padding: 16px 0 !important;
    margin: -24px -24px 16px -24px;
    padding-top: 24px !important;
    padding-left: 24px !important;
    padding-right: 24px !important;
    padding-bottom: 16px !important;
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-color);
}

.mode-toggle__row {
    display: flex;
    align-items: center;
    gap: 12px !important;
}

.mode-toggle__row:last-child {
    flex-wrap: wrap;
}

.mode-toggle__row button {
    height: 45px;
}

.toggle {
    display: flex;
    align-items: center;
    gap: 12px !important;
    cursor: pointer;
}

.toggle input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.toggle-track {
    width: 44px;
    height: 24px;
    background: var(--border-color);
    border-radius: 999px;
    padding: 2px;
    position: relative;
    transition: background 0.2s ease;
}

.toggle-thumb {
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    display: block;
    transition: transform 0.2s ease;
}

.toggle input:checked + .toggle-track {
    background: var(--accent);
}

.toggle input:checked + .toggle-track .toggle-thumb {
    transform: translateX(20px);
}

.toggle-label {
    font-weight: 600 !important;
    text-transform: uppercase;
    font-size: 12px !important;
    letter-spacing: 0.05em;
}

.mode-hint {
    font-size: 13px !important;
    color: #666 !important;
    margin-bottom: 12px !important;
}

.controls-pane .mode-hint,
.controls-pane legend {
    font-size: 13px !important;
}

.controls-pane {
    background: var(--bg-sidebar);
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    font-family: var(--ui-font-family) !important;
    font-size: 15px !important;
    line-height: 1.4 !important;
    color: #111;
}

.preview-toolbar,
.preview-toolbar input,
.preview-toolbar select {
    font-family: var(--ui-font-family);
    font-size: var(--ui-font-size);
    line-height: 1.4;
}

.actions-toolbar,
.actions-toolbar button,
.actions-toolbar .share-actions {
    font-family: var(--ui-font-family);
    font-size: var(--ui-font-size);
}

.css-popover,
.css-popover__dialog,
.css-popover textarea,
.css-popover button,
.share-dialog,
.share-dialog__panel,
.share-dialog button,
.share-dialog input,
.share-dialog textarea,
.share-dialog .optional,
.font-browser,
.font-browser__dialog,
.font-browser input,
.font-browser button,
.font-browser__header {
    font-family: var(--ui-font-family);
    font-size: var(--ui-font-size);
    line-height: 1.4;
}

.controls-scroll {
    flex: 1;
    overflow: auto;
    padding: 0 24px !important;
}

.controls-pane input,
.controls-pane select,
.controls-pane textarea,
.controls-pane button {
    font-family: var(--ui-font-family) !important;
    font-size: 15px !important;
}

.controls-pane input[type='text'],
.controls-pane input[type='number'],
.controls-pane select,
.controls-pane textarea {
    font-size: 14px !important;
}

.unit-input {
    display: block;
}

.unit-input__control {
    display: flex;
    align-items: center;
    gap: 6px !important;
}

.unit-input__control input[type='number'],
.unit-input__control input[type='text'] {
    flex: 1;
}

.unit-input__suffix {
    font-size: 13px !important;
    color: #555 !important;
}

form {
    display: flex;
    flex-direction: column;
    gap: 20px !important;
    padding-bottom: var(--toolbar-height) !important;
}

fieldset {
    border: 1px solid var(--border-color) !important;
    border-radius: 12px;
    padding: 16px 20px 20px !important;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.color-section-dark {
    display: none;
}

body.inverted .color-section-light {
    display: none;
}

body.inverted .color-section-dark {
    display: block;
}

.code-section-dark {
    display: none;
}

body.inverted .code-section-light {
    display: none;
}

body.inverted .code-section-dark {
    display: block;
}

.bq-section-dark {
    display: none;
}

body.inverted .bq-section-light {
    display: none;
}

body.inverted .bq-section-dark {
    display: block;
}

.table-section-dark {
    display: none;
}

body.inverted .table-section-light {
    display: none;
}

body.inverted .table-section-dark {
    display: block;
}

.footnote-section-dark {
    display: none;
}

body.inverted .footnote-section-light {
    display: none;
}

body.inverted .footnote-section-dark {
    display: block;
}

.shadow-section {
    display: block;
}

.shadow-presets {
    display: flex;
    gap: 8px !important;
    flex-wrap: wrap;
    margin-top: 4px !important;
}

.shadow-preset {
    display: inline-flex;
    align-items: center;
    gap: 4px !important;
    font-size: 13px !important;
}

.shadow-targets {
    display: flex;
    flex-direction: column;
    gap: 4px !important;
    margin-top: 4px !important;
}

.shadow-target {
    display: inline-flex;
    align-items: center;
    gap: 6px !important;
    font-size: 13px !important;
}

legend {
    font-weight: 600 !important;
    padding: 0 8px !important;
    font-family: var(--ui-font-family) !important;
    font-size: 13px !important;
}

label {
    display: flex;
    flex-direction: row;
    align-items: center;
    font-size: 0.85rem;
    gap: 10px !important;
    margin-bottom: 12px !important;
}

/* Label text should not grow, inputs/selects should take remaining space */
label
    > :not(input):not(select):not(textarea):not(.toggle-track):not(.unit-input__control):not(
        .unit-input__suffix
    ) {
    flex-shrink: 0;
}

/* Label text spans can wrap to multiple lines */
label > span:first-child {
    flex-shrink: 0;
    min-width: 0;
    max-width: 120px;
    word-wrap: break-word;
    line-height: 1.3;
    white-space: normal;
}

/* Labels with unit-input class use row layout like other labels */
label.unit-input {
    display: flex !important;
    flex-direction: row;
    align-items: center;
}

label.unit-input > span:first-child {
    flex-shrink: 0;
    min-width: 0;
    max-width: 120px;
    word-wrap: break-word;
    line-height: 1.3;
    white-space: normal;
}

label.unit-input .unit-input__control {
    flex: 0 0 auto;
    min-width: 0;
    display: flex;
}

/* Selects inside labels should take remaining space */
label > select {
    flex: 1;
    min-width: 0;
}

.controls-pane label {
    font-size: 13px !important;
}

input[type='text'],
input[type='url'],
input[type='number'],
input[type='color'],
select,
textarea {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 10px !important;
    font-size: 0.95rem;
    font-family: inherit;
}

/* Default width for most text inputs - narrow */
input[type='text'],
input[type='number'] {
    width: 10ch;
    flex: 0 0 auto;
}

/* Wider inputs for specific fields that need more space */
#style-title,
#googleFontName,
#googleFontStyles,
#headerFontFamily,
#bodyFontFamily,
#codeFontFamily,
#shareName,
#shareAuthorUrl,
#shareDescription,
#shareNote,
#fontBrowserSearch,
textarea {
    width: 100%;
    flex: 1;
}

/* Very narrow inputs for specific fields */
#tableBorderRadius,
#tableHeaderFontWeight,
#tableHeaderFontSize,
#dtFontSize,
#ddFontSize,
#headerWeight,
#bodyWeight,
#boldWeight,
#headerLetterSpacing,
#bodyLetterSpacing,
#blockquoteBorderLeftWidth,
#imageMaxWidth,
#imageBorderRadius,
#nestedListMarginLeft,
#codeBorderRadius,
#codePadding,
#wrapperPadding,
#paragraphIndent,
#listIndent,
#blockquoteIndent {
    width: 8ch;
    flex: 0 0 8ch;
}

#wrapperPadding {
    width: 16ch;
    flex: 0 0 16ch;
}

/* DL/DD Indent inputs - wider to show 4 decimal places */
#dlIndent,
#ddIndent {
    width: 12ch;
    flex: 0 0 12ch;
}

/* Font weight and font style selects - wider for better visibility */
#dtFontWeight,
#ddFontWeight,
#dtFontStyle,
#ddFontStyle {
    min-width: 140px;
    flex: 1;
}

#codeWrap {
    width: 100px;
}

#tableCaptionFontWeight {
    width: 88px;
}

/* Selects should be flexible but not too wide */
select {
    width: auto;
    min-width: 10ch;
    flex: 0 0 auto;
}

/* Custom checkbox styling - only for checkboxes not in .toggle */
input[type='checkbox']:not(.toggle input) {
    width: 18px;
    height: 18px;
    min-width: 18px;
    min-height: 18px;
    margin: 0;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: #fff;
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    position: relative;
    flex-shrink: 0;
    transition:
        background-color 0.2s ease,
        border-color 0.2s ease;
}

input[type='checkbox']:not(.toggle input):hover {
    border-color: var(--accent);
}

input[type='checkbox']:not(.toggle input):focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

input[type='checkbox']:not(.toggle input):checked {
    background-color: var(--accent);
    border-color: var(--accent);
}

input[type='checkbox']:not(.toggle input):checked::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

body.inverted input[type='checkbox']:not(.toggle input) {
    background-color: #0f111a;
    border-color: rgba(255, 255, 255, 0.2);
}

body.inverted input[type='checkbox']:not(.toggle input):hover {
    border-color: rgba(255, 255, 255, 0.4);
}

body.inverted input[type='checkbox']:not(.toggle input):checked {
    background-color: var(--accent);
    border-color: var(--accent);
}

/* Color wells are now buttons */
.color-well {
    height: 1.5em !important;
    width: 1.5em;
    min-width: 1.5em;
    min-height: 1.5em;
    padding: 0 !important;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    flex-shrink: 0;
    background-color: transparent;
    position: relative;
    pointer-events: auto;
    -webkit-appearance: none;
    appearance: none;
}

.color-well:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.color-well:hover {
    border-color: var(--accent);
}

/* Empty color well state - diagonal red line */
.color-well-empty {
    background-color: #ffffff !important;
    background-image: linear-gradient(
        to top right,
        transparent calc(50% - 1px),
        #ff0000 calc(50% - 1px),
        #ff0000 calc(50% + 1px),
        transparent calc(50% + 1px)
    );
    position: relative;
}

.color-well-label {
    pointer-events: auto;
}

input[type='color']::-webkit-color-swatch-wrapper {
    padding: 0;
    border: none;
    border-radius: 4px;
}

input[type='color']::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

input[type='color']::-moz-color-swatch {
    border: none;
    border-radius: 4px;
}

/* Color wells in color-well-label should be smaller */
.color-well-label input[type='color'],
.color-well-label .color-well {
    height: 1.5em !important;
    width: 1.5em !important;
    min-width: 1.5em !important;
    min-height: 1.5em !important;
    padding: 0 !important;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    flex-shrink: 0;
    /* Remove default browser styling */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    outline: none;
    box-shadow: none;
}

.color-well-label input[type='color']::-webkit-color-swatch-wrapper {
    padding: 0;
    border: none;
    border-radius: 4px;
}

.color-well-label input[type='color']::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

.color-well-label input[type='color']::-moz-color-swatch {
    border: none;
    border-radius: 4px;
}

.color-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px 16px !important;
}

.color-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px 24px !important;
}

.color-list {
    display: flex;
    flex-direction: column;
    gap: 10px !important;
}

.heading-color-list {
    display: flex;
    flex-direction: column;
    gap: 10px !important;
}

.color-well-label {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px !important;
    cursor: pointer;
}

/* Color well should be on the left, text on the right */
.color-well-label .color-well {
    order: -1;
    flex-shrink: 0;
}

/* Duplicate removed - using the definition above */

.color-well-label span {
    flex: 1;
    font-size: 14px !important;
    line-height: 1.5;
}

.heading-color-list .color-well-label {
    display: flex;
    align-items: center;
    gap: 10px !important;
}

.heading-color-list .color-clear {
    margin-left: auto;
    flex-shrink: 0;
}

.heading-color-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px 16px !important;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 16px !important;
}

.color-optional {
    display: flex;
    align-items: center;
    gap: 8px !important;
}

.color-clear {
    border: 1px solid var(--border-color);
    background: transparent;
    border-radius: 6px;
    padding: 6px 12px !important;
    font-size: 11px !important;
    font-family: var(--ui-font-family) !important;
    cursor: pointer;
    color: #444 !important;
}

.color-clear:hover {
    background: var(--bg-muted);
}

.google-font-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr)) 120px;
    gap: 8px !important;
    margin-bottom: 12px !important;
}

.google-font-row button {
    border: none;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
}

.google-font-actions {
    display: flex;
    flex-direction: column;
    gap: 8px !important;
    margin-bottom: 12px !important;
}

.google-font-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px !important;
    flex-wrap: wrap;
}

.google-font-hint {
    font-size: 12px !important;
    color: #666 !important;
    margin: 0;
    font-family: var(--ui-font-family) !important;
}

.ghost-button {
    border: 1px solid var(--border-color);
    background: transparent;
    border-radius: 999px;
    padding: 6px 14px !important;
    font-size: 13px !important;
    font-family: var(--ui-font-family) !important;
    cursor: pointer;
    transition:
        background-color 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.ghost-button:hover {
    background: var(--bg-muted);
    border-color: var(--accent);
}

.ghost-button:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    background: var(--bg-muted);
    border-color: var(--accent);
}

.ghost-button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Custom CSS Button Indicator */
#customCssBtn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.custom-css-indicator {
    display: inline-block;
    height: calc(100% - 15px);
    width: auto;
    min-height: calc(100% - 15px);
    margin: 4px 0;
    border-radius: 50%;
    background-color: #999;
    transition: background-color 0.2s ease;
    flex-shrink: 0;
    aspect-ratio: 1;
    box-sizing: border-box;
}

.custom-css-indicator.has-content {
    background-color: #1c7c54;
}

.custom-css-indicator.has-invalid {
    background-color: #c0392b;
}

body.inverted .custom-css-indicator {
    background-color: rgba(255, 255, 255, 0.4);
}

body.inverted .custom-css-indicator.has-content {
    background-color: #4ade80;
}

body.inverted .custom-css-indicator.has-invalid {
    background-color: #ef4444;
}

.google-font-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px !important;
}

.google-font-chip {
    background: #f0f6ff;
    border: 1px solid rgba(0, 122, 255, 0.3);
    border-radius: 999px;
    padding: 6px 12px !important;
    font-size: 12px !important;
    font-family: var(--ui-font-family) !important;
    display: inline-flex;
    align-items: center;
    gap: 6px !important;
}

.google-font-chip button {
    border: none;
    background: transparent;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}

.actions-toolbar {
    position: sticky;
    bottom: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    background: rgba(250, 250, 250, 0.95);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.04);
    min-height: var(--toolbar-height);
}

.actions-toolbar button {
    border: none;
    border-radius: 999px;
    padding: 0.65rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    background: var(--bg-muted);
}

.share-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.primary {
    background: var(--accent);
    color: #fff;
    border-radius: 999px;
    padding: 0.35rem 0.9rem;
    transition:
        background-color 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.1s ease;
    border: none;
}

.primary:hover {
    background: #0056cc;
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.4);
    transform: translateY(-1px);
}

.primary:focus {
    outline: 3px solid rgba(0, 122, 255, 0.5);
    outline-offset: 2px;
    background: #0056cc;
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.4);
}

.primary:focus-visible {
    outline: 3px solid rgba(0, 122, 255, 0.5);
    outline-offset: 2px;
}

.primary:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(0, 122, 255, 0.3);
}

.primary-outline {
    border: 1px solid rgba(0, 122, 255, 0.4);
    background: transparent;
    color: var(--accent);
}

#shareStyleBtn {
    padding-inline: 1.75rem;
}

#addToMarkedBtn {
    background: #ffeec2;
    color: #865500;
}

#saveCssBtn {
    background: var(--accent);
    color: white;
}

.spacer {
    flex: 1;
}

.css-popover {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    z-index: 11;
}

.css-popover[aria-hidden='false'] {
    display: flex;
}

.css-popover__dialog {
    width: min(1000px, 100%);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    max-height: calc(90vh - 60px);
    height: 100%;
    overflow: hidden;
}

.css-popover__dialog header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* Fixed typography to prevent preview styles from affecting header */
    font-family: var(--ui-font-family) !important;
    font-size: var(--ui-font-size) !important;
    line-height: 1.4 !important;
    color: #111 !important;
}

.css-popover__header-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.css-popover__dialog header h2 {
    margin: 0;
    /* Fixed typography */
    font-family: var(--ui-font-family) !important;
    font-size: 1.25rem !important;
    font-weight: 600 !important;
    line-height: 1.4 !important;
    color: #111 !important;
}

.copy-button {
    border: none;
    background: transparent;
    padding: 0.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    transition:
        color 0.2s ease,
        transform 0.1s ease;
    border-radius: 4px;
}

.copy-button:hover {
    color: var(--accent);
    background: rgba(0, 122, 255, 0.1);
}

.copy-button:active {
    transform: scale(0.95);
}

.copy-button.copied {
    color: #1c7c54;
}

.copy-button.copied .copy-icon {
    display: none;
}

.copy-button.copied .check-icon {
    display: block !important;
}

.copy-button .check-icon {
    display: none;
}

.copy-icon,
.check-icon {
    width: 16px;
    height: 16px;
    display: block;
}

.css-popover__dialog textarea {
    flex: 1;
    border: none;
    padding: 1.25rem;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
    font-size: 0.85rem;
    line-height: 1.4;
    resize: none;
}

#closeCssPopover {
    border: none;
    background: transparent;
    font-size: 1.5rem;
    cursor: pointer;
}

.font-browser {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    z-index: 10;
}

.font-browser[aria-hidden='false'] {
    display: flex;
}

.font-browser__dialog {
    width: min(1100px, 100%);
    max-height: 90vh;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
}

.font-browser__header {
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.font-browser__header h2 {
    margin: 0;
    font-size: 1.25rem;
}

.font-browser__header p {
    margin: 0.2rem 0 0;
    color: #666;
    font-size: 0.85rem;
}

.font-browser__header button {
    border: none;
    background: transparent;
    font-size: 1.75rem;
    cursor: pointer;
    line-height: 1;
}

.font-browser__controls {
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.font-browser__controls input {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.5rem 0.75rem;
    font-size: 1rem;
}

.font-browser__list {
    flex: 1;
    overflow: auto;
    padding: 1rem 1.5rem 1.5rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.share-dialog {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    z-index: 15;
}

.share-dialog[aria-hidden='false'] {
    display: flex;
}

.share-dialog__panel {
    width: min(520px, 100%);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    max-height: calc(90vh - 30px);
    position: relative;
    top: 30px;
    overflow: auto;
}

.share-dialog__header {
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    /* Fixed typography to prevent preview styles from affecting header */
    font-family: var(--ui-font-family) !important;
    font-size: var(--ui-font-size) !important;
    line-height: 1.4 !important;
    color: #111 !important;
}

.share-dialog__header h2 {
    margin: 0;
    /* Fixed typography */
    font-family: var(--ui-font-family) !important;
    font-size: 1.25rem !important;
    font-weight: 600 !important;
    line-height: 1.4 !important;
    color: #111 !important;
}

.share-dialog__header p {
    margin: 0.35rem 0 0;
    color: #555 !important;
    font-size: 0.9rem !important;
    /* Fixed typography */
    font-family: var(--ui-font-family) !important;
    line-height: 1.4 !important;
    font-weight: normal !important;
}

.share-dialog__header button {
    border: none;
    background: transparent;
    font-size: 1.75rem !important;
    line-height: 1 !important;
    cursor: pointer;
    /* Fixed typography */
    font-family: var(--ui-font-family) !important;
    color: #111 !important;
    font-weight: normal !important;
}

.share-form {
    padding: 1.25rem 1.5rem 1.5rem;
}

.share-form textarea {
    resize: vertical;
    min-height: 2.5rem;
}

.share-preview-block {
    margin: 1rem 0;
    padding: 1rem;
    border-radius: 16px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: #f8fafc;
}

.share-preview-block h3 {
    margin-top: 0;
    font-size: 0.95rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #64748b;
}

.inline-preview-shell {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.inline-preview {
    position: relative;
    width: 100%;
    padding-top: 60%;
    border-radius: 24px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    overflow: hidden;
    background: #ffffff;
    box-shadow: 0 18px 35px rgba(15, 23, 42, 0.1);
}

.inline-preview__frame {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
}

.inline-preview__frame.light {
    clip-path: polygon(0 0, 50% 0, 50% 100%, 0 100%);
}

.inline-preview__frame.dark {
    clip-path: polygon(50% 0, 100% 0, 100% 100%, 50% 100%);
}

.inline-preview__label {
    position: absolute;
    top: 0.6rem;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    z-index: 2;
}

.light-label {
    left: 0.85rem;
    background: rgba(10, 160, 210, 0.9);
    color: #fff;
}

.dark-label {
    right: 0.85rem;
    background: rgba(255, 255, 255, 0.92);
    color: #0f172a;
}

.preview-empty {
    color: #94a3b8;
    font-size: 0.9rem;
    margin: 0;
}

.share-form__status {
    min-height: 1.25rem;
    font-size: 0.85rem;
    color: #555;
}

.share-form__status.error {
    color: #c0392b;
}

.share-form__status.success {
    color: #1c7c54;
}

.share-form__actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1rem;
}

.optional {
    color: #777;
    font-size: 0.8rem;
}

.font-browser__empty {
    grid-column: 1 / -1;
    text-align: center;
    color: #666;
}

.font-card {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    background: #fafafa;
}

.font-card__name {
    font-size: 1.1rem;
    font-weight: 600;
}

.font-card__meta {
    color: #666;
    font-size: 0.8rem;
}

.font-card button {
    align-self: flex-start;
    margin-top: 0.25rem;
}

body.inverted {
    background: #05060a;
    color: #f5f5f5;
}

body.inverted .controls-pane {
    background: #090b10;
    color: #f5f5f5;
}

body.inverted .mode-toggle {
    background: #090b10;
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

body.inverted .controls-pane legend {
    color: #f5f5f5;
}

body.inverted input,
body.inverted select,
body.inverted textarea {
    background: #0f111a;
    border-color: rgba(255, 255, 255, 0.2);
    color: #f5f5f5;
}

body.inverted .preview-toolbar select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23f5f5f5' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
}

body.inverted fieldset {
    background: #0f111a;
    border-color: rgba(255, 255, 255, 0.1);
}

body.inverted .ghost-button {
    border-color: rgba(255, 255, 255, 0.2);
    color: #f5f5f5;
}

body.inverted .ghost-button:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.4);
}

body.inverted .ghost-button:focus {
    outline: 2px solid rgba(255, 255, 255, 0.6);
    outline-offset: 2px;
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.4);
}

body.inverted .primary:hover {
    background: #0066dd;
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.5);
}

body.inverted .primary:focus {
    outline: 3px solid rgba(124, 195, 255, 0.6);
    outline-offset: 2px;
    background: #0066dd;
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.5);
}

body.inverted .actions-toolbar {
    background: rgba(9, 11, 16, 0.95);
    border-top-color: rgba(255, 255, 255, 0.1);
}

body.inverted .google-font-chip {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    color: #f5f5f5;
}

body.inverted .font-browser__dialog {
    background: #0f111a;
    color: #f5f5f5;
}

body.inverted .font-card {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.1);
}

body.inverted .share-dialog__panel {
    background: #0f111a;
    color: #f5f5f5;
}

body.inverted .share-dialog__header {
    border-bottom-color: rgba(255, 255, 255, 0.1);
    color: #f5f5f5 !important;
}

body.inverted .share-dialog__header h2 {
    color: #f5f5f5 !important;
}

body.inverted .share-dialog__header p {
    color: rgba(255, 255, 255, 0.7) !important;
}

body.inverted .share-dialog__header button {
    color: #f5f5f5 !important;
}

body.inverted .share-form__status {
    color: rgba(255, 255, 255, 0.85);
}

body.inverted .site-header {
    background: #0f111a !important;
    border-bottom-color: rgba(255, 255, 255, 0.1) !important;
    color: #f5f5f5 !important;
}

body.inverted .brand-logo {
    color: #f5f5f5 !important;
}

body.inverted .brand-links a {
    color: rgba(255, 255, 255, 0.7) !important;
}

body.inverted .brand-links a:hover {
    color: #0aa0d2 !important;
}

/* Custom CSS Editor Overlay */
.custom-css-overlay {
    position: fixed;
    top: var(--header-height);
    right: 0;
    width: var(--sidebar-width);
    bottom: 0;
    background: transparent;
    display: none;
    z-index: 25;
    padding: 0;
    pointer-events: none;
}

.custom-css-overlay[aria-hidden='false'] {
    display: block;
}

.custom-css-editor {
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-sidebar);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    pointer-events: auto;
}

.custom-css-editor__header {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    flex-shrink: 0;
    /* Fixed typography to prevent preview styles from affecting header */
    font-family: var(--ui-font-family) !important;
    font-size: 15px !important;
    line-height: 1.4 !important;
    color: #111 !important;
}

.custom-css-editor__header h2 {
    margin: 0;
    /* Fixed typography */
    font-family: var(--ui-font-family) !important;
    font-size: 20px !important;
    font-weight: 600 !important;
    line-height: 1.4 !important;
    color: #111 !important;
}

.custom-css-editor__header p {
    margin: 0.35rem 0 0;
    color: #555 !important;
    font-size: 14px !important;
    /* Fixed typography */
    font-family: var(--ui-font-family) !important;
    line-height: 1.4 !important;
    font-weight: normal !important;
}

.custom-css-editor__actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.custom-css-editor__header button {
    border: none;
    background: transparent;
    font-size: 28px !important;
    line-height: 1 !important;
    cursor: pointer;
    /* Fixed typography */
    font-family: var(--ui-font-family) !important;
    color: #111 !important;
    font-weight: normal !important;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.custom-css-editor__header button:hover {
    background: rgba(0, 0, 0, 0.05);
}

.custom-css-editor__header button svg {
    width: 20px;
    height: 20px;
    display: block;
}

.custom-css-editor__actions .ghost-button {
    font-size: 14px !important;
    padding: 0.35rem 0.9rem !important;
    margin: 0 !important;
}

.custom-css-editor__status {
    padding: 0.5rem 1.5rem;
    font-size: 0.85rem;
    min-height: 1.5rem;
    flex-shrink: 0;
    font-family: var(--ui-font-family);
}

.custom-css-editor__status.error {
    color: #c0392b;
    background: rgba(192, 57, 43, 0.1);
}

.custom-css-editor__status.success {
    color: #1c7c54;
    background: rgba(28, 124, 84, 0.1);
}

.custom-css-info-button {
    margin-right: 0.5rem;
}

.custom-css-info-button[hidden] {
    display: none !important;
}

.custom-css-info-button .icon-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 999px;
    border: 1px solid currentColor;
    font-size: 0.9rem;
    font-weight: 600;
}

/* Custom CSS error modal */
.custom-css-error-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.custom-css-error-modal[aria-hidden='false'] {
    display: flex;
}

.custom-css-error-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
}

.custom-css-error-modal__dialog {
    position: relative;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
    padding: 1.25rem 1.5rem 1rem;
    max-width: 520px;
    width: calc(100% - 2rem);
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    z-index: 1;
}

.custom-css-error-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.custom-css-error-modal__body {
    font-size: 0.9rem;
    line-height: 1.4;
    overflow: auto;
    padding: 0.25rem 0;
}

.custom-css-error-list {
    margin: 0.5rem 0 0;
    padding-left: 1.1rem;
}

.custom-css-error-list li {
    margin-bottom: 0.35rem;
}

.custom-css-error-list code {
    font-family: var(--mono-font-family);
    font-size: 0.85em;
}

.custom-css-error-modal__footer {
    margin-top: 0.75rem;
    display: flex;
    justify-content: flex-end;
}

.custom-css-editor__container {
    flex: 1;
    overflow: hidden;
    position: relative;
    min-height: 0;
}

.custom-css-editor__container textarea {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    border: none;
    padding: 1rem;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    resize: none;
    background: transparent;
    color: #111;
}

/* CodeMirror overrides */
.custom-css-editor__container .CodeMirror {
    height: 100%;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    box-shadow: none !important;
}

/* Remove drop shadows from code blocks in Custom CSS editor */
.custom-css-editor__container .CodeMirror,
.custom-css-editor__container .CodeMirror-scroll,
.custom-css-editor__container .CodeMirror-sizer,
.custom-css-editor__container .CodeMirror-lines,
.custom-css-editor__container .CodeMirror-line,
.custom-css-editor__container code,
.custom-css-editor__container pre {
    box-shadow: none !important;
    filter: none !important;
}

.custom-css-editor__container .CodeMirror-scroll {
    min-height: 100%;
}

.custom-css-editor__container .CodeMirror-gutters {
    border-right: 1px solid var(--border-color);
    background: var(--bg-muted);
}

.custom-css-editor__container .CodeMirror-linenumber {
    color: #999;
}

/* Error line highlighting */
.custom-css-editor__container .CodeMirror-line.error-line {
    background: rgba(192, 57, 43, 0.1);
}

.custom-css-editor__container .CodeMirror-line.error-line .CodeMirror-linenumber {
    background: rgba(192, 57, 43, 0.2);
    color: #c0392b;
    font-weight: 600;
}

body.inverted .custom-css-editor {
    background: #090b10;
    color: #f5f5f5;
}

body.inverted .custom-css-editor__header {
    border-bottom-color: rgba(255, 255, 255, 0.1);
    color: #f5f5f5 !important;
}

body.inverted .custom-css-editor__header h2 {
    color: #f5f5f5 !important;
}

body.inverted .custom-css-editor__header p {
    color: rgba(255, 255, 255, 0.7) !important;
}

body.inverted .custom-css-editor__header button {
    color: #f5f5f5 !important;
}

body.inverted .custom-css-editor__header button:hover {
    background: rgba(255, 255, 255, 0.1);
}

body.inverted .custom-css-editor__container textarea {
    background: transparent;
    color: #f5f5f5;
}

/* Ensure CodeMirror hints appear above the editor */
.CodeMirror-hints {
    z-index: 1000 !important;
    max-height: 300px;
    overflow-y: auto;
}

body.inverted .CodeMirror-hints {
    background: #1e1e1e;
    color: #d4d4d4;
    border: 1px solid #3e3e3e;
}

body.inverted .CodeMirror-hint {
    color: #d4d4d4;
}

body.inverted .CodeMirror-hint-active {
    background: #007aff;
    color: #fff;
}

body.inverted .custom-css-editor__container .CodeMirror {
    background: #090b10;
    color: #f5f5f5;
}

body.inverted .custom-css-editor__container .CodeMirror-gutters {
    background: #0f111a;
    border-right-color: rgba(255, 255, 255, 0.1);
}

body.inverted .custom-css-editor__container .CodeMirror-linenumber {
    color: rgba(255, 255, 255, 0.5);
}

body.inverted .custom-css-editor__container .CodeMirror-line.error-line {
    background: rgba(192, 57, 43, 0.2);
}

body.inverted .custom-css-editor__container .CodeMirror-line.error-line .CodeMirror-linenumber {
    background: rgba(192, 57, 43, 0.3);
    color: #ff6b6b;
}

body.inverted .custom-css-editor__status.error {
    background: rgba(192, 57, 43, 0.2);
    color: #ff6b6b;
}

body.inverted .custom-css-editor__status.success {
    background: rgba(28, 124, 84, 0.2);
    color: #4ade80;
}

body.inverted .css-popover__dialog {
    background: #0f111a;
    color: #f5f5f5;
}

body.inverted .css-popover__dialog header {
    border-bottom-color: rgba(255, 255, 255, 0.1);
    color: #f5f5f5 !important;
}

body.inverted .css-popover__dialog header h2 {
    color: #f5f5f5 !important;
}

body.inverted .copy-button {
    color: rgba(255, 255, 255, 0.7);
}

body.inverted .copy-button:hover {
    color: #7cc3ff;
    background: rgba(124, 195, 255, 0.1);
}

body.inverted .copy-button.copied {
    color: #4ade80;
}

body.inverted .css-popover__dialog textarea {
    background: #0f111a;
    color: #f5f5f5;
}

body.inverted #closeCssPopover {
    color: #f5f5f5;
}

.narrow-viewport-banner {
    display: none;
    position: sticky;
    top: var(--header-height);
    z-index: 15;
    background: #ffeec2;
    border-bottom: 1px solid rgba(134, 85, 0, 0.2);
    padding: 10px 15px;
    font-family: var(--ui-font-family);
    font-size: var(--ui-font-size);
    line-height: 1.4;
}

.narrow-viewport-banner__content {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 1200px;
    margin: 0 auto;
    color: #865500;
}

.narrow-viewport-banner__icon {
    flex-shrink: 0;
    font-size: 18px;
}

.narrow-viewport-banner__text {
    flex: 1;
    font-weight: 500;
}

@media (max-width: 1100px) {
    .narrow-viewport-banner {
        display: block;
    }

    .workspace {
        grid-template-columns: 100%;
    }

    .controls-pane {
        order: -1;
    }
}

/* Toast notification animations */
@keyframes toastSlideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes toastSlideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

@media (max-width: 700px) {
    .brand-links {
        width: 100%;
        justify-content: space-between;
    }

    .brand-nav {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Color Picker Styles */
.color-picker {
    position: fixed;
    z-index: 10000;
    width: 400px;
    min-height: 280px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    /* Checkerboard pattern for transparency visualization - rendered first (behind) */
    background-image: linear-gradient(45deg, rgba(204, 204, 204, 0.25) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(204, 204, 204, 0.25) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(204, 204, 204, 0.25) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(204, 204, 204, 0.25) 75%);
    background-size: 12px 12px;
    background-position:
        0 0,
        0 6px,
        6px -6px,
        -6px 0px;
    /* Base background color will be set dynamically via inline style - renders on top of checkerboard */
    background-color: #ffffff;
    /* Ensure background-color is on top of background-image */
    background-blend-mode: normal;
}

.color-picker-content {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 6px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    z-index: 1;
}

.color-picker-sliders {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.color-picker-slider-label {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    font-size: 12px;
}

.color-picker-slider-label > span:first-child {
    font-weight: 600;
    color: #333;
    width: 80px;
    flex-shrink: 0;
}

.color-picker-slider-wrapper {
    flex: 1;
    position: relative;
    height: 20px;
    display: flex;
    align-items: center;
    border-radius: 10px;
    overflow: hidden;
}

.color-picker-slider-label input[type='range'] {
    width: 100%;
    height: 20px;
    border-radius: 10px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
    padding: 0;
    position: relative;
    z-index: 2;
    background: transparent;
}

.color-picker-slider-label input[type='range']::-webkit-slider-runnable-track {
    width: 100%;
    height: 20px;
    border-radius: 10px;
    background: transparent;
}

.color-picker-slider-label input[type='range']::-moz-range-track {
    width: 100%;
    height: 20px;
    border-radius: 10px;
    background: transparent;
}

.color-picker-slider-label input[type='range']::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ffffff;
    cursor: pointer;
    border: 2px solid rgba(0, 0, 0, 0.2);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 2;
}

.color-picker-slider-label input[type='range']::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ffffff;
    cursor: pointer;
    border: 2px solid rgba(0, 0, 0, 0.2);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 2;
}

.color-picker-slider-label input[type='range']::-moz-range-track {
    background: transparent;
    height: 20px;
    border-radius: 10px;
}

.color-picker-slider-label input[type='range']:focus {
    outline: none;
}

.color-picker-slider-label input[type='range']:focus::-webkit-slider-thumb {
    box-shadow:
        0 0 0 3px rgba(45, 123, 244, 0.3),
        0 1px 3px rgba(0, 0, 0, 0.3);
}

.color-picker-slider-label input[type='range']:focus::-moz-range-thumb {
    box-shadow:
        0 0 0 3px rgba(45, 123, 244, 0.3),
        0 1px 3px rgba(0, 0, 0, 0.3);
}

.color-picker-hex-container {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
}

.color-picker-hex-container label {
    font-size: 12px;
    font-weight: 600;
    color: #333;
    width: 80px;
    flex-shrink: 0;
}

.color-picker-hex-container input {
    flex: 1;
    padding: 6px 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: 'SFMono-Regular', Consolas, monospace;
    font-size: 12px;
    width: 12ch;
}

.color-picker-hex-container input:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.color-picker-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 4px;
}

.color-picker-apply,
.color-picker-cancel,
.color-picker-clear {
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.2s;
}

.color-picker-clear {
    background: #fff;
    color: #666;
    border-color: var(--border-color);
    margin-right: auto;
}

.color-picker-clear:hover {
    background: #f5f5f5;
    color: #333;
}

.color-picker-apply {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.color-picker-apply:hover {
    background: #1e6fe0;
}

.color-picker-apply:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.color-picker-cancel {
    background: #fff;
    color: #333;
}

.color-picker-cancel:hover {
    background: #f5f5f5;
}

.color-picker-cancel:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
