.mt-page {
    --mt-ink: #f2f7f5;
    --mt-muted: #b1c0b9;
    --mt-accent: #82e3c1;
    --mt-line: #34463e;
    --mt-surface: #16201c;
    width: min(1296px, calc(100% - 48px));
    margin-inline: auto;
    padding-bottom: clamp(28px, 5vw, 58px);
    color: var(--mt-ink);
}

.mt-page :is(h1, h2, h3, p, dl, dd) { margin: 0; }
.mt-page [id] { scroll-margin-top: 15px; }
.mt-page .mt-crumb { margin-bottom: 17px; }
.mt-page-link { display: inline-flex; align-items: center; gap: 7px; width: fit-content; color: var(--mt-accent); font-size: .84rem; font-weight: 710; text-decoration: none; }
.mt-page-link:hover { color: #b9f7e2; text-decoration: underline; text-underline-offset: 3px; }
.mt-page-link i { font-size: .83em; }
.mt-intro { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 9px 18px; margin-bottom: 16px; }
.mt-intro h1 { font-size: clamp(2.15rem, 4.55vw, 4.3rem); line-height: 1.03; font-weight: 800; letter-spacing: -.063em; }
.mt-intro p { margin-top: 8px; color: var(--mt-muted); font-size: clamp(.91rem, 1.5vw, 1.04rem); line-height: 1.54; }
.mt-intro > a { margin-bottom: 3px; }

.mt-lab { overflow: clip; border: 1px solid #3c5549; border-radius: 21px; background: radial-gradient(ellipse at 12% 0, #23392f, transparent 53%), #121b17; }
.mt-lab [hidden] { display: none !important; }
.mt-toolbar { position: relative; z-index: 6; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 9px 16px; padding: 11px clamp(12px, 2.1vw, 24px); border-bottom: 1px solid var(--mt-line); background: #1d2b25; }
.mt-tool-title, .mt-actions, .mt-result-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.mt-tool-title { flex-wrap: nowrap; gap: 9px; }
.mt-tool-icon { display: grid; place-items: center; width: 39px; aspect-ratio: 1; flex: 0 0 39px; border: 1px solid #527165; border-radius: 11px; background: #31473e; color: var(--mt-accent); }
.mt-tool-title h2 { font-size: .99rem; font-weight: 780; line-height: 1.19; }
.mt-tool-title .mt-status { display: flex; align-items: center; gap: 6px; margin-top: 3px; color: #bfcec6; font-size: .72rem; }
.mt-status::before { content: ''; width: 6px; height: 6px; flex: 0 0 6px; border-radius: 50%; background: #81968a; }
.mt-status:is([data-state="active"], [data-state="finished"])::before { background: var(--mt-accent); box-shadow: 0 0 0 3px #82e3c125; }
.mt-status[data-state="paused"]::before { background: #e2be83; }
.mt-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 41px; padding: 7px 11px; border: 1px solid #4c5c54; border-radius: 9px; color: var(--mt-ink); background: #26342d; font-size: .8rem; font-weight: 720; line-height: 1.18; }
.mt-button:not(:disabled):hover { background: #30483d; border-color: #77b09b; }
.mt-button--primary { background: var(--mt-accent); color: #0e2a1e; border-color: transparent; }
.mt-button--primary:not(:disabled):hover { color: #0e2a1e; background: #a3efd5; border-color: transparent; }
.mt-button--finish:not(:disabled) { color: #cef4e4; background: #28483c; border-color: #588373; }
.mt-button--small { min-height: 36px; margin-top: 10px; }
.mt-button:disabled { opacity: .52; cursor: default; }
.mt-page :is(button, a, select, input, summary, [tabindex]):focus-visible { outline: 2px solid #99e8cc; outline-offset: 2px; }

.mt-body { padding: clamp(10px, 2vw, 22px) clamp(10px, 2.1vw, 24px); }
.mt-tabs { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 10px; }
.mt-tab { display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 41px; padding: 7px 12px; border: 1px solid #34463e; border-radius: 9px; color: #c0cec7; background: #1d2a24; font-size: .81rem; font-weight: 710; line-height: 1.17; }
.mt-tab i { color: #a6cbbd; }
.mt-tab:hover { background: #2a3e34; }
.mt-tab[aria-selected="true"] { border-color: #7abdac; background: #2a493d; color: #e1f7ee; }
.mt-tab[aria-selected="true"] i { color: var(--mt-accent); }
.mt-page .mt-fullscreen-note { margin-bottom: 8px; padding: 6px 8px; border-left: 2px solid #70bca6; color: #d4e6dd; background: #254136; font-size: .79rem; }
.mt-workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(254px, .375fr); align-items: stretch; gap: 9px; }
.mt-deck, .mt-readings { min-width: 0; border: 1px solid var(--mt-line); border-radius: 13px; background: #18241e; }
.mt-deck { display: flex; flex-direction: column; padding: 9px; }
.mt-settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 118px), 1fr)); gap: 7px; margin: 1px 0 8px; }
.mt-settings label { display: grid; gap: 4px; min-width: 0; color: #cfdbd5; font-size: .74rem; font-weight: 680; line-height: 1.25; }
.mt-settings select, .mt-range { width: 100%; min-width: 0; min-height: 38px; padding: 6px; border: 1px solid #495f54; border-radius: 7px; background: #222f28; color: var(--mt-ink); font-size: .8rem; color-scheme: dark; }
.mt-range { display: flex; align-items: center; gap: 6px; padding-inline: 8px; }
.mt-range input { min-width: 0; width: 100%; accent-color: var(--mt-accent); }
.mt-range:has(input:disabled) { opacity: .58; }
.mt-range output { width: 2.1em; flex: 0 0 2.1em; text-align: right; font-variant-numeric: tabular-nums; }
.mt-settings .mt-grid-toggle { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; }
.mt-grid-toggle input { width: 15px; height: 15px; margin: 0; accent-color: var(--mt-accent); }

.mt-stage {
    --mt-field-height: clamp(296px, 32vw, 440px);
    position: relative;
    isolation: isolate;
    flex: 1;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    min-height: var(--mt-field-height);
    overflow: hidden;
    padding: 10px 12px 12px;
    border: 1px solid #476458;
    border-radius: 10px;
    background-color: #101a16;
    background-image: radial-gradient(ellipse at 49% 45%, #25473a 0%, #152820 50%, transparent 76%), radial-gradient(circle at 1px 1px, #8fc5b72e 1px, transparent 0);
    background-size: auto, 21px 21px;
    user-select: none;
    -webkit-user-select: none;
}
.mt-lab.is-running .mt-stage { border-color: #71b8a3; cursor: crosshair; }
.mt-stage-label, .mt-stage-art, .mt-stage-prompt, .mt-trace { pointer-events: none; }
.mt-stage .mt-stage-label { grid-row: 1; z-index: 1; display: flex; align-items: center; gap: 6px; width: fit-content; height: fit-content; padding: 3px 7px; border: 1px solid #4c6b5e; border-radius: 7px; background: #162920; color: #c3dbcf; font-size: .72rem; font-weight: 680; }
.mt-stage-label span { width: 6px; height: 6px; border-radius: 50%; background: #90a99c; }
.mt-lab.is-running .mt-stage-label span { background: var(--mt-accent); box-shadow: 0 0 0 3px #7ce2c12f; }
.mt-stage-art { grid-row: 2; position: relative; display: grid; place-items: center; min-height: 0; }
.mt-stage .mt-stage-prompt { grid-row: 3; z-index: 1; justify-self: center; padding: 6px 9px; border: 1px solid #52716482; border-radius: 7px; background: #12221be8; color: #dcece4; text-align: center; font-size: .77rem; font-weight: 630; line-height: 1.33; }
.mt-stage-footer { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 2px 10px; padding: 7px 1px 0; min-height: 24px; color: #b8c9c0; font-size: .72rem; }
.mt-stage-footer span:first-child { color: #d2f0e3; font-weight: 670; }
.mt-stage-footer i { color: var(--mt-accent); }

.mt-device {
    --mt-device-height: clamp(178px, calc(var(--mt-field-height) * .67), 285px);
    position: relative;
    width: calc(var(--mt-device-height) * .63);
    height: var(--mt-device-height);
    transform: perspective(730px) rotateX(var(--mt-angle, 26deg)) rotateY(-10deg) rotateZ(-13deg);
    transform-style: preserve-3d;
    transition: transform .2s ease;
}
.mt-lab[data-view="top"] .mt-device { transform: none; }
.mt-device-body { position: absolute; inset: 0; border: 1px solid #729187; border-radius: 48% 48% 45% 45% / 26% 26% 40% 40%; background: radial-gradient(ellipse at 38% 65%, #52645d, #253830 61%, #12231b 86%); box-shadow: inset 0 1px 1px #c2e4d28c, inset 0 -7px 10px #0b1812e0, 0 4px 0 #243c32, 0 10px 0 #10231b, 0 13px 0 #355a4a, 8px 28px 25px #050f0ac7, 0 15px 29px #93ffc62a; }
.mt-device-key { position: absolute; top: 0; display: grid; place-items: end center; width: 48%; height: 46%; padding-bottom: 15%; border: 1px solid #5f8072; background: linear-gradient(155deg, #61746b, #3c4e46 34%, #273c33); color: #def0e8; font-size: clamp(.57rem, 1.1vw, .75rem); font-weight: 700; transform: translateZ(8px); box-shadow: inset 0 1px 0 #e0f9ed42, 0 5px 0 #17291f, 0 6px 0 #4e7464; transition: background .13s, transform .13s; }
.mt-device-key--left { left: 0; border-radius: 95% 12% 13% 16% / 51% 8% 13% 17%; }
.mt-device-key--right { right: 0; border-radius: 12% 95% 16% 13% / 8% 51% 17% 13%; }
.mt-lab[data-mapping="reversed"] .mt-device-key--left { left: auto; right: 0; border-radius: 12% 95% 16% 13% / 8% 51% 17% 13%; }
.mt-lab[data-mapping="reversed"] .mt-device-key--right { right: auto; left: 0; border-radius: 95% 12% 13% 16% / 51% 8% 13% 17%; }
.mt-device-key.is-down { transform: translateZ(3px) translateY(2px); background: linear-gradient(155deg, #a3f4db, #559984); color: #0c2a20; }
.mt-device-wheel { position: absolute; top: 9%; left: 42.5%; display: grid; padding: 3px; width: 15%; height: 24%; border: 1px solid #6d9785; border-radius: 30% / 16%; background: #13271e; transform: translateZ(14px); box-shadow: 0 0 0 2px #12271d, 0 4px 2px #060e09; }
.mt-device-wheel span { border: 1px solid #548575; border-radius: inherit; background: repeating-linear-gradient(to bottom, #607a70 0 2px, #233d31 2px 6px); background-position-y: var(--mt-wheel-offset, 0px); }
.mt-device-wheel.is-down span, .mt-lab.is-wheeling .mt-device-wheel span { background-image: repeating-linear-gradient(to bottom, #94e9ce 0 2px, #3b7b64 2px 6px); box-shadow: 0 0 12px #95ffd177; }
.mt-device-side { position: absolute; left: -2.5%; height: 13%; width: 8%; border: 1px solid #64877a; border-radius: 40% / 18%; background: #3d5c4f; box-shadow: -2px 2px 0 #0e2218; transform: translateZ(4px); }
.mt-device-side--back { top: 53%; }
.mt-device-side--forward { top: 37%; }
.mt-device-side.is-down { background: var(--mt-accent); box-shadow: 0 0 11px #a2fbd6b5; }
.mt-device-logo { position: absolute; left: 50%; top: 69%; width: min(24%, 32px); height: auto; opacity: .72; border-radius: 7px; transform: translate(-50%, -50%) translateZ(8px); }

.mt-readings { padding: 12px 13px; }
.mt-readings h3 { font-size: .98rem; font-weight: 775; letter-spacing: -.012em; }
.mt-reading-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mt-pill { padding: 3px 7px; border: 1px solid #568575; border-radius: 999px; background: #233e32; color: #b4efd9; font-size: .73rem; font-weight: 735; font-variant-numeric: tabular-nums; }
.mt-progress { display: block; width: 100%; height: 5px; margin: 7px 0 9px; accent-color: var(--mt-accent); }
.mt-progress::-webkit-progress-bar { border-radius: 7px; background: #405247; }
.mt-progress::-webkit-progress-value { border-radius: 7px; background: var(--mt-accent); }
.mt-progress::-moz-progress-bar { border-radius: 7px; background: var(--mt-accent); }
.mt-signal-list { display: grid; gap: 4px; }
.mt-signal { display: grid; grid-template-columns: 7px minmax(0, 1fr) auto; gap: 7px; align-items: center; min-height: 29px; padding: 4px 7px; border: 1px solid #3a4e44; border-radius: 6px; background: #202f27; color: #e0eae5; font-size: .79rem; }
.mt-signal-dot { width: 6px; height: 6px; border-radius: 50%; background: #859a8e; }
.mt-signal.is-measured .mt-signal-dot, .mt-signal.is-down .mt-signal-dot { background: var(--mt-accent); }
.mt-signal.is-down, .mt-wheel-cell.is-down { border-color: #8edcbf; background: #315849; }
.mt-signal strong, .mt-wheel-cell strong { color: #e5f6f0; font-size: .83rem; font-variant-numeric: tabular-nums; }
.mt-wheel-heading { margin: 9px 0 5px; color: #d6e4dd; font-size: .77rem; font-weight: 720; }
.mt-wheel-heading i { margin-right: 3px; color: var(--mt-accent); }
.mt-wheel-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
.mt-wheel-cell { display: grid; justify-items: center; gap: 1px; min-width: 0; padding: 3px 1px; border: 1px solid #3a4e44; border-radius: 6px; background: #202f27; color: #c8d6ce; font-size: .78rem; line-height: 1.2; }
.mt-wheel-cell > span { color: #a9d9c7; }
.mt-wheel-cell > small { font-size: clamp(.59rem, 1.08vw, .71rem); }
.mt-page .mt-reading-note { margin-top: 8px; color: var(--mt-muted); font-size: .76rem; line-height: 1.48; }
.mt-main-reading { display: flex; flex-wrap: wrap; align-items: baseline; gap: 7px; margin: 13px 0 8px; color: var(--mt-accent); }
.mt-main-reading strong { font-size: clamp(1.65rem, 4.3vw, 3.5rem); font-weight: 790; letter-spacing: -.058em; line-height: 1; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.mt-main-reading span { color: #b4ccc1; font-size: .77rem; font-weight: 690; }
.mt-reading-list > div { display: flex; justify-content: space-between; gap: 8px; padding: 7px 0; border-bottom: 1px solid #35483f; }
.mt-reading-list dt { color: #bdcbc4; font-size: .77rem; font-weight: 650; }
.mt-reading-list dd { color: var(--mt-ink); font-size: .8rem; font-weight: 730; font-variant-numeric: tabular-nums; white-space: nowrap; }

.mt-clock { display: grid; place-items: center; width: clamp(132px, calc(var(--mt-field-height) * .59), 229px); aspect-ratio: 1; border: 1px solid #466757; border-radius: 50%; background: conic-gradient(#8fe9c8 var(--mt-clock-progress, 100%), #284538 0); box-shadow: 0 0 0 11px #335a482f, 0 18px 35px #09150db6; }
.mt-clock-inner { display: grid; align-content: center; justify-items: center; gap: 2px; margin: 6px; width: calc(100% - 12px); aspect-ratio: 1; border: 1px solid #244739; border-radius: 50%; background: #152b21; }
.mt-clock-inner strong { color: #d6f8ec; font-size: clamp(2rem, 6vw, 4.4rem); font-weight: 810; line-height: 1; letter-spacing: -.047em; font-variant-numeric: tabular-nums; }
.mt-clock-inner span { color: #b7ccb9; font-size: .78rem; }
.mt-trace { position: absolute; inset: 0; z-index: 0; background: linear-gradient(#73b49b22 1px, transparent 1px), linear-gradient(90deg, #73b49b22 1px, transparent 1px), #12251e; background-size: 27px 27px; }
.mt-trace.is-gridless { background: #12251e; }
.mt-trace canvas { display: block; width: 100%; height: 100%; }

.mt-result-actions { margin-top: 9px; }
.mt-copy-status { color: #b7e8d5; font-size: .75rem; }
.mt-result, .mt-history { margin-top: 8px; padding: 9px 11px; border: 1px solid var(--mt-line); border-radius: 9px; background: #1a2821; }
.mt-result h3 { font-size: .97rem; font-weight: 760; }
.mt-result[data-state="review"] { border-color: #8b7651; background: #342d20; }
.mt-result[data-state="success"] { border-color: #578575; background: #1e392d; }
.mt-result p, .mt-history p { margin-top: 5px; color: #d4ded8; font-size: .81rem; line-height: 1.5; }
.mt-result ul { display: flex; flex-wrap: wrap; gap: 4px; margin: 5px 0 0; padding: 0; list-style: none; }
.mt-result li { padding: 2px 6px; border: 1px solid #917d5c; border-radius: 5px; color: #f2e0bc; font-size: .74rem; }
.mt-history summary { cursor: pointer; color: #dfebe4; font-size: .82rem; font-weight: 690; }
.mt-history summary i, .mt-page summary::marker { color: var(--mt-accent); }
.mt-history ol { display: grid; max-height: 164px; margin: 6px 0 0; padding: 0; overflow: auto; scrollbar-width: thin; list-style: none; }
.mt-history li { display: flex; align-items: baseline; flex-wrap: wrap; gap: 3px 8px; padding: 4px 1px; border-top: 1px solid #3b5045; color: #d6e5dd; font-size: .74rem; }
.mt-history li > span { margin-left: auto; color: #b8c9bf; font-variant-numeric: tabular-nums; }
.mt-history li > small { color: #f4d197; }

.mt-guide-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: clamp(22px, 4vw, 46px); }
.mt-guide-grid section, .mt-faq { padding: clamp(14px, 3vw, 25px); border: 1px solid var(--mt-line); border-radius: 14px; background: var(--mt-surface); }
.mt-guide-grid h2, .mt-faq h2 { margin-bottom: 8px; font-size: clamp(1.16rem, 2.25vw, 1.65rem); font-weight: 770; letter-spacing: -.027em; }
.mt-guide-grid ol { margin: 0; padding-left: 1.1rem; }
.mt-guide-grid :is(li, p), .mt-faq p { color: var(--mt-muted); font-size: .87rem; line-height: 1.55; }
.mt-guide-links { display: flex; flex-wrap: wrap; gap: 6px 13px; margin-top: 10px; }
.mt-faq { margin-top: 9px; }
.mt-faq details { padding: 8px 0; border-top: 1px solid var(--mt-line); }
.mt-faq summary { cursor: pointer; font-size: .89rem; font-weight: 690; }
.mt-faq p { margin-top: 6px; }

.mt-lab:is(:fullscreen, .is-expanded) {
    width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; border: 0; border-radius: 0;
    overflow: auto; overscroll-behavior: contain; background: radial-gradient(ellipse at 40% 0, #263e33, #121c17 67%);
}
.mt-lab:-webkit-full-screen { width: 100%; height: 100%; margin: 0; border: 0; border-radius: 0; overflow: auto; background: #121c17; }
.mt-lab.is-expanded { position: fixed; z-index: 3000; inset: 0; height: 100vh; height: 100dvh; }
.mt-viewport-expanded { overflow: hidden; }
.mt-lab:is(:fullscreen, .is-expanded) .mt-toolbar { position: sticky; top: 0; }
.mt-lab:-webkit-full-screen .mt-toolbar { position: sticky; top: 0; }
.mt-lab:is(:fullscreen, .is-expanded) .mt-body { width: min(100%, 1500px); margin-inline: auto; }
.mt-lab:is(:fullscreen, .is-expanded) .mt-stage { --mt-field-height: clamp(235px, calc(100dvh - 276px), 560px); }

@media (max-width: 760px) {
    .mt-page { width: calc(100% - 24px); }
    .mt-page .mt-crumb { margin-bottom: 13px; }
    .mt-intro { margin-bottom: 12px; }
    .mt-guide-grid { grid-template-columns: minmax(0, 1fr); }
    .mt-workspace { grid-template-columns: minmax(0, 1fr); }
    .mt-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .mt-stage { --mt-field-height: 271px; }
    .mt-lab:is(:fullscreen, .is-expanded) .mt-stage { --mt-field-height: clamp(228px, 40dvh, 360px); }
    .mt-stage-footer { font-size: .69rem; }
}

@media (max-height: 500px) and (min-width: 761px) {
    .mt-lab:is(:fullscreen, .is-expanded) .mt-stage { --mt-field-height: 235px; }
}
@media (max-width: 360px) { .mt-toolbar { padding-inline: 9px; } .mt-actions .mt-button { padding-inline: 8px; } }
@media (prefers-reduced-motion: reduce) { .mt-device, .mt-device-key { transition: none; } }
