.rt-stage {
    position: relative;
    aspect-ratio: 1280 / 720;
    container-type: inline-size;
}

.rt-mock {
    --m-primary: #1f1f1f;
    --m-secondary: #74777c;
    --m-tertiary: #8d9196;
    --m-shell: #f8f8f8;
    --m-editor: #ffffff;
    --m-material: #ffffff;
    --m-highlight: #eeeeee;
    --m-page: #ffffff;
    --m-stroke: rgba(0, 0, 0, 0.08);
    --m-stroke-strong: rgba(0, 0, 0, 0.22);
    --m-accent: #1f1f1f;
    --m-on-accent: #ffffff;
    --m-tint: rgba(0, 0, 0, 0.07);
    --m-card-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.03), 0 8px 24px -12px rgba(0, 0, 0, 0.05);
    --m-pill-bg: rgba(255, 255, 255, 0.58);
    --m-pill-shadow: 0 2px 12px -4px rgba(0, 0, 0, 0.08), 0 10px 34px -12px rgba(0, 0, 0, 0.12);
    --m-hl-number: #6c4024;
    --m-hl-keyword: #5856d6;
    --m-hl-string: #007000;
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1280px;
    height: 720px;
    transform-origin: center center;
    transform: translate(-50%, -50%) scale(min(1, 100cqw / 1280px));
    display: flex;
    background: var(--m-editor);
    border-radius: 40px;
    box-shadow: 0 0 0 1px var(--m-stroke);
    overflow: hidden;
    font-family: var(--font-sans);
    font-size: 13px;
    color: var(--m-primary);
    user-select: none;
    pointer-events: none;
    text-align: left;
}

@media (prefers-color-scheme: dark) {
    .rt-mock {
        --m-primary: #eeeeee;
        --m-secondary: #c7c7c7;
        --m-tertiary: #969ca2;
        --m-shell: #1c1c1c;
        --m-editor: #131313;
        --m-material: #1c1c1c;
        --m-highlight: #2c2c2c;
        --m-page: #161616;
        --m-stroke: rgba(255, 255, 255, 0.08);
        --m-stroke-strong: rgba(255, 255, 255, 0.22);
        --m-accent: #eeeeee;
        --m-on-accent: #1f1f1f;
        --m-tint: rgba(255, 255, 255, 0.1);
        --m-card-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.18), 0 10px 28px -12px rgba(0, 0, 0, 0.25);
        --m-pill-bg: rgba(64, 64, 64, 0.58);
        --m-pill-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.14), 0 2px 12px -4px rgba(0, 0, 0, 0.36), 0 10px 34px -12px rgba(0, 0, 0, 0.48);
        --m-hl-number: #f2c685;
        --m-hl-keyword: #b9a8ff;
        --m-hl-string: #9dcb9d;
    }
}

.rt-shell {
    position: relative;
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    margin: 8px 0 8px 8px;
    border-radius: 32px;
    background: var(--m-shell);
    box-shadow: var(--m-card-shadow);
    overflow: hidden;
}

.rt-shell::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 32px;
    box-shadow: inset 0 0 0 1px var(--m-stroke);
    pointer-events: none;
    z-index: 10;
}

.rt-top {
    position: absolute;
    top: 12px;
    left: 12px;
    right: 12px;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.rt-pill {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
    padding: 4px;
    border-radius: 999px;
    background: var(--m-pill-bg);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    backdrop-filter: blur(24px) saturate(180%);
    box-shadow: var(--m-pill-shadow);
}

.rt-tools {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.rt-left-group {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
    max-width: calc(50% - 120px);
}

.rt-right-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.rt-address {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 14px;
    font-weight: 500;
}

.rt-icon-button {
    position: relative;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--m-primary);
}

.rt-icon-button svg {
    display: block;
    width: 16px;
    height: 16px;
}

.rt-icon-button.is-pressed {
    background: var(--m-accent);
    color: var(--m-on-accent);
}

.rt-sep {
    width: 1px;
    height: 18px;
    margin: 0 4px;
    flex-shrink: 0;
    background: var(--m-stroke);
}

.rt-zoom-pill {
    position: absolute;
    bottom: 12px;
    left: 12px;
    z-index: 3;
}

.rt-zoom-value {
    min-width: 48px;
    padding: 0 2px;
    flex-shrink: 0;
    text-align: center;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    color: var(--m-primary);
}

.rt-view-pill {
    position: absolute;
    bottom: 12px;
    right: 12px;
    z-index: 3;
}

.rt-canvas {
    position: relative;
    flex: 1;
    display: flex;
    align-items: flex-start;
    gap: 24px;
    padding: 82px 24px 72px;
    overflow: hidden;
    background-image: radial-gradient(circle at calc(100% - 2px) calc(100% - 2px), rgba(144, 144, 144, 0.15) 1px, transparent 1.5px);
    background-size: 24px 24px;
}

.rt-canvas::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 72px;
    background: linear-gradient(to bottom, var(--m-shell), transparent);
}

