:root {
  color: #272a24;
  background: #f7f2e7;
  color-scheme: light;
  font: 15px/1.45 system-ui, sans-serif;
  --sea: #285660;
  --quiet: #5f6259;
  --paper: #fffdf7;
  --rule: #ddd7c8;
}

* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
a { color: var(--sea); }
button, input, select { font: inherit; }
button, select, label:has([type="radio"], [type="checkbox"]) { cursor: pointer; }
button { color: inherit; }
:focus-visible { outline: 2px solid #146f88; outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }

.shell { width: min(1120px, calc(100% - 64px)); margin-inline: auto; }
.masthead { min-height: 72px; border-bottom: 1px solid var(--rule); display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.wordmark img { display: block; width: 128px; height: auto; }
.text-link { font-size: .89rem; font-weight: 650; text-underline-offset: 3px; }
.intro { padding: clamp(2.2rem, 6vw, 4rem) 0 2rem; }
.intro h1 { font: bold clamp(2.6rem, 6vw, 4.7rem)/1 Georgia, serif; letter-spacing: -.045em; }
.intro p { color: var(--quiet); margin-top: .8rem; font-size: 1.07rem; }

.workbench { display: grid; grid-template-columns: minmax(290px, .8fr) minmax(0, 1.4fr); gap: 20px; align-items: start; }
.panel { border: 1px solid var(--rule); border-radius: 14px; background: var(--paper); }
.panel h2, .saved h2 { font: bold 1.55rem/1.2 Georgia, serif; }
.controls { padding: 23px; }
.presets { display: flex; flex-wrap: wrap; gap: 7px; margin: 16px 0 23px; }
.presets button { padding: 6px 10px; border-radius: 6px; border: 1px solid var(--rule); background: #f8f5eb; font-size: .86rem; }
.presets button[aria-pressed="true"] { background: #e3ebe3; border-color: #b9cbbd; color: #233d33; }
.controls form { display: grid; gap: 21px; padding-top: 17px; border-top: 1px solid var(--rule); }
fieldset { border: 0; min-inline-size: 0; padding: 0; margin: 0; }
legend, .button-field, .share > label { padding: 0; font-size: .88rem; font-weight: 700; }
legend { margin-bottom: 8px; }
.field-detail { color: var(--quiet); font-weight: 400; margin-left: 5px; }
.segments { display: flex; padding: 3px; border-radius: 8px; background: #f0ece0; }
.segments label { flex: 1; min-width: 0; text-align: center; }
.segments input, .swatches input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.segments label span { display: block; padding: 7px clamp(3px, 1vw, 12px); border-radius: 5px; color: #4d554e; font-size: .87rem; font-weight: 600; }
.segments input:checked + span { background: #fffdf7; box-shadow: 0 1px 3px #252b2521; color: #233d33; }
.segments input:focus-visible + span, .swatches input:focus-visible + span { outline: 2px solid #146f88; outline-offset: 2px; }
.swatches { display: flex; flex-wrap: wrap; gap: 12px; padding: 4px 2px; }
.swatches label span { display: block; width: 29px; height: 29px; background: var(--swatch); border: 1px solid #0002; border-radius: 50%; }
.swatches input:checked + span { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px #525a50; }
.switches { display: grid; gap: 12px; }
.switches label { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: .9rem; font-weight: 650; }
.switches input { width: 1.1rem; height: 1.1rem; margin: 0; accent-color: var(--sea); }
.button-field { display: grid; gap: 7px; }
select, .share input { min-width: 0; padding: 9px 10px; border: 1px solid #c9c3b4; border-radius: 6px; background: #fffdf7; color: #3e443c; }

.stage-head { padding: 16px 21px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.platform-picker { display: flex; align-items: center; gap: 8px; font-size: .88rem; font-weight: 650; }
.platform-picker select { max-width: 100%; padding-block: 6px; }
.preview-field { display: grid; place-items: center; min-height: 300px; padding: clamp(16px, 4vw, 42px); background: #222928; }
.preview-example { width: min(100%, 434px); min-width: 0; }
.preview-label { display: none; }
.preview-field[data-view="compare"] { grid-template-columns: repeat(2, minmax(0, 1fr)); place-items: start stretch; gap: 18px 14px; padding: 22px; border-radius: 0 0 13px 13px; }
.preview-field[data-view="compare"] .preview-label { display: block; color: #e2e7df; font-size: .83rem; font-weight: 650; margin-bottom: 7px; }
.native-card { padding: 16px; background: #343c39; color: #f5f5ef; border-radius: 9px; border-left: 5px solid var(--accent, #285660); display: grid; gap: 10px; }
.native-card p:not(.preview-title) { font-size: .94rem; color: #e0e5de; white-space: pre-line; }
.preview-title { font-size: 1.11rem; font-weight: 700; line-height: 1.27; }
.native-card img { display: block; width: 100%; height: auto; border-radius: 5px; }
.native-card hr { width: 100%; margin: 0; border: 0; border-top: 1px solid #7b847a; }
.card-link { justify-self: start; border-radius: 5px; background: #4b564e; color: #f5f5ef; padding: 6px 11px; font-size: .86rem; font-weight: 650; text-decoration: none; }
.card-link::after { content: ' ↗'; }

.link-preview { display: flex; flex-direction: column; position: relative; overflow: hidden; border-radius: 9px; background: #f6f3ed; color: #242923; }
.link-preview[data-tone="mist"] { background: #e9edf1; }
.link-preview[data-tone="sage"] { background: #e6eddf; }
.link-preview :is(img, video) { display: block; width: 100%; height: auto; aspect-ratio: var(--preview-ratio, 1200 / 630); object-fit: cover; }
.link-preview-text { min-width: 0; display: grid; align-content: center; gap: 5px; padding: 11px 13px; }
.link-preview-description { font-size: .86rem; color: #454b44; }
.link-preview-domain { color: #535a53; font-size: .76rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-preview[data-layout^="thumbnail"] { display: grid; grid-template-columns: clamp(62px, 23%, 92px) minmax(0, 1fr); align-items: center; }
.link-preview[data-layout^="thumbnail"] img { aspect-ratio: 1; }
.link-preview[data-layout="thumbnail-end"] { grid-template-columns: minmax(0, 1fr) clamp(62px, 23%, 92px); }
.link-preview[data-layout="thumbnail-end"] .link-preview-text, .link-preview[data-layout="image-below"] .link-preview-text { order: -1; }
.link-preview[data-layout="overlay"] .link-preview-text { position: absolute; inset: auto 0 0; gap: 1px; padding: 7px 12px; background: #202624e8; color: #f5f5ef; }
.link-preview[data-layout="overlay"] .link-preview-domain { color: #d7ded6; }
.preview-field[data-view="compare"] .preview-title { font-size: .98rem; }

.share { display: grid; gap: 9px; padding: 17px 21px 20px; }
.stage-head + .share { border-top: 1px solid var(--rule); }
.share-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.share input { font: .8rem ui-monospace, monospace; }
.primary { border-radius: 6px; background: var(--sea); border: 1px solid var(--sea); color: white; font-size: .91rem; font-weight: 700; padding: 7px 12px; }
.primary:hover { background: #214853; }
.share-actions { display: flex; gap: 7px 15px; flex-wrap: wrap; align-items: baseline; }
.quiet { background: transparent; border: 0; padding: 0; color: var(--sea); font-weight: 650; font-size: .89rem; }
.quiet:hover { text-decoration: underline; }
.quiet:disabled { cursor: default; color: var(--quiet); text-decoration: none; }
#status { color: #325d43; font-size: .83rem; }
.preview-note { color: var(--quiet); font-size: .81rem; }

.saved { margin: 28px 0 48px; }
.saved p { color: var(--quiet); margin-top: 4px; font-size: .86rem; }
.saved ul { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 12px 0 0; }
.saved li { display: flex; align-items: center; gap: 12px; border: 1px solid var(--rule); border-radius: 7px; padding: 7px 11px; background: var(--paper); }
.saved li button { padding: 0; }
.saved li button:last-child { background: transparent; border: 0; font-size: 1.15rem; line-height: 1; color: var(--quiet); }
main.shell { padding-bottom: 40px; }

@media (max-width: 760px) {
  .shell { width: calc(100% - 32px); }
  .workbench { grid-template-columns: minmax(0, 1fr); }
  .preview-field { min-height: 235px; }
}
@media (max-width: 540px) {
  .preview-field[data-view="compare"] { grid-template-columns: minmax(0, 1fr); padding: 16px; }
}
@media (max-width: 380px) {
  .share-row { grid-template-columns: minmax(0, 1fr); }
}
