:root {
  color-scheme: light;
  --wheel-ink: #173825;
  --wheel-muted: #576759;
  --wheel-dark: #1a432e;
  --wheel-edge: #c8c9b7;
  --wheel-divider: #dddcca;
  --wheel-panel: #fffaf0;
  --wheel-selected: #e4ebdb;
  --wheel-button: #fffaf1;
}
*, *::before, *::after { box-sizing: border-box; }
body { min-width: 260px; line-height: 1.45; }
main { padding-bottom: 35px; }
main h2, main p { margin: 0; }
main h2 { font-size: clamp(1.05rem,1.35vw,1.34rem); line-height: 1.18; letter-spacing: -.035em; }
main button, main select, main input { font: inherit; color: inherit; }
main button { appearance: none; }
main button, main summary, main select, main label[for="photo-file"] { cursor: pointer; }
main button, main a, main input, main label, main summary { -webkit-tap-highlight-color: transparent; }
main button:disabled { opacity: .48; cursor: default; }
[hidden] { display: none !important; }
:focus-visible, #photo-file:focus-visible + label { outline: 3px solid #a57526; outline-offset: 3px; }
.icon-bank, .sr-only { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }
.skip { position: fixed; top: 4px; left: 8px; z-index: 8; padding: .6rem .8rem; color: white; background: var(--wheel-dark); transform: translateY(-150%); }
.skip:focus { transform: none; }
.icon { width: 19px; height: 19px; flex: 0 0 auto; display: inline-block; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.intro { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; column-gap: 20px; row-gap: 13px; }
.intro p { margin-top: .48rem; font-size: clamp(.97rem,1.2vw,1.13rem); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 45px; padding: .68rem 1.04rem; border: 1px solid var(--wheel-edge); border-radius: 8px; font-size: .97rem; font-weight: 720; line-height: 1.2; }
.btn.primary { color: #fffcf3; background: var(--wheel-dark); border-color: var(--wheel-dark); }
.btn.primary:hover, .upload-action:focus-within label { background: #28593e; }
.btn.secondary { background: var(--wheel-button); color: var(--wheel-ink); }
.btn.secondary:hover, .btn.secondary[aria-pressed="true"] { background: var(--wheel-selected); border-color: #8b9b83; }
.btn.small { min-height: 38px; padding: .46rem .7rem; font-size: .87rem; }
.btn.small .icon { width: 16px; height: 16px; }
#compare[aria-pressed="false"] .show-preview, #compare[aria-pressed="true"] .show-original { display: none; }

.studio { display: grid; grid-template-columns: minmax(0,1fr) minmax(310px,31%); gap: clamp(14px,1.6vw,25px); align-items: start; }
.studio:focus:not(:focus-visible) { outline: 0; }
.panel { min-width: 0; border-radius: 14px; background: var(--wheel-panel); border: 1px solid var(--wheel-edge); box-shadow: 0 2px 5px #3d482e0b; }
.preview { overflow: hidden; }
.preview-head { padding: .76rem clamp(12px,1.45vw,24px); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stage { display: flex; justify-content: center; align-items: center; overflow: hidden; background: #e2e2d7; }
#wheel-canvas { display: block; max-width: 100%; width: auto; height: auto; max-height: clamp(320px,64vh,690px); min-width: 0; touch-action: pan-y pinch-zoom; }
#wheel-canvas[data-align="true"] { cursor: move; touch-action: none; }
#wheel-canvas:focus-visible { outline-offset: -3px; }
.photo-foot { display: flex; align-items: center; justify-content: space-between; padding: .43rem clamp(12px,1.45vw,24px); gap: 9px; }
.photo-title { display: flex; align-items: center; gap: .42rem; min-width: 0; color: var(--wheel-muted); font-size: .88rem; font-weight: 600; }
.photo-title .icon { width: 16px; height: 16px; }
#photo-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.text-btn { background: transparent; color: var(--wheel-ink); white-space: nowrap; border: none; text-decoration: underline; text-underline-offset: .22em; font-size: .86rem; font-weight: 680; padding: .36rem 0; min-height: 32px; }
.text-btn:hover { color: #397351; }
.align { border-top: 1px solid var(--wheel-divider); }
main summary { display: flex; align-items: center; gap: .55rem; list-style: none; font-weight: 680; color: var(--wheel-ink); }
main summary::-webkit-details-marker { display: none; }
.align summary { padding: .76rem clamp(12px,1.45vw,24px); font-size: .97rem; }
main summary:hover { background: #f3f1e3; }
.chevron { width: 16px; height: 16px; margin-left: auto; }
details[open] > summary .chevron { transform: rotate(180deg); }
.align-panel { border-top: 1px solid var(--wheel-divider); padding: 1rem clamp(12px,1.45vw,24px); }
#alignment-hint { font-size: .92rem; color: var(--wheel-muted); margin-bottom: .8rem; }
.align-row { display: flex; align-items: center; justify-content: space-between; gap: 8px 15px; flex-wrap: wrap; }
.align-pick { display: flex; gap: 2px; border-radius: 8px; background: #edece0; padding: 3px; }
.align-pick button { padding: .4rem .72rem; min-height: 34px; border: 0; border-radius: 6px; font-size: .87rem; font-weight: 670; background: transparent; }
.align-pick button[aria-pressed="true"] { background: var(--wheel-dark); color: #fffaf0; }
.count { display: flex; align-items: center; gap: .5rem; font-size: .88rem; font-weight: 640; }
.count select { border: 1px solid var(--wheel-edge); border-radius: 6px; padding: .34rem 1.7rem .34rem .56rem; min-height: 34px; appearance: none; background: var(--wheel-button) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%23334939' stroke-width='1.5'%3E%3Cpath d='m1 1 5 5 5-5'/%3E%3C/svg%3E") no-repeat right .47rem center; }
.sliders { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: .65rem 1.05rem; margin: 1rem 0 .7rem; }
.slider label { display: flex; align-items: center; justify-content: space-between; gap: .2rem; font-weight: 680; font-size: .89rem; }
.slider output { color: var(--wheel-muted); font-weight: 550; font-variant-numeric: tabular-nums; }
.slider input { width: 100%; height: 26px; margin: 1px 0 0; accent-color: var(--wheel-dark); cursor: pointer; }
.nudge { display: flex; align-items: center; gap: 4px; }
.nudge span { font-size: .88rem; font-weight: 660; margin-right: .3rem; }
.nudge button { display: grid; place-items: center; width: 35px; height: 35px; border: 1px solid var(--wheel-edge); border-radius: 6px; background: var(--wheel-button); }
.nudge button:hover { background: var(--wheel-selected); }
.nudge .icon { width: 15px; height: 15px; }
[data-nudge="left"] svg { transform: rotate(-90deg); }
[data-nudge="right"] svg { transform: rotate(90deg); }
[data-nudge="down"] svg { transform: rotate(180deg); }
.status { padding: .38rem clamp(12px,1.45vw,24px); color: var(--wheel-muted); background: #eeefe2; font-size: .85rem; }
.status:empty { display: none; }

.settings { padding-inline: clamp(14px,1.5vw,26px); }
.settings-part { padding-block: clamp(16px,1.38vw,24px); }
.settings-part + .settings-part { border-top: 1px solid var(--wheel-divider); }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: .78rem; }
.selected-name { font-size: .85rem; font-weight: 630; color: var(--wheel-muted); }
.designs { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 7px; }
.design { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 0; gap: 5px; padding: 9px 2px 8px; border: 1px solid var(--wheel-divider); border-radius: 9px; background: #f6f2e7; font-size: .82rem; font-weight: 650; line-height: 1.15; }
.design canvas { display: block; width: clamp(45px,4.6vw,78px); max-width: 78%; height: auto; aspect-ratio: 1; }
.design:hover, .finish:hover { background-color: #edeee2; border-color: #a2ac96; }
.design[aria-pressed="true"], .finish[aria-pressed="true"] { border-color: #31553e; box-shadow: inset 0 0 0 1px #31553e; background-color: var(--wheel-selected); }
.finishes { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 4px; }
.finish { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 0; gap: 5px; background: transparent; border: 1px solid transparent; border-radius: 7px; padding: 7px 1px 6px; font-size: .76rem; line-height: 1.2; font-weight: 630; }
.finish i { display: block; width: clamp(26px,2vw,34px); height: auto; aspect-ratio: 1; border-radius: 50%; border: 1px solid #0003; box-shadow: inset 0 0 0 1px #ffffff38; }
.silver i { background: linear-gradient(145deg,#f3f4ed 8%,#e3e4df 26%,#a5aaa5 48%,#c4c8c5 60%,#909692 90%); }
.graphite i { background: linear-gradient(145deg,#939690 4%,#6c7270 24%,#333c3d 52%,#606966 68%,#393f3f); }
.bronze i { background: linear-gradient(145deg,#dec19c,#b39668 30%,#80603d 52%,#af8758 66%,#6b5034); }
.black i { background: linear-gradient(145deg,#666c68,#343a35 33%,#121714 52%,#343a36 64%,#171918); }
.white i { background: linear-gradient(145deg,#fffef9,#eeeee6 43%,#dedfd8 56%,#f7f6f1 73%,#d1d0c9); }
.export .btn { width: 100%; }
.export p { display: flex; align-items: center; justify-content: center; gap: 5px; margin: .55rem 0 0; font-size: .82rem; color: var(--wheel-muted); text-align: center; }
.export p .icon { width: 14px; height: 14px; }
.help { margin: clamp(18px,2.2vw,36px) 0; max-width: 900px; }
.help details { border-bottom: 1px solid var(--wheel-edge); }
.help summary { padding: .82rem .15rem; font-size: 1rem; }
.help p { color: var(--wheel-muted); line-height: 1.55; padding: 0 .15rem .85rem; }
@media(max-width: 940px) {
  .studio { grid-template-columns: minmax(0,1fr) minmax(285px,33%); gap: 12px; }
  .settings { padding-inline: 12px; }
  .design { font-size: .78rem; }
  .design canvas { width: 49px; }
  .finishes { gap: 1px; }
  .sliders { gap: .6rem; }
}
@media(max-width: 740px) {
  .studio { grid-template-columns: minmax(0,1fr); gap: 12px; }
  .settings { padding-inline: 14px; }
  .designs { grid-template-columns: repeat(6,minmax(0,1fr)); }
  .design { font-size: .8rem; }
  .design canvas { width: 56px; }
  .finishes { grid-template-columns: repeat(5,minmax(0,70px)); gap: 6px; }
  .finish { font-size: .8rem; }
  .settings-part { padding-block: 15px; }
  #wheel-canvas { max-height: min(60svh,530px); }
  .help { margin-block: 18px; }
}
@media(max-width: 525px) {
  .intro { display: block; }
  .intro p { line-height: 1.35; }
  .upload-action { margin-top: 11px; }
  .btn { min-height: 41px; padding: .58rem .76rem; font-size: .9rem; }
  .panel { border-radius: 11px; }
  .designs { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .design { flex-direction: row; gap: 4px; padding: 6px 2px; font-size: .76rem; }
  .design canvas { width: 35px; max-width: 37%; }
  .finishes { grid-template-columns: repeat(5,minmax(0,1fr)); gap: 2px; }
  .preview-head { padding-block: .5rem; }
  .sliders { grid-template-columns: minmax(0,1fr); gap: .45rem; }
  .nudge button { width: 32px; height: 35px; }
  .align summary { padding-block: .65rem; }
  .export .btn { min-height: 44px; }
}
@media(max-width: 390px) {
  .design { flex-direction: column; padding: 5px 1px; }
  .design canvas { width: 37px; max-width: 66%; }
  .fine .text-btn { margin-left: auto; }
  .finish { padding-inline: 0; }
}
@media(forced-colors: active) {
  button[aria-pressed="true"] { outline: 2px solid ButtonText; }
}
