:root {
    color-scheme: light;
    --canvas: #f3f5f7;
    --surface: #ffffff;
    --surface-soft: #f8fafb;
    --surface-muted: #edf1f4;
    --ink: #1c232b;
    --muted: #687480;
    --quiet: #87919b;
    --line: #d9e0e7;
    --line-strong: #c4ccd5;
    --accent: #bd5638;
    --accent-strong: #984129;
    --accent-soft: #fff0ea;
    --ok: #21745a;
    --danger: #b3261e;
    --focus: #2d6cdf;
    --shadow: 0 18px 42px rgba(30, 38, 46, 0.08);
    --mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-family: var(--sans);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-width: 320px;
    min-height: 100dvh;
    background: var(--canvas);
    color: var(--ink);
}

button,
input,
select,
pre,
a,
textarea {
    font: inherit;
}

.app {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    min-height: 100dvh;
}

.topbar {
    display: grid;
    grid-template-columns: minmax(360px, 1fr) auto;
    gap: 24px;
    align-items: center;
    padding: 14px 22px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
    box-shadow: var(--shadow);
    z-index: 2;
}

.brand {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 16px;
}

.brand-image {
    width: 154px;
    height: 76px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    object-fit: contain;
}

.brand-copy {
    display: grid;
    min-width: 0;
    gap: 5px;
}

.brand-copy strong {
    font-size: 24px;
    line-height: 1;
}

.brand-copy span {
    overflow: hidden;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.top-right {
    display: grid;
    justify-items: end;
    gap: 10px;
}

.headline {
    display: grid;
    justify-items: end;
    gap: 4px;
    text-align: right;
}

.headline span {
    color: var(--accent);
    font-size: 12px;
    font-weight: 750;
    line-height: 1.2;
    text-transform: uppercase;
}

.headline strong {
    max-width: 390px;
    font-size: 16px;
    line-height: 1.25;
}

.top-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.top-link {
    display: inline-flex;
    min-height: 32px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface-soft);
    color: var(--ink);
    padding: 0 10px;
    font-size: 13px;
    font-weight: 750;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
}

.top-link:hover {
    border-color: var(--line-strong);
    background: var(--surface-muted);
}

.commandbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 16px;
    align-items: end;
    padding: 14px 22px;
    border-bottom: 1px solid var(--line);
    background: var(--surface-soft);
}

.settings {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.settings label {
    display: grid;
    gap: 5px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.2;
}

.settings select,
.settings input {
    height: 38px;
    min-width: 96px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
    color: var(--ink);
    padding: 0 10px;
}

.settings select {
    min-width: 126px;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.button {
    display: inline-flex;
    height: 38px;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 0 14px;
    cursor: pointer;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

.button:disabled {
    cursor: not-allowed;
    opacity: 0.58;
}

.button.primary {
    background: var(--accent);
    color: #ffffff;
}

.button.primary:hover:not(:disabled) {
    background: var(--accent-strong);
}

.button.secondary {
    border-color: var(--line);
    background: var(--surface);
    color: var(--ink);
}

.button.secondary:hover:not(:disabled) {
    border-color: var(--line-strong);
    background: var(--surface-muted);
}

.button.copied {
    border-color: rgba(33, 116, 90, 0.28);
    background: #e9f7f0;
    color: var(--ok);
}

.button:focus-visible,
.top-link:focus-visible,
.example-item:focus-visible,
.settings select:focus-visible,
.settings input:focus-visible,
.code-preview:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

.workspace {
    display: grid;
    grid-template-columns: 312px minmax(0, 1fr);
    gap: 16px;
    min-height: 0;
    padding: 16px;
}

.examples-panel,
.editor-panel {
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.examples-panel {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
}

.example-list {
    display: grid;
    align-content: start;
    gap: 8px;
    overflow: auto;
    padding: 10px;
}

.example-item {
    display: grid;
    gap: 6px;
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--surface-soft);
    color: var(--ink);
    padding: 11px 12px;
    cursor: pointer;
    text-align: left;
}

.example-item:hover {
    border-color: var(--line-strong);
    background: var(--surface);
}

.example-item[aria-current="true"] {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.example-title {
    font-size: 14px;
    font-weight: 750;
    line-height: 1.25;
}

.example-detail {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.35;
}

.editors {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
    min-width: 0;
    min-height: 0;
}

.editor-panel {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
}

.panel-head {
    display: flex;
    min-height: 46px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 13px;
    border-bottom: 1px solid var(--line);
    background: var(--surface-muted);
}

.panel-head.compact {
    min-height: 44px;
}

.panel-head h1 {
    margin: 0;
    font-size: 15px;
    line-height: 1.2;
}

.panel-head span {
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
}

textarea,
.code-preview {
    width: 100%;
    min-width: 0;
    min-height: 0;
    border: 0;
    margin: 0;
    padding: 15px;
    font-family: var(--mono);
    font-size: 14px;
    line-height: 1.58;
    tab-size: 4;
    white-space: pre;
}

textarea {
    resize: none;
    background: #fcfdfe;
    color: var(--ink);
}

.code-preview {
    overflow: auto;
    background: #121416;
    color: #d7dee8;
}

.tok-muted {
    color: #7f8994;
}

.tok-text {
    color: #d7dee8;
}

.tok-punctuation {
    color: #7f8994;
}

.tok-tag {
    color: #ff7a7a;
}

.tok-attr {
    color: #f0c36a;
}

.tok-string {
    color: #9bd67a;
}

.tok-php-open,
.tok-php-close {
    color: #b891ff;
}

.tok-keyword {
    color: #ff6fb1;
}

.tok-variable {
    color: #74d6ff;
}

.tok-number {
    color: #ffb86b;
}

.tok-operator {
    color: #b9c2cc;
}

.tok-class {
    color: #7ad7cb;
}

.tok-identifier {
    color: #d7dee8;
}

.statusbar {
    display: flex;
    min-height: 40px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 22px;
    border-top: 1px solid var(--line);
    background: var(--surface);
    color: var(--muted);
    font-size: 13px;
}

.statusbar [data-tone="ok"] {
    color: var(--ok);
}

.statusbar [data-tone="danger"] {
    color: var(--danger);
}

@media (max-width: 1180px) {
    .workspace {
        grid-template-columns: 270px minmax(0, 1fr);
    }

    .editors {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(340px, 1fr) minmax(340px, 1fr);
    }
}

@media (max-width: 920px) {
    .topbar,
    .commandbar {
        grid-template-columns: 1fr;
    }

    .top-right,
    .headline {
        justify-items: start;
        text-align: left;
    }

    .top-links {
        justify-content: flex-start;
    }

    .actions {
        justify-content: flex-start;
    }

    .workspace {
        grid-template-columns: 1fr;
        grid-template-rows: auto minmax(0, 1fr);
    }

    .examples-panel {
        min-height: 210px;
        max-height: 310px;
    }
}

@media (max-width: 560px) {
    .topbar,
    .commandbar {
        padding-right: 12px;
        padding-left: 12px;
    }

    .workspace {
        gap: 12px;
        padding: 12px;
    }

    .brand-image {
        width: 128px;
        height: 64px;
    }

    .headline strong {
        font-size: 15px;
    }

    .button {
        flex: 1 1 148px;
    }

    .settings label {
        flex: 1 1 126px;
    }

    .settings select,
    .settings input {
        width: 100%;
    }

    .statusbar {
        align-items: flex-start;
        flex-direction: column;
        padding-right: 12px;
        padding-left: 12px;
    }
}
