@font-face {
  font-family: DM;
  src: url(fonts/dm-sans.ttf);
  font-weight: 100 1000;
  font-display: swap;
}
:root {
  --green: #244c35;
  --ink: #20382a;
  --muted: #52665a;
  --line: #d0d9cc;
  --paper: #fcfcf8;
  --stage: #f0f1e9;
  --faint: #eef3e8;
  color: var(--ink);
  background: var(--paper);
  font-family: DM, "Segoe UI", sans-serif;
}
* { box-sizing: border-box }
body, h1, h2, p, figure { margin: 0 }
body { min-height: 100vh }
[hidden] { display: none !important }
.symbols { position: absolute; width: 0; height: 0; overflow: hidden }
button, input, output { font: inherit }
button {
  color: var(--green); font-weight: 620; cursor: pointer;
  border: 0; background: transparent; border-radius: 8px;
}
button:disabled { opacity: .42; cursor: default }
:focus-visible { outline: 3px solid #618547; outline-offset: 2px }
button svg, label svg { display: block; width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round }
.brand { border-bottom: 1px solid var(--line) }
.brand > div, main { max-width: 1100px; margin: 0 auto; padding-inline: clamp(16px,4.5vw,48px) }
.brand > div { display: flex; align-items: center; gap: 20px; height: 74px }
.brand img { width: 65px; height: 48px; object-fit: contain }
h1, h2 { letter-spacing: -.04em; line-height: 1.13; font-weight: 650 }
h1 { font-size: clamp(1.45rem,2.35vw,2.1rem); border-left: 1px solid var(--line); padding-left: 20px }
main { padding-block: 18px 20px }
.settings { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; justify-content: space-between }
fieldset { min-width: 0; border: 0; margin: 0; padding: 0 }
legend { font-size: .98rem; font-weight: 700; line-height: 1.25; padding: 0 }
.segments { display: inline-flex; gap: 3px; flex-wrap: wrap; align-items: center; vertical-align: middle }
.segments button { position: relative; isolation: isolate; font-size: .875rem; font-weight: 560; min-height: 40px; padding: 5px 11px; line-height: 1.25 }
.segments button::before { position: absolute; z-index: -1; content: ""; inset: 4px 0; background: #fff; border: 1px solid var(--line); border-radius: 8px }
.segments button[aria-pressed="true"] { color: #fff; font-weight: 630 }
.segments button[aria-pressed="true"]::before { background: var(--green); border-color: var(--green) }
.segments button:hover::before { border-color: #6f8d6b }
.compareBtn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 6px 12px; border: 1px solid #b9c9b5; background: #f4f7ef; font-size: .875rem; line-height: 1.2; text-align: left; text-wrap: balance }
.compareBtn::before { content: ""; flex: none; width: 24px; height: 16px; border: 1px solid #667b5c; border-radius: 4px; background: linear-gradient(90deg,#ebf3e4 48%,#667b5c 48% 52%,#f5efe1 52%) }
.compareBtn:hover { background: #e9f0e1; border-color: #748b69 }
.views { display: flex; gap: 16px; margin-block: 8px 10px; border-bottom: 1px solid var(--line) }
.views button { min-height: 42px; border-radius: 0; padding: 6px 3px; font-size: .93rem; color: var(--muted); position: relative }
.views button[aria-current="page"] { color: var(--green); font-weight: 730 }
.views button[aria-current="page"]::after { content: ""; position: absolute; bottom: -1px; height: 3px; inset-inline: 0; background: var(--green); border-radius: 3px }
.views button:hover { color: var(--ink) }
.stage, #jarWindow, .zoomWindow { background: var(--stage); border-radius: 14px; overflow: hidden }
.stage { position: relative }
.stage .media { width: 100%; height: clamp(300px,calc(100dvh - 300px),590px); display: block; border: 0; padding: 8px 0; cursor: zoom-in }
.stage canvas, .stage .poster { width: 100%; height: 100%; display: block; object-fit: contain }
.stage .expand {
  position: absolute; top: 12px; right: 12px; min-height: 42px; padding: .4rem .9rem;
  display: flex; align-items: center; gap: .45rem; background: var(--green); color: #fff;
  font-size: .95rem; font-weight: 680; border: 1px solid #193927; box-shadow: 0 2px 6px #142c1b20;
}
.stage .expand:hover { background: #143d29 }
#notice, #detailError { color: var(--muted); font-size: .91rem; margin: 6px 0 }
.mainRotate { max-width: 760px; margin: 12px auto 0 }
.rotateHead { display: flex; align-items: center; justify-content: space-between; gap: 8px }
.rotateHead label { display: inline-flex; align-items: center; gap: .42em; font-size: 1.03rem; font-weight: 710 }
.rotateHead label svg { width: 1.4em; height: 1.4em; color: var(--green) }
.rotateHead output { background: var(--faint); color: var(--green); border-radius: 7px; min-width: 3em; text-align: center; padding: .12rem .45rem; font-size: .86rem; font-weight: 640; font-variant-numeric: tabular-nums }
input[type="range"] { appearance: none; display: block; width: 100%; height: 40px; margin: 0; background: transparent; cursor: pointer; accent-color: var(--green); border-radius: 4px }
input[type="range"]::-webkit-slider-runnable-track { height: 7px; border-radius: 10px; background: linear-gradient(to right,var(--green) 0 var(--turn,0%),#c9d7c3 var(--turn,0%) 100%) }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 23px; height: 23px; margin-top: -8px; background: var(--green); border: 3px solid var(--paper); border-radius: 50%; box-shadow: 0 0 0 1px #90a68a }
input[type="range"]::-moz-range-track { height: 7px; background: #c9d7c3; border-radius: 10px }
input[type="range"]::-moz-range-progress { height: 7px; background: var(--green); border-radius: 10px }
input[type="range"]::-moz-range-thumb { width: 17px; height: 17px; background: var(--green); border: 3px solid var(--paper); border-radius: 50%; box-shadow: 0 0 0 1px #90a68a }
dialog { width: min(96vw,1060px); max-height: 94dvh; border: 1px solid var(--line); color: var(--ink); padding: 0; background: var(--paper); border-radius: 14px; overflow: hidden }
dialog::backdrop { background: #13221baf }
body:has(dialog[open]) { overflow: hidden }
#panel { display: flex; flex-direction: column; gap: 12px; max-height: 93dvh; padding: clamp(12px,2vw,24px); overflow: auto; overscroll-behavior: contain }
.detailHeader { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex: none }
.detailHeader h2 { font-size: clamp(1.35rem,2.5vw,2.2rem) }
.detailHeader p { font-size: .88rem; color: var(--muted) }
.detailHeader p:empty { display: none }
#back { flex: none; padding: 6px 12px; border: 1px solid var(--line); min-height: 40px; font-size: .88rem }
#back:hover { background: var(--faint) }
#jarWindow { flex: 1 1 auto; min-height: 80px; position: relative }
#zoomJar { width: 100%; height: 100%; position: absolute; inset: 0; display: block; touch-action: none }
.zoomWindow { height: min(58dvh,580px); overflow: auto; overscroll-behavior: contain }
#zoomSheet { display: grid; place-items: center; min-width: 100%; min-height: 100% }
#zoomSheet img { display: block; max-width: none; object-fit: contain }
#comparison { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px; overflow: auto }
#comparison figcaption { color: var(--ink); font-size: .95rem; font-weight: 650; margin-bottom: 7px }
#comparison img { width: 100%; display: block; border-radius: 8px }
#detailTools { display: flex; justify-content: center; align-items: center; gap: clamp(10px,3vw,30px); flex: none }
#zoomRotate { flex: 1 }
.zoomControls { display: flex; gap: 6px; align-items: center; flex: none }
.zoomControls button { border: 1px solid var(--line); font-size: 1.25rem; width: 42px; min-height: 42px; background: var(--paper) }
.zoomControls output { min-width: 3.8em; text-align: center; font-weight: 650; font-variant-numeric: tabular-nums; font-size: .9rem }
dialog.full-window { inset: 0; width: 100%; height: 100dvh; max-width: none; max-height: none; margin: 0; border: 0; border-radius: 0 }
dialog.full-window #panel { width: 100%; height: 100%; max-height: none; padding: max(12px,env(safe-area-inset-top)) max(16px,env(safe-area-inset-right)) max(8px,env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left)) }
@media(max-width:700px) {
  .brand > div { gap: 12px; height: 55px }
  .brand img { width: 49px; height: 39px }
  h1 { padding-left: 12px }
  main { padding-top: 10px }
  .settings { gap: 3px 14px }
  legend { font-size: .95rem }
  .segments button { min-height: 38px; padding-inline: 9px; font-size: .86rem }
  .views { margin-block: 4px 7px }
  .stage .media { height: clamp(180px,calc(100dvh - 262px),560px); padding-top:30px }
  .stage .expand { top: 9px; right: 9px }
  .mainRotate { margin-top: 8px }
  dialog { width: min(97vw,1060px); max-height: 96dvh }
  #panel { max-height: 95dvh; gap: 8px }
  #comparison { grid-template-columns: 1fr; gap: 14px }
  #detailTools { gap: 14px }
  #zoomAmount { gap: 2px }
  #zoomAmount output { min-width: 3.4em; font-size: .85rem }
}
@media(max-width:480px) {
  .settings { display: grid; grid-template-columns: max-content minmax(0,1fr); gap: 8px }
  .compareBtn { justify-self: end; max-width: 164px; padding-inline: 8px; font-size: .81rem; gap: 6px }
  .detailHeader h2 { font-size: 1.35rem }
  #back { padding-inline: 9px }
  .zoomControls button { width: 38px; min-height: 38px }
}
@media(max-width:350px) {
  .brand > div, main { padding-inline: 12px }
  .segments button { padding-inline: 7px }
  .views { gap: 14px }
  .stage .media { height: clamp(156px,calc(100dvh - 262px),460px) }
  dialog.full-window #panel { padding-inline: 9px }
  #detailTools { gap: 8px }
}
@media(max-height:500px) and (orientation:landscape) {
  .brand > div { height: 48px; gap: 12px }
  .brand img { height: 36px; width: 46px }
  h1 { font-size: 1.3rem; padding-left: 12px }
  main { display:grid; grid-template-columns:minmax(195px,32%) minmax(0,1fr); grid-template-rows:auto minmax(0,1fr) auto; grid-template-areas:"settings views" "settings stage" "giro stage"; gap:4px 18px; height:calc(100dvh - 49px); padding-block:5px 8px }
  main .settings { grid-area:settings; display:flex; flex-direction:column; flex-wrap:nowrap; gap:4px; overflow:auto; align-items:flex-start; justify-content:flex-start }
  main .views { grid-area:views; margin:0 }
  main .stage { grid-area:stage; min-height:0 }
  main .stage .media { height:100%; padding:2px 0 }
  main .mainRotate { grid-area:giro; width:100%; margin:0 }
  dialog.full-window #panel { display: grid; grid-template-columns: minmax(210px,32%) minmax(0,1fr); grid-template-rows: auto 1fr auto; gap: 8px 14px; padding: 7px 12px }
  .full-window .detailHeader { grid-column: 1 / -1 }
  .full-window .detailHeader h2 { font-size: 1.15rem }
  .full-window .detailSettings { display: flex; flex-direction: column; flex-wrap: nowrap; gap: 3px; overflow-y:auto; min-height:0; align-items:flex-start; justify-content:flex-start }
  .full-window #jarWindow { grid-column: 2; grid-row: 2; min-height: 0 }
  .full-window #detailTools { grid-column: 1 / -1 }
  .full-window #comparison { grid-column: 1 / -1; grid-row: 2 }
}

