/* Ô ĂN QUAN V2 — SÂN ĐÌNH. Pure visual layer: no game logic changed. */
:root {
  color-scheme: light;
  --cream:#fff5df;
  --cream-dim:#f8e5bd;
  --gold-300:#ffe9ad;
  --gold-400:#f3c976;
  --gold-500:#dea04c;
  --gold-600:#a56028;
  --jade:#b5f3ca;
  --violet:#ffd2ac;
  --wood:#583322;
  --wood-hi:#aa7144;
  --rim:#e9bd74;
}
html {background:#7b522f;}
body {
  background:#7b522f url('assets/village-courtyard.svg') center center / cover fixed no-repeat;
  color:var(--cream);
}
body::before {
  content:""; position:fixed; inset:0; pointer-events:none; z-index:0;
  background:linear-gradient(180deg,rgba(32,37,23,.28) 0%,rgba(68,39,18,.20) 21%,rgba(67,37,17,.17) 51%,rgba(57,31,18,.38) 100%);
}
.beams,.vignette {display:none;}
.wrap {max-width:1290px;padding:20px 23px 30px;}
#play.on {gap:10px;}
.folk-head {
 display:flex;align-items:center;justify-content:center;gap:16px;
 max-width:100%; margin:0 auto 1px; position:relative;
}
.folk-head .folk-seal {
 width:51px;height:51px;display:grid;place-items:center;flex:none;
 border:3px solid #e8b675;border-radius:50%;
 background:radial-gradient(circle at 27% 25%,#fff2bd 0%,#b8793c 55%,#6a341e 95%);
 color:#61371e;font:bold 27px Georgia,serif;box-shadow:0 4px 1px #58301e,0 8px 15px rgba(34,20,8,.42);
 transform:rotate(-11deg);
}
.folk-head .brand {
 position:relative; padding:5px 34px 9px; min-width:285px;text-align:center;
 border:2px solid #e8b776;border-radius:13px 13px 19px 19px;
 background:linear-gradient(170deg,#854b28 0%,#5a2b1d 52%,#3d2118 100%);
 box-shadow:inset 0 2px 0 rgba(255,232,165,.36),inset 0 -3px 0 rgba(24,10,8,.6),0 5px 0 #3f2315,0 11px 26px rgba(33,20,8,.35);
}
.folk-head .brand strong {
 display:block; font:900 clamp(25px,3.3vw,39px)/1.18 var(--fx-body);
 letter-spacing:.025em;color:#ffdc8d; text-shadow:0 3px 0 #67331a,0 5px 9px rgba(0,0,0,.7);
}
.folk-head .brand small {display:block;letter-spacing:.21em;font-size:9px;color:#edcfa0;font-weight:700;margin-top:1px;}
.bar {margin-bottom:1px;gap:8px;}
.bar .tools {gap:8px;}
.icobtn,.btn.ghost,.chip {
 background:linear-gradient(180deg,rgba(120,72,39,.97),rgba(65,34,22,.98));
 border:1.5px solid #c89053;color:#fff1d6;
 box-shadow:inset 0 1px 0 rgba(255,244,211,.25),0 3px 0 rgba(48,27,17,.85),0 6px 14px rgba(43,27,15,.26);
 border-radius:11px;
}
.icobtn {padding:9px 14px;font-size:13px;font-weight:800;text-shadow:0 1px 1px #3b271b;}
.icobtn:hover,.btn.ghost:hover {border-color:#ffe1a1;color:white;filter:brightness(1.13);}
.btn {
 border:2px solid #ffe8aa;background:linear-gradient(180deg,#ffe6a1,#e8b051 67%,#c58734);
 box-shadow:inset 0 2px rgba(255,255,255,.5),0 5px 0 #8a4b27,0 12px 20px rgba(51,30,14,.28);
 color:#4b2718;text-shadow:0 1px rgba(255,255,255,.2);border-radius:13px;
}
.btn:focus-visible,.icobtn:focus-visible,.cell:focus-visible,.chip:focus-visible {outline:3px solid #fff7bf;outline-offset:3px;}
.scores {gap:16px;margin:0 0 6px;}
.sc {
 min-height:88px;padding:12px 18px 12px 68px;
 border:2px solid #e0b17b;border-radius:16px;
 background:linear-gradient(118deg,rgba(13,79,64,.96),rgba(31,83,65,.91)),repeating-linear-gradient(15deg,transparent 0 11px,rgba(255,255,255,.1) 12px);
 box-shadow:inset 0 1px 0 rgba(255,238,194,.26),inset 0 -3px 0 rgba(29,24,15,.24),0 5px 0 rgba(69,36,19,.38),0 10px 24px rgba(41,20,6,.23);
 text-shadow:0 1px 3px rgba(0,0,0,.45);
}
.sc.p1 {padding:12px 68px 12px 18px;background:linear-gradient(118deg,rgba(105,43,37,.94),rgba(125,51,43,.97));}
.sc::before {
 content:'●';position:absolute;left:16px;top:50%;transform:translateY(-50%);
 height:36px;width:36px;display:grid;place-items:center;border-radius:50%;
 font-size:22px;background:linear-gradient(150deg,#e3ba76,#b0763c);
 border:2px solid #f7dc94;color:#694129;box-shadow:0 3px 0 rgba(48,27,17,.6);
}
.sc.p1::before {content:'✦';left:auto;right:16px;}
.sc .who {letter-spacing:.08em;opacity:.93;font-size:12px;}
.sc .pts {font:900 31px/1.1 var(--fx-body);color:#fff1b5!important;letter-spacing:.02em;}
.sc .brk {font-size:11.5px;opacity:.86;}
.sc.turn {border-color:#ffe4a0;box-shadow:0 0 0 2px rgba(255,245,174,.23),0 7px 19px rgba(46,23,7,.3),inset 0 1px rgba(255,255,255,.4);}
.sc.turn::after {width:0;}
.boardwrap {max-width:min(100%,max(320px,calc((100dvh - 340px)*3.3)));}
.board {
 gap:9px;padding:18px 20px;
 background:
 repeating-linear-gradient(94deg,rgba(255,244,203,.035) 0 4px,rgba(67,27,14,.04) 5px 13px,transparent 15px 22px),
 linear-gradient(168deg,#c18a51 0%,#b77947 50%,#85512f 100%);
 border:7px solid #744227;border-radius:32px;
 box-shadow:inset 0 0 0 3px #e4ae6c,inset 0 0 0 7px rgba(104,60,35,.45),inset 0 5px 20px rgba(255,228,151,.24),0 10px 0 #56311e,0 16px 12px rgba(49,29,16,.28),0 27px 50px rgba(27,25,10,.44);
}
.board::before,.board::after {content:'❦';position:absolute;color:rgba(84,46,25,.5);font-size:16px;top:5px;left:9px;pointer-events:none;z-index:1;}
.board::after {left:auto;right:9px;transform:scaleX(-1);}
.cell,.cell.quan {
 border:2px solid #e3ae6b;
 background:
 radial-gradient(ellipse 92% 72% at 45% 15%,rgba(54,26,12,.36),transparent 65%),
 radial-gradient(120% 94% at 50% 90%,#bb7a49 4%,#9c5e35 62%,#824524 100%);
 box-shadow:inset 0 5px 14px rgba(56,26,13,.7),inset 0 -2px 4px rgba(255,215,150,.33),0 1px 1px rgba(255,236,165,.9);
 border-radius:16px;
}
.cell.quan {border-radius:45%/35%;border-color:#f0cb83;}
.cell.mine0,.cell.mine1 {border-color:#e3ae6b;}
.cell.pick {
 border-color:#fff3a7;
 box-shadow:inset 0 6px 12px rgba(55,25,12,.5),0 0 0 2px rgba(255,237,141,.64),0 0 18px rgba(255,237,141,.4);
}
.cell.pick:hover {transform:translateY(-3px);filter:brightness(1.08);}
.cell.hintbest {animation:hintpulse 1.1s ease-in-out infinite;}
.cell.active {border-color:#fff3ac;box-shadow:inset 0 5px 9px rgba(50,24,13,.6),0 0 17px rgba(255,220,109,.85);}
.cell.eaten {animation:eaten .5s ease;}
.st {
 background:
 radial-gradient(ellipse 28% 24% at 28% 20%,rgba(255,255,244,.58),transparent 95%),
 radial-gradient(ellipse 95% 80% at 66% 90%,rgba(56,39,27,.45),transparent 70%),
 var(--tone,#c6b69c);
 box-shadow:0 2px 2px rgba(53,26,15,.45),0 5px 6px rgba(44,26,15,.3),inset 0 1px 1px rgba(255,252,235,.53),inset 0 -2px 3px rgba(70,47,32,.3);
}
.st.v0{--tone:#eee0bf}.st.v1{--tone:#c6c1b4}.st.v2{--tone:#edcf9c}.st.v3{--tone:#8c897f}.st.v4{--tone:#dac2a5}
.st.big {
 --tone:linear-gradient(135deg,#f2dcad 0%,#ccaf78 38%,#9b713b 82%,#694321 100%);
 box-shadow:0 0 0 1px #f6d48f,0 4px 6px rgba(42,23,14,.75),inset 0 2px 4px #fff0c6,inset 0 -5px 7px #744720;
}
.qtag {font-size:clamp(8px,1.5vw,11px);color:#f3cd88;text-shadow:0 1px 2px #5a321e;letter-spacing:.18em;}
.cnt {
 right:3px;bottom:2px;min-width:24px;padding:4px 4px 3px;
 color:#fff2d3;font:900 clamp(11px,1.9vw,16px)/1 var(--fx-body);
 background:#693819;border-radius:7px;border:1px solid #dda765;
 text-align:center;text-shadow:0 1px 2px #27180d;box-shadow:0 2px 2px rgba(48,22,11,.42);
}
.cell.quan .cnt {bottom:4px;}
.status {
 align-self:center;min-height:43px;max-width:92%;margin-top:9px;
 padding:9px 23px;border-radius:999px;
 background:linear-gradient(180deg,#68412b,#46281b);
 border:1.5px solid #d19c58;
 box-shadow:inset 0 1px rgba(255,232,169,.28),0 4px 0 rgba(70,38,21,.57),0 6px 17px rgba(45,25,12,.28);
 color:#ffedd0;font-size:13.5px;font-weight:600;
}
.status::before {content:'✦';color:#f5d184;font-size:19px;}
.status b{color:#ffe6a0;}
.toast {background:#4c281b;border-color:#dfb473;}
.modal {background:rgba(38,25,14,.58);backdrop-filter:blur(3px);}
.sheet {
 background:linear-gradient(150deg,#754528,#3f281e 88%);
 border:3px solid #d4a365;box-shadow:inset 0 0 0 2px #71452b,0 23px 50px #2a1a12ad;
 color:#ffecc7;
}
.sheet h2,.sheet h3 {color:#ffe3a3;}
.sheet p,.sheet li {color:#ffe7c1;}
.panel {
 max-width:760px;background:linear-gradient(160deg,rgba(82,48,30,.95),rgba(48,32,24,.96));
 border:3px solid #d4a365; box-shadow:inset 0 1px rgba(255,236,176,.3),0 13px 45px #311b0bb0;
}
#setup .top {margin-bottom:7px;}
#setup h1 {font-family:var(--fx-body);font-weight:900;text-shadow:0 4px 0 #5a2d1e,0 9px 18px #412618;filter:none;}
#setup .sub {color:#fff0d0;text-shadow:0 1px 3px #5b3a26;}
#setup .sketch {opacity:.84;filter:drop-shadow(0 2px 7px rgba(44,29,12,.5));}
.field>.lab{color:#f8d9a4;}
.field>.hint,.note{color:#f2d8b0;}
.chip {color:#fff0d8;border-color:#9c683d;}
.chip small {opacity:.72;}
.chip[aria-checked="true"] {border-color:#fbe5a2;background:linear-gradient(175deg,#ffe09b,#cc8a42);color:#4d2819;}
.btn.ghost {border-radius:14px;}
@media(min-width:641px){#play.on{min-height:calc(100dvh - 65px);}}
@media(max-width:680px){
 body {background-position:center top; background-attachment:fixed;}
 .wrap{padding:12px 9px 23px;}
 .folk-head{margin-bottom:8px;gap:8px;}
 .folk-head .folk-seal{width:35px;height:35px;font-size:18px;border-width:2px;}
 .folk-head .brand{min-width:0;padding:3px 13px 6px;}
 .folk-head .brand strong{font-size:clamp(20px,5.1vw,29px);}
 .folk-head .brand small{font-size:7px;letter-spacing:.13em;}
 .bar{gap:6px;}.bar .tools{gap:5px;}
 .icobtn{padding:8px 8px;font-size:11.7px;}
 .scores{gap:7px;margin-bottom:2px;}
 .sc{min-height:67px;padding:8px 8px 8px 34px;border-radius:12px;}
 .sc::before{left:6px;width:23px;height:23px;font-size:14px;border-width:1px;}
 .sc.p1{padding:8px 34px 8px 8px;}.sc.p1::before{right:6px;}
 .sc .who{font-size:9.5px;letter-spacing:0;}.sc .pts{font-size:22px;}.sc .brk{font-size:9.5px;}
 .board{gap:5px;padding:9px;border-width:5px;border-radius:22px;box-shadow:inset 0 0 0 2px #e4ae6c,0 6px 0 #56311e,0 11px 23px #2d2018aa;}
 .board.vert{max-width:min(430px,max(280px,calc((100dvh - 245px)*0.615)));}
 .board::before,.board::after{font-size:11px;left:3px;top:2px;}.board::after{left:auto;right:3px;}
 .cell{border-radius:10px;border-width:1.5px;}
 .cnt{font-size:11px;min-width:17px;padding:2px 3px;}
 .qtag{top:4px;font-size:8px;letter-spacing:.1em;}
 .status{margin-top:6px;min-height:38px;max-width:100%;padding:8px 11px;border-radius:12px;font-size:11.5px;line-height:1.4;}
 .status::before{font-size:14px;}
 .go{background:linear-gradient(180deg,transparent,rgba(88,49,29,.94) 45%);}
}
@media(max-height:760px) and (min-width:681px){
 .folk-head .folk-seal{height:40px;width:40px;font-size:19px;}.folk-head .brand{padding:2px 20px 4px;}
 .folk-head .brand strong{font-size:25px;}.folk-head .brand small{font-size:7px;}
 .sc{min-height:66px;padding-top:6px;padding-bottom:6px;}.sc .pts{font-size:24px;}
 .boardwrap{max-width:min(100%,max(320px,calc((100dvh - 270px)*3.3)));}
}
@media(prefers-reduced-motion:reduce){.cell.pick:hover{transform:none;}}
/* Final polish for the opening screen */
#setup h1 {
 display:table;margin:6px auto 13px;padding:7px 30px 13px;
 font:900 clamp(34px,7.3vw,57px)/1.2 var(--fx-body);
 color:#ffe7a5!important;-webkit-text-fill-color:#ffe7a5;
 -webkit-background-clip:border-box;background-clip:border-box;
 background:linear-gradient(175deg,#8e542f,#4c2a1d 90%);
 border:3px solid #e9ba77;border-radius:18px;
 box-shadow:inset 0 2px 0 #fff0c066,0 5px 0 #40271a,0 13px 24px #452c1e6b;
 text-shadow:0 2px 0 #8b512e,0 4px 10px #26170d;
 letter-spacing:.035em;
}
#setup .sub {margin:10px auto 11px;max-width:52ch;}
#setup .quick-go {text-align:center;margin:8px auto 16px;}
#setup .quick-go .btn {padding:12px 36px;font-size:15px;}
@media(max-width:680px){
 #setup h1 {font-size:clamp(30px,9vw,43px);padding:9px 23px;margin-top:4px;}
 #setup .quick-go {display:none;}
}
