:root {
  color-scheme: dark;
  --page: #0e1621;
  --panel: #151f2d;
  --inset: #101927;
  --line: #2a3849;
  --muted: #a4b7ca;
  --text: #eff5fc;
  --mint: #a9f4e3;
  --focus: #8ceadc;
  font-family: "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: radial-gradient(ellipse at 42% 0%, #172837 0, var(--page) 58%); color: var(--text); }
button, input, select { font: inherit; }
button, a, input[type="checkbox"], input[type="range"], select { -webkit-tap-highlight-color: transparent; }
button, select { cursor: pointer; }
button:disabled, select:disabled { cursor: default; opacity: .46; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
p { line-height: 1.55; }

.top { background: #101a26; border-bottom: 1px solid #2a394b; }
.top-inner, .shell { max-width: 1540px; margin: auto; padding-inline: clamp(18px, 3.2vw, 52px); }
.top-inner { height: 72px; display: flex; align-items: center; gap: 29px; }
.brand { display: flex; gap: 11px; align-items: center; font-weight: 650; letter-spacing: -.025em; font-size: 19px; white-space: nowrap; }
.mark { width: 35px; height: 35px; display: inline-block; flex: none; position: relative; border-radius: 10px; border: 1px solid #537d86; background: #172f3d; }
.mark i { position: absolute; width: 20px; height: 8px; top: 11px; left: 7px; border-top: 2px solid var(--mint); border-radius: 50%; transform: rotate(-17deg); }
.mark i + i { top: 18px; }
.transfer-link { font-size: 14px; color: var(--muted); white-space: nowrap; }
.transfer-link:hover { color: var(--text); }
.top-actions { display: flex; margin-left: auto; gap: 9px; }
.button { min-height: 41px; border-radius: 10px; border: 1px solid transparent; padding: 9px 14px; display: inline-flex; align-items: center; justify-content: center; font-size: .9rem; font-weight: 620; line-height: 1.22; text-align: center; white-space: nowrap; }
.secondary { color: var(--text); background: #1a2838; border-color: #3a4b5c; }
.secondary:hover:not(:disabled) { background: #243648; }
.primary { color: #0b2f2c; background: var(--mint); border-color: var(--mint); }
.primary:hover:not(:disabled) { background: #c3fff1; }
.wide { width: 100%; }

.shell { padding-bottom: 45px; }
.intro { padding-block: 35px 24px; display: flex; align-items: end; justify-content: space-between; gap: 18px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(29px, 3.2vw, 49px); font-weight: 630; line-height: 1.07; letter-spacing: -.045em; }
.intro p { color: var(--muted); margin-top: 10px; font-size: 1rem; }
.project-name, .position-fields label, .select-label { display: grid; gap: 7px; color: var(--muted); font-size: .88rem; font-weight: 550; }
.project-name { min-width: 205px; width: 235px; }
input[type="text"], input[type="number"], select { width: 100%; min-width: 0; border-radius: 9px; border: 1px solid #35495d; height: 41px; background: #111c2a; padding-inline: 11px; color: var(--text); font-size: .95rem; }
select { appearance: none; padding-right: 32px; background: #111c2a linear-gradient(45deg, transparent 50%, #a4b7ca 50%) no-repeat right 17px center / 5px 5px; background-image: linear-gradient(45deg, transparent 50%, #a4b7ca 50%), linear-gradient(135deg, #a4b7ca 50%, transparent 50%); background-position: right 17px center, right 12px center; background-size: 5px 5px; background-repeat: no-repeat; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 315px; align-items: start; gap: 20px; }
.studio, .inspector, .transfer { border: 1px solid var(--line); background: var(--panel); border-radius: 16px; }
.studio { overflow: hidden; min-width: 0; }
.stage-head, .stage-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 15px; }
.stage-head { height: 50px; }
.stage-title { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 15px; }
.screen-icon { display: inline-block; width: 17px; height: 13px; border: 1.5px solid var(--mint); border-radius: 3px; }
.aspect { color: var(--muted); font-weight: 500; font-size: 13px; }
.stage-footer { min-height: 43px; color: var(--muted); font-size: .82rem; }
#save-status { text-align: right; }
.stage { position: relative; aspect-ratio: 16/9; width: 100%; overflow: hidden; background: #1a2938; --scale: 1; }
.tv-screen { position: absolute; width: 1280px; height: 720px; transform-origin: 0 0; transform: scale(var(--scale)); font-family: Roboto, "Segoe UI", sans-serif; color: #f6f9fd; --tv-accent: #aff5e7; }
.tv-wallpaper, .tv-shade, .tv-guides { position: absolute; inset: 0; pointer-events: none; }
.tv-wallpaper { background: #19293a url(coast.jpg) center / cover; }
.tv-shade { background: linear-gradient(#0712211b, #07122105 50%, #070e1883); }
.tv-screen.custom-wallpaper .tv-shade { background: linear-gradient(#07122181, #07122152 50%, #070e189b); }
.tv-guides { display: none; background-image: linear-gradient(#bdfff136 1px, transparent 1px), linear-gradient(90deg, #bdfff136 1px, transparent 1px); background-size: 40px 40px; }
.tv-screen.guides .tv-guides { display: block; }
.tv-brand { position: absolute; left: 59px; top: 38px; display: flex; align-items: center; gap: 10px; font-size: 21px; font-weight: 600; }
.tv-brand > span:last-child { max-width: 430px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.theme-mark { display: inline-flex; flex: none; }
.theme-mark svg { width: 100%; height: 100%; }
.mini { width: 40px; height: 40px; }
.mini i { left: 9px; top: 13px; }
.mini i + i { top: 20px; }
.tv-actions { display: flex; gap: 12px; position: absolute; top: 38px; right: 60px; font-size: 17px; font-weight: 600; }
.tv-actions span, .tv-all { display: grid; place-items: center; border-radius: 17px; border: 1px solid #a6c0d44f; background: linear-gradient(135deg, #3d506561, #222e4174); height: 42px; width: 146px; }
.tv-region { position: absolute; cursor: grab; touch-action: none; user-select: none; outline: 2px dashed transparent; outline-offset: 4px; border-radius: 12px; transform: scale(var(--block-scale, 1)); transform-origin: top left; }
.tv-region.dragging { cursor: grabbing; z-index: 4; }
.tv-region.selected, .tv-region:hover { outline-color: var(--tv-accent); }
.tv-region:focus-visible { outline: 3px solid var(--tv-accent); }
.tv-clock { width: 430px; height: 181px; }
.tv-date { color: #b9cbd6; font-size: 24px; font-weight: 600; padding-left: 10px; line-height: 36px; text-shadow: 0 1px 8px #10182099; }
.tv-time { font-size: 137px; font-weight: 300; line-height: 144px; letter-spacing: -.078em; text-shadow: 0 2px 15px #10182070; }
.tv-weather { width: 264px; height: 192px; }
.tv-weather-card { height: 161px; border: 1px solid #a6c0d44f; border-radius: 25px; background: linear-gradient(135deg, #3d506561, #222e4174); position: relative; }
.tv-city { position: absolute; top: 14px; left: 18px; line-height: 27px; font-weight: 600; font-size: 21px; }
.tv-cloud { position: absolute; top: 23px; left: 194px; color: var(--tv-accent); font: 39px/43px "Segoe UI Symbol", sans-serif; }
.tv-temperature { position: absolute; top: 46px; left: 16px; font-size: 55px; line-height: 67px; font-weight: 300; }
.tv-condition { position: absolute; top: 114px; left: 18px; color: #b9cbd6; font-size: 17px; line-height: 29px; }
.tv-attribution { color: #b9cbd6; font-size: 13px; margin: 6px 12px; line-height: 20px; }
.tv-dock { height: 164px; }
.season-scene { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.tv-dock-head { display: flex; align-items: center; height: 39px; padding-left: 3px; padding-right: 3px; gap: 11px; font-size: 28px; font-weight: 620; }
.tv-edit { font-size: 17px; margin-left: auto; width: 150px; }
.tv-all { width: 118px; height: 38px; font-size: 17px; }
.tv-dock-base { position: absolute; inset: 48px 0 0; border: 1px solid #8fa9ba75; border-radius: 26px; background: linear-gradient(135deg, var(--dock-top, #3a4d6092), var(--dock-bottom, #182434b0)); }
.tv-tile { position: absolute; height: 98px; top: 8px; padding: 9px 3px 4px; display: grid; grid-template-rows: 54px 22px; justify-items: center; align-content: start; gap: 6px; background: transparent; border: 1px solid transparent; border-radius: 19px; color: inherit; font-size: 16px; font-weight: 570; cursor: grab; touch-action: none; }
.tv-tile.active, .tv-tile:hover { border-color: var(--tv-accent); background: #94fbf222; }
.tv-tile:focus-visible { outline-color: var(--tv-accent); }
.focus-motion .tv-tile { transition: transform 110ms ease-out; }
.focus-motion .tv-tile.active, .focus-motion .tv-tile:hover, .focus-motion .tv-tile:focus-visible { transform: scale(1.035); transition-duration: 165ms; }
.tv-tile > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; width: 100%; text-align: center; }
.app-icon { width: 54px; height: 54px; border: 1px solid #ffffff3b; border-radius: 14px; color: white; background: var(--app-color); display: grid; place-items: center; font-size: 26px; font-weight: 700; }
.tv-tile.add-tile .app-icon { background: #347d8422; border-color: #82c0c269; color: var(--tv-accent); font-weight: 350; }

.inspector { min-width: 0; }
.tabs { display: flex; gap: 3px; padding: 9px; border-bottom: 1px solid var(--line); }
.tab { flex: 1; border-radius: 8px; padding: 9px 4px; color: var(--muted); background: none; border: 1px solid transparent; font-size: .85rem; font-weight: 580; }
#tab-premium { color: #ffe4a6; }
.template-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin: 12px 0; }
.template-card { min-width: 0; min-height: 59px; display: flex; align-items: flex-end; text-align: left; padding: 8px; color: #fff; font-weight: 640; border: 1px solid #6d849a; border-radius: 9px; background-size: cover; background-position: center; }
.template-card:hover, .template-card[aria-pressed="true"] { border-color: #ffe4a6; box-shadow: inset 0 0 0 1px #ffe4a6; }
.premium-section { border-top: 1px solid var(--line); margin-top: 17px; padding-top: 12px; }
.premium-section summary { cursor: pointer; color: var(--text); font-weight: 630; padding-block: 4px; }
.premium fieldset { border: 0; padding: 0; margin: 10px 0 0; min-width: 0; }
.premium legend { font-size: .84rem; color: var(--muted); padding: 0 0 5px; }
.weekdays button { min-width: 0; padding-inline: 1px; }
.premium .wide { margin-top: 10px; }
.premium .position-fields input, .premium .position-fields select { width: 100%; min-width: 0; }
#simulation-result { color: #ffe4a6; }
.tab.active { color: var(--text); background: #233447; border-color: #3b5368; }
.tab:hover:not(.active) { color: var(--text); }
.inspector-body { padding: 17px 15px 19px; }
.inspector h2 { font-size: 1.05rem; font-weight: 640; }
.inspector h3 { font-size: .96rem; font-weight: 620; }
.inspector p { font-size: .88rem; color: var(--muted); margin-top: 6px; }
.block-list { margin-top: 11px; display: grid; gap: 5px; }
.block-list button, .app-row { border: 1px solid transparent; border-radius: 9px; min-height: 41px; background: none; color: var(--text); display: flex; align-items: center; gap: 10px; padding: 6px 10px; text-align: left; font-size: .89rem; }
.block-list button[aria-pressed="true"], .app-row[aria-pressed="true"] { border-color: #4a807d; background: #1e3a42; color: #d3fff3; }
.block-sign { display: grid; place-items: center; color: var(--mint); width: 18px; height: 18px; position: relative; }
.clock-sign { border-radius: 50%; border: 1.5px solid var(--mint); }
.clock-sign::after { content: ""; height: 6px; width: 4px; border-left: 1px solid; border-bottom: 1px solid; position: absolute; left: 7px; top: 3px; }
.weather-sign { font: 19px/1 "Segoe UI Symbol", sans-serif; }
.dock-sign { height: 11px; border: 1.5px solid var(--mint); border-radius: 3px; }
.dock-sign::after { content: "···"; line-height: 5px; }
.rule { height: 1px; background: var(--line); margin-block: 13px; }
.position-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 10px; }
.inspector .option-label { margin-top: 13px; font-weight: 570; }
.segments { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; margin-top: 5px; }
.segments button { min-height: 34px; padding: 5px; border: 1px solid #35495d; border-radius: 8px; background: #111c2a; color: var(--text); font-size: .82rem; }
.segments button[aria-pressed="true"], .segments button:hover { border-color: #4a807d; background: #203d46; color: #d3fff3; }
.text-button { border: 0; padding: 6px 0; margin-top: 10px; background: none; color: var(--mint); font-size: .88rem; text-align: left; }
.text-button:not(:disabled):hover { text-decoration: underline; }
.slider-label { display: flex; justify-content: space-between; font-size: .88rem; color: var(--muted); margin-top: 13px; }
input[type="range"] { width: 100%; accent-color: var(--mint); margin: 7px 0 1px; }
.check { display: flex; align-items: center; gap: 7px; font-size: .88rem; line-height: 1.35; color: var(--muted); }
.check input { accent-color: var(--mint); width: 17px; height: 17px; margin: 0; flex: none; }
.compact { white-space: nowrap; }
.apps-list { display: grid; gap: 3px; margin-top: 10px; }
.app-row { min-height: 38px; gap: 8px; }
.app-row .app-icon { width: 25px; height: 25px; border-radius: 6px; font-size: 13px; }
.tile-actions { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.tile-actions .button { padding-inline: 9px; min-height: 35px; font-size: .82rem; }
.select-label { margin-top: 13px; }
.inspector .check { margin-top: 12px; }
#open-wallpaper { margin-top: 12px; }
.wallpaper-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin-top: 8px; }
.wallpaper-option { min-width: 0; background: #101927; color: var(--text); border: 1px solid #35495d; border-radius: 9px; display: grid; padding: 3px; gap: 4px; overflow: hidden; }
.wallpaper-option img { width: 100%; aspect-ratio: 16/9; object-fit: cover; background: #19293a; border-radius: 6px; }
.wallpaper-option span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; font-size: .81rem; font-weight: 575; padding: 0 4px 3px; }
.wallpaper-option[aria-pressed="true"], .wallpaper-option:hover { border-color: var(--mint); }
.seasonal-title { margin-top: 14px; }
.brand-icons { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; margin-top: 7px; }
.brand-icons button { display: grid; padding: 5px 1px; min-width: 0; gap: 3px; justify-items: center; border: 1px solid #35495d; border-radius: 8px; background: #111c2a; color: var(--text); font-size: .78rem; }
.brand-icons svg { width: 35px; height: 35px; }
.accent-options { display: flex; gap: 6px; margin-top: 9px; flex-wrap: wrap; }
.accent-options button { width: 34px; height: 34px; padding: 4px; border-radius: 10px; border: 1px solid #35495d; background: #111c2a; }
.accent-options button::before { content: ""; display: block; width: 100%; height: 100%; border-radius: 6px; background: var(--swatch); }
.brand-icons button[aria-pressed="true"], .accent-options button[aria-pressed="true"] { border-color: var(--mint); background: #203d46; }
.accent-custom { display: flex; align-items: center; justify-content: space-between; }
.accent-custom input { width: 49px; height: 30px; background: #111c2a; border: 1px solid #35495d; border-radius: 6px; cursor: pointer; }

.transfer { scroll-margin-top: 16px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 20px; margin-top: 20px; }
.transfer h2 { font-size: 1.15rem; }
.transfer p { margin-top: 5px; color: var(--muted); font-size: .91rem; max-width: 880px; }
.feedback { position: fixed; bottom: 18px; right: 20px; max-width: min(390px, calc(100vw - 40px)); color: var(--text); background: #24394b; border: 1px solid #597388; border-radius: 10px; padding: 12px 15px; box-shadow: 0 8px 26px #0005; z-index: 9; }

@media (max-width: 990px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 275px; gap: 13px; }
  .top-inner { gap: 16px; }
}
@media (max-width: 760px) {
  .workspace { grid-template-columns: 1fr; }
  .transfer-link { display: none; }
  .intro { padding-top: 25px; }
}
@media (max-width: 530px) {
  .top-inner { height: auto; padding-block: 11px; align-items: flex-start; flex-wrap: wrap; gap: 11px; }
  .top-actions { margin-left: 0; width: 100%; }
  .top-actions .button { flex: 1; }
  .intro { flex-direction: column; align-items: stretch; padding-bottom: 18px; }
  .project-name { width: 100%; }
  .stage-head, .stage-footer { padding-inline: 10px; }
  .stage-footer { flex-wrap: wrap; gap: 4px; }
  #save-status { text-align: left; }
  .transfer { flex-direction: column; align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  .focus-motion .tv-tile.active, .focus-motion .tv-tile:hover, .focus-motion .tv-tile:focus-visible { transform: none; transition: none; }
}