.rt-frame {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
    min-width: 0;
}

.rt-frame-header {
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.rt-frame-label {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 12px;
    font-weight: 500;
    color: var(--m-secondary);
}

.rt-frame-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
    color: var(--m-secondary);
}

.rt-frame-actions svg {
    display: block;
    width: 14px;
    height: 14px;
    margin: 0 4px;
}

.rt-frame-viewport {
    position: relative;
    overflow: hidden;
    border-radius: 6px;
    background: var(--m-page);
    box-shadow: 0 0 0 1px var(--m-stroke), var(--m-card-shadow);
}

.rt-frame.is-focused .rt-frame-viewport {
    box-shadow:
        0 0 0 1px var(--m-stroke),
        0 0 0 3px color-mix(in srgb, var(--m-primary) 14%, transparent),
        var(--m-card-shadow);
}

.rt-frame-phone {
    width: 144px;
}

.rt-frame-tablet {
    width: 320px;
}

.rt-frame-laptop {
    width: 512px;
}

.rt-frame-phone .rt-frame-viewport {
    height: 320px;
}

.rt-frame-tablet .rt-frame-viewport {
    height: 512px;
}

.rt-frame-laptop .rt-frame-viewport {
    height: 320px;
}

.rt-frame-viewport iframe {
    display: block;
    border: 0;
    transform-origin: top left;
}

.rt-frame-phone iframe {
    width: 360px;
    height: 800px;
    transform: scale(0.4);
}

.rt-frame-tablet iframe {
    width: 800px;
    height: 1280px;
    transform: scale(0.4);
}

.rt-frame-laptop iframe {
    width: 1280px;
    height: 800px;
    transform: scale(0.4);
}

.rt-editor {
    width: 360px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    padding-top: 8px;
    background: var(--m-editor);
    overflow: hidden;
}

.rt-editor-header {
    height: 64px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 0 8px 0 16px;
    box-shadow: 0 1px 0 0 var(--m-stroke);
}

.rt-editor-selector {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-family: var(--font-mono);
    font-size: 12px;
}

.rt-editor .rt-icon-button.is-disabled {
    opacity: 0.4;
}

.rt-editor-sections {
    flex: 1;
    overflow: hidden;
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.5;
}

.rt-section-header {
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0 8px 0 16px;
    background: var(--m-editor);
    border-bottom: 1px solid var(--m-stroke);
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 500;
    color: var(--m-secondary);
}

.rt-section-add {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--m-primary);
}

.rt-section-add svg {
    display: block;
    width: 16px;
    height: 16px;
}

.rt-rule {
    padding: 10px 0;
    border-bottom: 1px solid var(--m-stroke);
}

.rt-rule-selector {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    padding: 0 16px;
    color: var(--m-secondary);
}

.rt-rule-selector-text {
    color: var(--m-primary);
    font-weight: 500;
}

.rt-rule-source {
    flex-shrink: 0;
    font-size: 11px;
    color: var(--m-tertiary);
    text-decoration: underline dotted;
}

.rt-decl {
    padding: 1px 16px 1px 28px;
    color: var(--m-secondary);
    word-break: break-word;
}

.rt-decl-prop {
    color: var(--m-primary);
}

.rt-decl .number {
    color: var(--m-hl-number);
}

.rt-decl .keyword {
    color: var(--m-hl-keyword);
}

.rt-decl .string {
    color: var(--m-hl-string);
}

.rt-decl-value.is-editing {
    outline: 1px solid var(--m-accent);
    background: var(--m-material);
}

.rt-rule-close {
    padding: 0 16px;
    color: var(--m-secondary);
}
