:root{color-scheme:light;--paper:#f7f5f1;--ink:#282725;--muted:#5c5952;--line:#d4cfc5;--accent:#75603a;--gold:#b69965;font-family:"PingFang SC","Microsoft YaHei",system-ui,sans-serif;color:var(--ink);background:var(--paper)}
*{box-sizing:border-box}body{margin:0}button,input,select,textarea{font:inherit;color:inherit}button{cursor:pointer;background:none;border:0}button:disabled{cursor:default;opacity:.55}button:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible{outline:3px solid #9b722d;outline-offset:1px}[hidden]{display:none!important}
#app{width:min(100%,620px);margin:auto;height:100vh;height:100svh;height:100dvh;display:flex;flex-direction:column;padding:max(0px,env(safe-area-inset-top)) 0 max(2px,env(safe-area-inset-bottom))}
.brand,.modebar,.lens-tools,.swatches,.reading,.comparison,.action{flex:none}
.brand{margin:0 14px;min-height:48px;display:flex;align-items:center;gap:10px;border-bottom:1px solid #c3b9a6;white-space:nowrap}
.brand strong{font:700 1.36rem/1.2 "Songti SC","SimSun",serif;letter-spacing:.04em}.brand>span{padding-left:10px;border-left:1px solid var(--gold);font:500 1.04rem/1.1 "Songti SC","SimSun",serif}
#more{margin-left:auto;font-size:.875rem;color:var(--muted);min-height:44px;min-width:44px}
.modebar{display:flex;align-items:center;justify-content:space-between;gap:4px;min-height:48px;padding:2px 12px}
.segmented{display:flex;align-items:center;padding:0 2px;border-radius:7px;background:#eae6de}
.segmented button,.camera-tools button{font-size:.875rem;min-height:40px;padding:4px 9px}.segmented button[aria-pressed=true]{background:#fff;border-radius:6px;box-shadow:0 1px 3px #493f311c;font-weight:650}.camera-tools button{color:var(--muted)}
.camera{position:relative;flex:1 1 45%;min-height:152px;overflow:hidden;background:#dddcd5;isolation:isolate}
#video,#frozen-frame{display:block;width:100%;height:100%;object-fit:cover;transform:scale(var(--zoom,1));transform-origin:center}
#frozen-frame{position:absolute;inset:0}.camera-placeholder{position:absolute;inset:0;display:grid;align-items:end;justify-content:center;padding:14px;color:#625f57;text-align:center;font-size:.875rem;background:linear-gradient(150deg,#e9e6de,#dbd9cf)}
.camera-note{position:absolute;left:8px;top:8px;pointer-events:none;background:#28251ec9;color:white;font-size:.75rem;padding:3px 6px;border-radius:4px}.camera-note:empty{display:none}
.ring{--diam:42px;position:absolute;left:28%;top:48%;width:var(--diam);height:var(--diam);padding:0;transform:translate(-50%,-50%);border:1.5px solid white;border-radius:50%;background:transparent;color:white;touch-action:none;box-shadow:0 0 0 1px #27201866;user-select:none;-webkit-user-select:none}
.ring:before{content:"";position:absolute;inset:2px;border:1px solid #fff;border-radius:50%}.ring:after{content:"";position:absolute;inset:min(0px,calc((var(--diam) - 46px)/2));border-radius:50%}.ring i{position:absolute;width:4px;height:4px;border-radius:50%;background:white;left:calc(50% - 2px);top:calc(50% - 2px)}
.ring span{position:absolute;top:calc(100% + 5px);left:50%;transform:translateX(-50%);background:#28251bcc;color:white;white-space:nowrap;padding:2px 7px;border-radius:4px;font-size:.82rem;line-height:1.35;pointer-events:none}.ring:disabled{opacity:1}#current-ring{left:75%}
.lens-tools{position:relative;display:flex;align-items:center;gap:8px;margin:0 14px;border-bottom:1px solid var(--line)}
.lens-tools button{min-height:40px;padding:3px 3px;color:var(--muted);font-size:.875rem}.lens-tools button[aria-expanded=true]{color:var(--accent);font-weight:650}#details-button{margin-left:auto}
.pop{position:absolute;z-index:3;top:100%;left:0;right:0;padding:12px 14px;background:#fffdf9;border:1px solid var(--line);border-radius:8px;box-shadow:0 6px 20px #382d241e}
.pop label,.field{display:flex;align-items:center;gap:10px;font-size:.95rem}.pop select,.field select{margin-left:auto;max-width:70%;padding:6px;min-height:40px}.pop input{min-width:50px;flex:1;accent-color:#6e5c3d}.pop output{font-variant-numeric:tabular-nums}
.swatches{display:flex;padding:10px 16px 0}.swatches figure{width:50%;margin:0}.swatch{height:clamp(24px,4.8vh,46px);background:#e8e6e0}.swatches figure:first-child .swatch{border-radius:4px 0 0 4px}.swatches figure:last-child .swatch{border-radius:0 4px 4px 0}
figcaption{display:flex;gap:5px;align-items:baseline;margin-top:3px;font-size:.875rem;color:var(--muted)}figure+figure figcaption{justify-content:flex-end}figcaption small{font-size:.75rem;color:var(--accent)}
.reading{padding:10px 16px 4px;min-height:90px}.reading h1{font-size:clamp(1.25rem,5.3vw,1.55rem);line-height:1.3;font-weight:650;letter-spacing:.01em;margin:0 0 4px;text-wrap:pretty}.reading p{margin:0;color:#454039;font-size:1rem;line-height:1.45;text-wrap:pretty}
.reading-head{display:flex;align-items:baseline;column-gap:8px;flex-wrap:wrap}
#now-label{font-size:.8125rem;font-weight:600;color:var(--accent)}
.reading h1{font-size:clamp(1.25rem,5vw,1.375rem)}
.reading #forecast{margin-top:5px;color:var(--muted);font-size:.875rem;line-height:1.4}
#forecast span:first-child{color:var(--accent);font-weight:600;margin-right:.45em}
.comparison{min-height:23px;margin:0 16px;color:#605641;font-size:.875rem;line-height:1.4}.action{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px;padding:7px 14px 9px}.action button{min-height:46px;border-radius:7px;font-size:1rem;padding:6px 13px;font-weight:600}#primary{background:#302f2b;color:#fff}#history{border:1px solid #c1b9a9}
dialog{border:1px solid var(--line);border-radius:14px 14px 0 0;margin:auto auto 0;padding:0;width:min(100%,620px);max-width:100%;max-height:72vh;max-height:72dvh;color:var(--ink);background:var(--paper);box-shadow:0 -6px 32px #302b2418}dialog::backdrop{background:#25231e55}dialog[open]{display:flex;flex-direction:column}.sheet-head{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:5px 15px;border-bottom:1px solid var(--line)}.sheet-head h2{margin:0;font-size:1.12rem}.sheet-head button,.menu-row{min-height:44px;font-size:.95rem}.sheet-body{overflow:auto;overscroll-behavior:contain;padding:12px 16px max(16px,env(safe-area-inset-bottom));line-height:1.55}.sheet-body small{display:block;color:var(--muted);margin-top:6px}.menu-row{display:block;text-align:left;width:100%;border-bottom:1px solid var(--line);padding:8px 0}.sheet-body p{margin:.55em 0}.sheet-body dl{margin:8px 0}.sheet-body dt{font-weight:650}.sheet-body dd{margin:0 0 10px;color:var(--muted)}#rounds{padding:0;list-style:none}#rounds li{border-top:1px solid var(--line);padding:12px 0}.chip{display:inline-block;width:21px;height:15px;vertical-align:middle}.chip:first-of-type{margin-left:8px}#rounds input{width:100%;padding:8px;border:1px solid var(--line);border-radius:4px;background:#fff}#rounds label{display:block;margin-top:5px;color:var(--muted);font-size:.875rem}
@media(max-height:630px){.brand{min-height:42px}.modebar{min-height:42px}.reading{min-height:76px;padding-top:6px}.swatches{padding-top:6px}.action{padding-top:3px}.camera{min-height:130px}}
@media(max-width:365px){.segmented button,.camera-tools button{padding:4px 6px}.lens-tools{gap:5px}.reading{min-height:84px}}
@media(orientation:landscape) and (max-height:550px) and (min-width:540px){#app{display:grid;max-width:960px;width:100%;grid-template-columns:1fr 1fr;grid-template-rows:auto auto minmax(44px,1fr) auto auto auto}.brand{grid-column:1/3}.modebar{grid-column:1;grid-row:2}.camera{grid-column:1;grid-row:3/6;min-height:104px}.lens-tools{grid-column:1;grid-row:6}.swatches{grid-column:2;grid-row:2}.reading{grid-column:2;grid-row:3/5}.comparison{grid-column:2;grid-row:5}.action{grid-column:2;grid-row:6}}

/* Keep the preview steady as the verdict becomes available. Longer text and
   enlarged system fonts can still grow naturally. */
#app[data-measuring] .reading{min-height:8.5rem}
html[lang=en] #app[data-measuring] .reading{min-height:9rem}

@media (orientation:portrait) and (max-height:600px){
  .camera{min-height:108px}
  .reading{padding:5px 12px 2px}
  .reading h1{margin-bottom:2px}
  .reading p{line-height:1.35}
  .reading #forecast{line-height:1.35;margin-top:3px}
  .action{padding-bottom:5px}
}
