:root {
  color-scheme:light;
  --paper:#f7f3e8; --ink:#34372e; --muted:#626655; --red:#a64932; --line:#cbc8b8;
  --digits:"Barlow Condensed","Arial Narrow","Helvetica Neue",Arial,sans-serif;
  font-family:"DM Sans","Hiragino Kaku Gothic ProN","Yu Gothic",Meiryo,sans-serif;
  color:var(--ink); background:#f3efe3;
}
* {box-sizing:border-box}
[hidden] {display:none!important}
body {margin:0;min-width:240px;background:
  repeating-linear-gradient(0deg,transparent 0 3px,#62543704 3px 4px),
  radial-gradient(ellipse at 30% 0%,#fffdf5 0,transparent 58%);}
button {font:inherit;color:inherit;cursor:pointer;-webkit-tap-highlight-color:transparent}
button:focus-visible,#field:focus-visible {outline:3px solid #23675c;outline-offset:3px}
.cabinet {width:min(1180px,100%);height:100vh;height:100svh;max-height:1050px;min-height:440px;
  margin:auto;display:flex;flex-direction:column;
  padding:max(20px,env(safe-area-inset-top)) clamp(14px,3.2vw,46px) max(12px,env(safe-area-inset-bottom));}
.mast {display:flex;align-items:center;gap:16px;padding:0 0 18px;flex:none}
.brand {width:54px;height:54px;image-rendering:pixelated;transform:rotate(-3deg)}
.title p {margin:0 0 3px;color:var(--red);font:700 .71rem/1.1 "Courier New",monospace;letter-spacing:.12em;text-transform:uppercase}
h1 {font-family:"Hiragino Mincho ProN","Yu Mincho","Noto Serif CJK JP",serif;letter-spacing:.035em;font-size:clamp(1.58rem,2.7vw,2.2rem);line-height:1.2;margin:0;font-weight:900}
.sound {margin-left:auto;background:#fbf8ef;border:1px solid #bcb9a9;border-radius:20px;padding:0 14px;height:38px;min-width:44px;display:flex;align-items:center;justify-content:center;gap:9px;font-size:.82rem;font-weight:650}
.sound:hover {background:#ece9db}
.speaker {width:18px;height:17px;position:relative;display:inline-block}
.speaker:before {content:"";position:absolute;background:var(--ink);width:12px;height:16px;top:1px;left:0;clip-path:polygon(0 33%,35% 33%,84% 6%,84% 94%,35% 67%,0 67%)}
.speaker b,.speaker:after {content:"";position:absolute;border:1.7px solid var(--ink);border-width:0 1.7px 0 0;border-radius:50%;top:4px;right:3px;width:7px;height:10px}
.speaker:after {right:0;top:1px;height:16px;width:11px}
.sound[aria-pressed="false"] .speaker b {display:none}
.sound[aria-pressed="false"] .speaker:after {top:-1px;left:8px;border:0;border-left:2px solid var(--red);border-radius:0;transform:rotate(42deg);height:20px}
.board {display:flex;flex:1;min-height:0;flex-direction:column;background:var(--paper);border:1px solid #a9aa98;border-radius:5px;box-shadow:0 3px 0 #c5c1ad,0 8px 18px #47432e09;overflow:hidden}
.scoreboard {display:grid;grid-template-columns:.85fr 1.12fr 1.12fr .89fr;align-items:center;flex:none;min-height:75px;padding:10px 0;border-bottom:1px solid #959b87;background:#fbf8ef}
.stat {padding:0 clamp(12px,3vw,38px);line-height:1;border-right:1px solid var(--line)}
.stat:last-child {border:0}
.stat-name {color:var(--muted);display:flex;align-items:center;gap:5px;font-size:.78rem;line-height:1.25;font-weight:650;letter-spacing:.055em;margin-bottom:4px}
.stat strong,.result-scores strong {font:700 1.78rem/1 var(--digits);font-variant-numeric:tabular-nums;letter-spacing:-.035em}
.stat strong small,.result-scores small {font-size:.55em;margin-left:2px}
.supply-line,.damage-line {display:flex;align-items:center;gap:14px}
.stones {display:flex;gap:3px;align-items:center}
.stones img {width:24px;height:21px;image-rendering:pixelated}
.stones img.used {filter:grayscale(1);opacity:.21}
.damage strong {color:var(--red)}
.meter {height:6px;width:clamp(45px,7vw,94px);border-radius:1px;background:#e1ddcf;overflow:hidden}
.meter i {height:100%;display:block;background:var(--red);width:0}
.split-block {background:linear-gradient(122deg,#8d654d 0 42%,transparent 43% 56%,#8d654d 57%);width:10px;height:10px;border-radius:1px;transform:rotate(-5deg)}
.laurel {font:1rem/.8 Georgia,serif;color:#8b744a}
.best strong {color:#535748}
.scene {position:relative;isolation:isolate;flex:1;min-height:0;overflow:hidden;background:#a4bdac url('./assets/toscana.png') center 64%/cover no-repeat}
#picture,#guide,#field {position:absolute;inset:0;width:100%;height:100%;display:block}
#picture {image-rendering:pixelated;pointer-events:none}
#field {touch-action:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;cursor:crosshair;outline-offset:-4px!important}
#field[aria-disabled="true"] {cursor:default}
#guide {pointer-events:none}
.place {color:#335a50;white-space:nowrap;padding-left:clamp(13px,2.9vw,35px);border-right:1px dashed #c5bfa9}
.place>div {display:flex;align-items:center;gap:6px;font:700 .70rem/1.1 "Courier New",monospace;letter-spacing:.12em;text-transform:uppercase}
.place em {display:block;font:italic 600 2.15rem/.98 "Baskerville","Georgia","Times New Roman",serif;letter-spacing:-.055em}
.flag {width:18px;height:10px;background:linear-gradient(90deg,#3d7559 0 33.33%,#fff1d3 33.33% 66.66%,#bd644b 66.66%);box-shadow:0 0 0 1px #395f4c24}
.feedback {position:absolute;bottom:8%;left:50%;transform:translateX(-50%);margin:0;white-space:nowrap;pointer-events:none;
  color:#fff6dd;background:#373f34f2;border:1px solid #e3dabc88;box-shadow:0 2px 0 #27332a22;padding:8px 15px;border-radius:3px;font-size:.85rem}
.instruction {display:flex;align-items:center;min-height:58px;flex:none;padding:8px clamp(12px,2.4vw,30px);gap:12px;border-top:1px solid #a2a78e;background:var(--paper)}
.instruction p {margin:0;font-size:clamp(.85rem,1.5vw,1.02rem);letter-spacing:.035em;font-weight:550}
.instruction b {color:var(--red);font-weight:750}
.hand {width:35px;height:33px;flex:none;display:grid;place-items:center;border-radius:3px;background:#ebe5d5;border:1px solid #d4cbb5;color:#695a43}
.hand span {font:1.9rem/.7 Georgia,serif;transform:rotate(-57deg);display:block}
.legend {display:flex;gap:18px;margin-left:auto;border-left:1px solid var(--line);padding-left:16px;color:var(--muted);font-size:.79rem;white-space:nowrap}
.legend span {display:flex;gap:6px;align-items:center}
.circle,.diamond {display:inline-block;width:12px;height:12px;border-radius:50%;border:2px solid #af7131}
.diamond {width:10px;height:10px;border-radius:0;transform:rotate(45deg);border-color:#4c8278}
footer {display:flex;align-items:center;gap:7px;margin:13px 1px 0;font-size:.75rem;letter-spacing:.02em;color:#616452;flex:none}
footer b {font-family:"Courier New",monospace;letter-spacing:.045em}
#version {margin-left:auto;font:700 .78rem/1.2 "Courier New",monospace;letter-spacing:.05em}
.blocks-mark {width:13px;height:13px;position:relative}
.blocks-mark i {position:absolute;width:5px;height:5px;background:#878875;bottom:1px}
.blocks-mark i:nth-child(2) {left:6px}
.blocks-mark i:nth-child(3) {bottom:7px;left:3px}
.result {position:absolute;left:50%;bottom:clamp(10px,3.2%,26px);transform:translateX(-50%);width:min(326px,calc(100% - 24px));text-align:center;
  background:#fff8e7;color:var(--ink);border:1px solid #6a6d53;border-top:4px solid var(--red);border-radius:4px;padding:13px 19px 14px;box-shadow:0 3px 0 #54564070,0 10px 30px #26362b4d}
.result-caption {display:flex;justify-content:center;align-items:center;gap:11px;color:var(--red)}
.result h2 {font:800 1.05rem/1.2 "Yu Mincho","Noto Serif CJK JP",serif;margin:0}
.ticket-mark {width:20px;height:3px;border-block:1px solid #bca681}
.result-scores {display:grid;grid-template-columns:1fr 1fr;margin:12px 0 6px}
.result-scores>div+div {border-left:1px solid var(--line)}
.result-scores span {font-size:.77rem;color:var(--muted)}
.result-scores strong {display:block;margin-top:3px;font-size:2rem}
.result-scores>div:first-child strong {color:var(--red)}
.result-scores b {font:inherit}
.result p {border-top:1px dashed #cfc6b1;padding-top:7px;margin:8px 0;color:#62624f;font-size:.78rem}
#retry {width:100%;min-height:48px;border:1px solid #833b29;background:var(--red);color:#fff9e7;border-radius:3px;font-weight:700;font-size:1rem;letter-spacing:.08em}
#retry span {font:1.25rem Arial,sans-serif;vertical-align:-1px}
#retry:hover {background:#903f2b}
@media(max-width:600px){
  .cabinet {padding:max(12px,env(safe-area-inset-top)) 9px max(9px,env(safe-area-inset-bottom));}
  .mast {padding:0 3px 12px;gap:10px}
  .brand {width:41px;height:41px}
  .title p {font-size:.63rem;letter-spacing:.095em}
  h1 {font-size:1.45rem}
  .sound {min-width:44px;min-height:44px;padding:0;border:0;background:transparent}
  .sound>span {display:none}
  .scoreboard {grid-template-columns:.71fr 1.12fr .95fr 1fr;min-height:61px;padding:7px 0}
  .stat {padding:0 8px}
  .stat-name {font-size:.75rem;letter-spacing:0;margin-bottom:3px}
  .stat strong {font-size:1.43rem}
  .stat small {margin:0}
  .stones {gap:0}
  .stones img {width:14px;height:12px}
  .supply-line {gap:4px}
  .damage-line {gap:5px}
  .meter {display:none}
  .scene {background-image:url('./assets/toscana-verticale.png')}
  .place {padding-left:9px}
  .place>div {font-size:.6rem;letter-spacing:.03em;gap:4px}
  .place em {font-size:1.6rem}
  .flag {width:12px;height:7px}
  .instruction {min-height:52px;padding:7px 10px;gap:8px;flex-wrap:wrap;row-gap:3px}
  .instruction p {letter-spacing:.01em}
  .hand {width:28px;height:27px}
  .hand span {font-size:1.65rem}
  .legend {padding-left:9px;gap:8px;font-size:.71rem}
  .legend span {gap:3px}
  .circle {width:9px;height:9px}.diamond {width:8px;height:8px}
  footer {margin:10px 4px 0}
}
@media(max-width:355px){
  .meter {display:none}.legend {border:0;padding:0}.stat {padding-inline:7px}
  .instruction {gap:5px}.instruction p {font-size:.79rem}
}
@media(max-height:550px) and (min-aspect-ratio:1/1) {
  .cabinet {padding-top:5px;padding-bottom:5px;min-height:300px}
  .mast {padding-bottom:5px;gap:8px}.brand {width:32px;height:32px}
  .title p {display:none}h1 {font-size:1.3rem}.sound {height:30px}
  .scoreboard {min-height:43px;padding-block:4px}.stat-name {font-size:.7rem;margin:0}.stat strong {font-size:1.15rem}
  .instruction {min-height:32px;padding-block:2px}.hand {height:24px}footer {margin-top:5px}
  .result {padding:6px 12px;bottom:4px}.result-scores {margin:3px 0}.result-scores strong {font-size:1.4rem}.result p {margin:4px 0;padding:0}
}
