
/* UI review 2026-10-25: 和風・畳・木駒。対局ロジックには変更を加えない。 */
:root{--paper:#e3ddc5;--white:#fffaf0;--border:#cfbea3;--forest:#265a44;--gold:#c7a36d;--board:#d5a265;--red:#a33829;--shadow:0 2px 8px #402a161c}
body{
  background-color:#a6a88c;
  background-image:
    repeating-linear-gradient(90deg,transparent 0 3px,#4b57330a 3px 4px,transparent 4px 8px),
    repeating-linear-gradient(0deg,#c3c6a83d 0 2px,#7279561a 2px 3px,#bec5a62d 3px 7px);
}
.shell{
  width:min(100%,530px);
  background:
    radial-gradient(ellipse at 96% 2%,#d4ad6860,transparent 30%),
    radial-gradient(ellipse at 0% 95%,#d4ad6850,transparent 26%),
    repeating-linear-gradient(90deg,transparent 0 4px,#505e3308 4px 5px),
    repeating-linear-gradient(0deg,#bbbd9f3f 0 2px,#90987929 2px 4px,#c4c7aa3a 4px 8px),
    #bfc4a4;
  box-shadow:0 0 36px #372b2260;
  padding:0 13px max(13px,env(safe-area-inset-bottom));
}
header{border-bottom:1px solid #7e846d5c;padding:16px 1px 10px;gap:6px;align-items:center}
header>div:first-child{min-width:0;flex:1}
.brand{font-size:clamp(19px,5.7vw,27px);color:#181610}
.version{font-size:10px;background:#fff8e7bc;border:1px solid #968b714d}
.header-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));flex:0 0 190px;gap:7px}
.header-actions .smallbtn{width:100%;height:48px;min-width:0;padding:5px;font-size:11px;display:grid;place-items:center;line-height:1.25;text-align:center;border-radius:11px;box-shadow:0 2px 5px #3624141e;background:linear-gradient(145deg,#fffcf5,#f0eade)}
.menu{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:7px;margin:11px 0 10px}
.menu button{min-width:0;min-height:52px;padding:7px 4px;border-radius:11px;border:1px solid #b9b09f;color:#282a26;background:linear-gradient(145deg,#fffdf7,#eee7d7);box-shadow:0 2px 6px #36241416;font-size:clamp(10px,2.9vw,13px);white-space:normal;line-height:1.3}
.menu button.current{background:linear-gradient(140deg,#286049,#19432f);color:white;border-color:#19432f}
#matchBtn{white-space:normal;font-size:clamp(10px,2.8vw,12px);letter-spacing:0}
#galleryBtn{grid-column:1/-1;min-height:32px;padding:5px 8px;font-size:11px;background:#f6eddd;color:#5a4c35}
body.ui-in-game #galleryBtn{display:none}
.hint{font-size:11px;color:#3e4539;background:#fff9e0b0;border:1px solid #c6bda382;border-radius:7px;padding:5px 7px;min-height:26px}
.playerbar{min-height:68px;padding:9px 13px;margin:8px 0;border-radius:13px;border-color:#cabda6;background:linear-gradient(140deg,#fffcf5,#f6f0e5);box-shadow:0 3px 9px #34251621}
.playername{font-size:16px;color:#29251f}
.playername small{font-size:11px;color:#6c6156}
.clock{font-size:clamp(24px,7vw,34px);color:#20211f}
.clock.turn{color:#265e44}
.hands{min-height:50px;margin:0 0 8px;padding:5px 10px;background:
 repeating-linear-gradient(93deg,#6a3a0b07 0 3px,#fff9d113 3px 5px,#9e5b180e 5px 9px),
 linear-gradient(160deg,#daa76b,#c68e51 90%);border:1px solid #b78243;
 border-radius:10px;box-shadow:inset 0 1px 0 #fff3ce9c,0 3px 7px #41281326}
.hand-title{min-width:40px;color:#3f2810;font-size:12px;font-weight:850}
.nohand{color:#6e4d2b}
.hand-piece{filter:none}
.hand-piece .piece{filter:drop-shadow(0 1px 1px #45311d39)}
.boardwrap{
  border:2px solid #a4713d;border-radius:12px;padding:6px 6px 7px;
  background:repeating-linear-gradient(93deg,#d6a268 0,#cf995e 7px,#d8a66e 11px);
  box-shadow:inset 0 1px #ffeac4aa,0 4px 10px #49341d36;
}
.boardframe{grid-template-columns:minmax(0,1fr) 19px;grid-template-rows:18px auto}
.board{aspect-ratio:1/1.055;background:#d4a369;border:1px solid #53391c;grid-template-rows:repeat(9,minmax(0,1fr))}
.square{aspect-ratio:auto;min-height:0;
  background:repeating-linear-gradient(94deg,#fff3cd20 0 3px,#945c1920 3px 4px,transparent 4px 8px),linear-gradient(145deg,#ddb17a,#d19e60);
  border-right:1px solid #613f246b;border-bottom:1px solid #613f246b}
.piece{filter:drop-shadow(0 1px 1px #49311e38)}
.file-coords,.rank-coords{color:#3c2919;font-size:12px}
.live-effects{gap:7px;margin:7px 0 9px}
.live-effect{border-radius:11px;padding:10px 12px;border:1px solid #d2b16b;background:linear-gradient(110deg,#fff8e5,#f1dcae);box-shadow:0 2px 7px #64401826}
.live-effect.theirs{background:linear-gradient(110deg,#fff1e0,#edd0b9)}
.live-effect-name{font-size:14px;color:#743423}
.live-effect-description{color:#46321c}
.bottom-action-strip{display:grid;grid-template-columns:minmax(0,1fr) 100px;gap:8px;margin:0 0 6px;align-items:stretch}
.bottom-action-strip .hands{margin:0;align-content:center}
.bottom-action-strip .board-tools{display:flex;flex-direction:column;align-items:stretch;gap:5px;padding:0;margin:0;justify-content:stretch;min-height:51px}
.bottom-action-strip .resign{flex:1;min-height:53px;background:linear-gradient(145deg,#b54c35,#962d20);border:1px solid #7b241b;border-radius:10px;color:#fff9f1;font-size:14px;font-weight:850;box-shadow:0 3px 7px #58231740}
.bottom-action-strip .review-trigger{white-space:normal;min-height:35px;font-size:10px;padding:5px 3px}
.footnote{color:#49533c;font-size:10px;text-shadow:0 1px #fff8;padding:11px 0}
@media(min-width:500px){.header-actions{flex-basis:230px}.header-actions .smallbtn{font-size:12px}.menu button{font-size:14px}.playerbar{min-height:75px}}
@media(max-width:390px){
  .shell{padding-left:9px;padding-right:9px}
  header{gap:3px}.brand{font-size:19px}
  .version{font-size:8px;margin-left:2px;padding:2px 3px}
  .header-actions{flex-basis:166px;gap:4px}
  .header-actions .smallbtn{font-size:10px;padding:3px;min-height:44px;height:44px}
  .menu{gap:5px}.menu button{font-size:10px}
  .bottom-action-strip{grid-template-columns:minmax(0,1fr) 83px;gap:5px}
  .bottom-action-strip .resign{font-size:12px}
}


/* Layout 2026-10-25: 効果＋投了／相手名／駒台＋時計／盤／駒台＋時計／自分名 */
.match-alert-bar{display:grid;grid-template-columns:minmax(0,1fr) 86px;gap:8px;align-items:stretch;margin:9px 0 8px;height:73px}
.effect-slot{min-width:0;height:73px;border:1px solid #c9ac73;border-radius:11px;background:linear-gradient(110deg,#fff7df,#f2e3c2);box-shadow:0 2px 6px #4531191a;display:flex;flex-direction:column;overflow:hidden}
.effect-slot .live-effects{display:block!important;min-height:0;min-width:0;flex:1;overflow:auto;overscroll-behavior:contain;padding:7px 9px;margin:0;scrollbar-width:thin}
.effect-slot .live-effect{border:0;border-radius:0;box-shadow:none;padding:0;margin:0 0 6px;background:transparent}
.effect-slot .live-effect.theirs{background:transparent}
.effect-slot .live-effect-head{gap:4px;line-height:1.2}
.effect-slot .live-effect-owner{font-size:9px;padding:2px 4px}
.effect-slot .live-effect-name{font-size:12px}
.effect-slot .live-effect-description{font-size:11px;line-height:1.3;margin-top:3px}
.effect-slot .live-effect-remaining{font-size:9px;margin-left:2px}
.live-effect-normal{height:100%;display:flex;align-items:center;justify-content:center;font-size:14px;font-weight:850;color:#57482f;letter-spacing:.04em}
.effect-slot .review-trigger{flex:0 0 auto;align-self:flex-start;margin:0 6px 4px;padding:3px 7px;font-size:10px;min-height:22px;line-height:1.25}
.match-alert-bar .board-tools{margin:0;padding:0;min-height:0;display:flex;align-items:stretch;justify-content:stretch}
.match-alert-bar .resign{width:100%;height:100%;min-height:0;min-width:0;margin:0;padding:8px 4px;font-size:14px;letter-spacing:.05em;box-shadow:0 2px 7px #5325132d}
.match-player-name{display:block;margin:3px 2px 6px;padding:0 2px;color:#29291e;font-size:14px;font-weight:850;line-height:1.45;border:0;background:transparent;box-shadow:none}
.match-player-name small{display:inline;margin:0 0 0 7px;color:#5c584a;font-size:12px;font-weight:600}
.match-player-name.self-name{margin:6px 2px 9px}
.match-player-row{display:grid;grid-template-columns:minmax(0,1fr) 92px;gap:9px;align-items:stretch;min-height:58px;margin:0 0 8px}
.match-player-row.self-row{margin:8px 0 0}
.match-player-row .hands{height:58px;min-height:58px;min-width:0;margin:0;padding:5px 8px;flex-wrap:nowrap;overflow-x:auto;overflow-y:hidden;scrollbar-width:thin;align-items:center;gap:3px}
.match-player-row .hand-title{flex:0 0 auto;min-width:35px;font-size:11px}
.match-player-row .nohand{white-space:nowrap}
.match-player-row .hand-piece{flex:0 0 auto;height:42px;min-width:32px}
.match-player-row .hand-piece .piece{height:39px;max-height:39px}
.match-player-row .clock{display:flex;align-items:center;justify-content:center;width:92px;height:58px;min-width:0;font-size:clamp(25px,7vw,32px);border:1px solid #cabb9f;border-radius:11px;background:#fff9ebef;box-shadow:0 2px 6px #42301b19;font-variant-numeric:tabular-nums;color:#2d3028}
.match-player-row .clock.turn{color:#24583d;border-color:#658d70}
.match-player-row .clock.urgent{color:var(--red)}
.boardwrap{margin:0}
@media(max-width:390px){
 .match-alert-bar{grid-template-columns:minmax(0,1fr) 74px;gap:6px;height:70px}
 .effect-slot{height:70px}
 .match-player-row{grid-template-columns:minmax(0,1fr) 80px;gap:6px}
 .match-player-row .clock{width:80px;font-size:25px}
 .match-player-row .hand-title{min-width:29px}
 .match-player-name{font-size:13px}
}



/* 2026-10-25 visual refinement v3: refined flat-color wood and legible pentagonal pieces */
:root{--ink:#211d18;--muted:#655e50;--white:#fffaf1;--border:#cabb9f;--forest:#24553e;--gold:#cda467;--board:#dfaf75}
body{
 background-color:#aeb79b;
 background-image:
  repeating-linear-gradient(0deg,#f4f2df12 0 2px,#64745109 2px 3px,transparent 3px 6px),
  linear-gradient(#b8c1a5,#aeb99c);
}
.shell{
 background:
   radial-gradient(circle at 96% 2%,#d4b6783a,transparent 22%),
   radial-gradient(circle at 0% 96%,#d7c28d26,transparent 25%),
   repeating-linear-gradient(0deg,#faf8e715 0 2px,#7b876011 2px 3px,transparent 3px 6px),
   linear-gradient(#bdc6aa,#b5bda0);
 box-shadow:0 0 35px #372f2440;
}
.brand{font-family:"Noto Serif JP","Yu Mincho","Hiragino Mincho ProN",serif;font-weight:900;letter-spacing:-.075em}
.header-actions .smallbtn,.menu button{
 background:linear-gradient(150deg,#fffcf6,#eee7d9);
 border-color:#c5b7a0;
 box-shadow:0 2px 6px #3f2e171b;
}
.menu button.current{background:linear-gradient(145deg,#30674e,#204a39);border-color:#24503d;color:#fff}
#galleryBtn{background:linear-gradient(140deg,#fffbf3,#eee3d4)}
.match-player-row .clock{background:linear-gradient(145deg,#fffcf6,#f4efe7);border:1px solid #c2bba9;box-shadow:0 2px 6px #3f2e171c}
.match-player-row .clock.turn{color:#276345;border-color:#7fa48b}
.match-player-row .clock.urgent{color:#af3125}
.match-player-row .hands,.hands{
 background-color:#ddb17d;
 background-image:
  repeating-linear-gradient(92deg,transparent 0 11px,#a9763909 11px 12px,transparent 12px 25px,#fff4d111 25px 26px,transparent 26px 45px),
  linear-gradient(180deg,#e3bb88,#d9a773);
 background-size:auto,auto;
 border:1px solid #b58b57;
 border-radius:11px;
 box-shadow:inset 0 1px 0 #fff3d07a,0 2px 5px #47311924;
}
.hand-title{color:#3e2b16;font-weight:850}
.nohand{color:#715739}
.boardwrap{
 background-color:#dcb07b;
 background-image:
   repeating-linear-gradient(92deg,transparent 0 17px,#8b5d2f09 17px 18px,transparent 18px 32px,#fff1d511 32px 33px,transparent 33px 54px),
   linear-gradient(145deg,#e4bc89,#d3a16a);
 background-size:auto,auto;
 border:2px solid #ad804c;
 box-shadow:0 4px 11px #49341e34,inset 0 1px 0 #fff4d5a8;
}
.board{
 background-color:#dfb27b;
 background-image:
   repeating-linear-gradient(91deg,transparent 0 20px,#9d6f3d0b 20px 21px,transparent 21px 38px,#fff3d313 38px 39px,transparent 39px 56px),
   linear-gradient(125deg,#e5bc86,#dab075);
 background-size:auto,auto;
 border:1.5px solid #694722;
 box-shadow:inset 0 0 0 1px #fbdfb352;
}
.square{
 background:transparent;
 border-right:1px solid #654421bc;
 border-bottom:1px solid #654421bc;
}
.square:nth-child(9n){border-right:none}
.square:nth-child(n+73){border-bottom:none}
.square.selected{background:#a4cb9988!important}
.square.last{background:#edd28174!important}
.square.incheck{background:#da876d8c!important}
.square.hole{background:radial-gradient(ellipse 44% 38% at 50% 50%,#060f12 0%,#17201b 65%,#725537 79%,#c7a06b 100%)!important}
.piece{filter:drop-shadow(0 1.2px 1px #4b321f43)}
.hand-piece .piece,.match-player-row .hand-piece .piece{filter:drop-shadow(0 1px 0.8px #4b321f3c)}
.piece text{
 font-family:"Noto Serif JP","Yu Mincho","Hiragino Mincho ProN","Noto Serif CJK JP",serif;
 font-weight:900;
 stroke:#20160e;
 stroke-width:.95px;
 stroke-linejoin:round;
 paint-order:stroke fill;
}
.piece .promoted-text{fill:#b32520;stroke:#9b241d;stroke-width:.7px}
.effect-slot{background:linear-gradient(140deg,#fff9eb,#f5ebd3);border-color:#d2b788}
.match-alert-bar .resign{background:linear-gradient(145deg,#b24b36,#983323);color:#fffaf4}
.footnote{color:#515946}

/* Layout geometry v4 — 盤面の正しい9x9比率、盤外座標の余白調整
 * 既存の駒造形／文字の太さ／木目／確定済みのUI並びは保持する。 */
.boardwrap{
  /* 盤外の飾り枠は薄くし、盤面に表示幅を割り当てる */
  padding:5px 5px 6px;
}
.boardframe{
  display:grid;
  grid-template-columns:minmax(0,1fr) 14px;
  grid-template-rows:15px minmax(0,auto);
  gap:0;
  width:100%;
  min-width:0;
}
.board{
  grid-column:1;
  grid-row:2;
  display:grid;
  grid-template-columns:repeat(9,minmax(0,1fr));
  grid-template-rows:repeat(9,minmax(0,1fr));
  width:100%;
  height:auto;
  min-width:0;
  min-height:0;
  aspect-ratio: 1 / 1.06;
}
.board .square{
  /* 旧コードのaspect-ratio:1/1が高さ計算に干渉しないよう無効化 */
  aspect-ratio:auto;
  box-sizing:border-box;
  width:100%;
  height:100%;
  min-width:0;
  min-height:0;
  padding:0;
}
.file-coords{
  grid-column:1;
  grid-row:1;
  display:grid;
  grid-template-columns:repeat(9,minmax(0,1fr));
  height:15px;
  min-width:0;
  font-family:system-ui,"Noto Sans JP",sans-serif;
  font-size:12px;
  line-height:1;
  font-weight:900;
  -webkit-text-stroke:.15px currentColor;
  text-align:center;
}
.rank-coords{
  grid-column:2;
  grid-row:2;
  display:grid;
  grid-template-rows:repeat(9,minmax(0,1fr));
  width:14px;
  min-width:0;
  min-height:0;
  font-family:"Noto Serif JP","Yu Mincho","Hiragino Mincho ProN",serif;
  font-size:13px;
  font-weight:900;
  line-height:1;
  -webkit-text-stroke:.35px currentColor;
  text-align:center;
}
.file-coords span,.rank-coords span{
  display:flex;
  align-items:center;
  justify-content:center;
  min-width:0;
  min-height:0;
}
@media(max-width:390px){
  .boardframe{grid-template-columns:minmax(0,1fr) 13px;grid-template-rows:14px minmax(0,auto)}
  .file-coords{height:14px;font-size:11px}
  .rank-coords{width:13px;font-size:12px}
}


/* UI compact v5 — ゴシック寄りの駒文字、短い駒台・時計、画面高さ対応 */
.piece text{
  font-family:"Noto Sans JP","Noto Sans CJK JP","Hiragino Kaku Gothic ProN","Yu Gothic","Meiryo",sans-serif;
  font-weight:900;
  stroke:#21170e;
  stroke-width:.50px;
  stroke-linejoin:round;
  paint-order:stroke fill;
}
.piece .promoted-text{stroke:#a5261f;stroke-width:.40px}
.brand{font-family:"Noto Sans JP","Yu Gothic","Hiragino Kaku Gothic ProN",sans-serif;font-weight:900;letter-spacing:-.075em}
.rank-coords{font-family:"Noto Sans JP","Noto Sans CJK JP","Yu Gothic","Meiryo",sans-serif;font-weight:900}
.shell{padding-left:10px;padding-right:10px;padding-bottom:max(7px,env(safe-area-inset-bottom))}
header{padding:8px 1px 5px}
.header-actions .smallbtn{height:40px;min-height:40px;padding:3px 5px}
.menu{gap:5px;margin:7px 0 6px}
.menu button{min-height:41px;padding:4px 3px}
#galleryBtn{min-height:26px;padding:3px}
.hint{
 margin:4px 0 5px;padding:4px 6px;min-height:22px;
 font-size:10px;line-height:1.3;
}
.match-alert-bar{height:54px;min-height:54px;margin:5px 0 5px;gap:7px}
.effect-slot{height:54px;min-height:54px}
.effect-slot .live-effects{padding:5px 7px}
.effect-slot .live-effect-name{font-size:11px}
.effect-slot .live-effect-description{font-size:10px}
.effect-slot .live-effect-normal{font-size:13px}
.match-alert-bar .resign{font-size:13px;padding:5px 3px}
.match-player-name{
 margin:2px 1px 4px;padding:0 1px;
 font-size:13px;line-height:1.2;
}
.match-player-name small{font-size:11px}
.match-player-name.self-name{margin:4px 1px 6px}
.match-player-row{
 grid-template-columns:minmax(0,1fr) 83px;
 gap:7px;min-height:45px;margin:0 0 5px;
}
.match-player-row.self-row{margin:5px 0 0}
.match-player-row .hands{
 height:45px;min-height:45px;padding:2px 6px;
 gap:2px;
}
.match-player-row .hand-title{font-size:11px;min-width:34px}
.match-player-row .nohand{font-size:11px}
.match-player-row .hand-piece{height:38px;min-height:0;min-width:30px}
.match-player-row .hand-piece .piece{height:35px;max-height:35px;max-width:32px}
.match-player-row .clock{
 height:45px;width:83px;
 font-size:26px;border-radius:10px;
}
.boardwrap{padding:4px 4px 5px}
.footnote{padding:4px 0 5px;font-size:9px}
@media(max-width:390px){
 .shell{padding-left:8px;padding-right:8px}
 header{padding:6px 0 5px}
 .header-actions .smallbtn{height:36px;min-height:36px}
 .menu{margin:5px 0 5px}
 .menu button{min-height:38px}
 .match-alert-bar{grid-template-columns:minmax(0,1fr) 73px;height:51px;min-height:51px;gap:5px}
 .effect-slot{height:51px;min-height:51px}
 .match-player-row{grid-template-columns:minmax(0,1fr) 75px;gap:5px}
 .match-player-row .clock{width:75px;height:45px;font-size:24px}
 .match-player-row .hand-title{min-width:29px;font-size:10px}
 .match-player-row .hands{padding:2px 4px}
}
@media(max-height:760px){
 /* 小さな画面では盤だけを均等縮小。マス比率1:1.06は維持する。 */
 .boardwrap{
   width:min(100%,max(258px,calc(94dvh - 280px)));
   margin-left:auto;margin-right:auto;
 }
 .test-switch{max-height:150px;overflow-y:auto;overscroll-behavior:contain}
}
@media(max-height:660px){
 .menu button{min-height:35px}
 .match-alert-bar{height:48px;min-height:48px}
 .effect-slot{height:48px;min-height:48px}
 .match-player-row,.match-player-row .hands{min-height:42px;height:42px}
 .match-player-row .clock{height:42px}
 .boardwrap{width:min(100%,max(236px,calc(94dvh - 280px)))}
}


/* UI typography v6: uploaded reference image, bold shogi brush-serif */
.piece text{
  font-family:"Kaisei Tokumin","Noto Serif JP","Yu Mincho","Hiragino Mincho ProN",serif;
  font-weight:800;
  stroke:#20160f;
  stroke-width:.28px;
  stroke-linejoin:round;
  paint-order:stroke fill;
}
.piece .promoted-text{
  fill:#b32520;
  stroke:#a0201c;
  stroke-width:.23px;
}
.brand{
  font-family:"Kaisei Tokumin","Noto Serif JP","Yu Mincho",serif;
  font-weight:800;
  letter-spacing:-.075em;
}


/* Approved shogi UI — test-only build 2026-10-25 v7.
 Layout: header -> game modes -> status+resign -> opponent -> tray+clock -> board -> tray+clock -> self.
 Visual: textured warm hinoki wood, tatami edge, brush kanji. */
:root{
 --approved-wood:url("/assets/materials/wood-base-v1.svg");
 --approved-paper:url("/assets/materials/washi-v1.svg");
 --approved-tatami:url("/assets/materials/tatami-v1.svg");
 --forest:#235740;--gold:#d1a56e;--ink:#251e14;
}
body{background-color:#b9bba4;background-image:var(--approved-tatami);background-size:180px 180px}
.shell{
 max-width:560px;
 background-image:
 radial-gradient(circle at 92% 3%,#c69b6340,transparent 24%),
 linear-gradient(180deg,#fefbf8cc,#f3eee3bb),
 var(--approved-paper);
 background-size:auto,auto,180px 240px;
 box-shadow:0 0 32px #4236212c;
 padding:0 11px max(8px,env(safe-area-inset-bottom));
}
header{padding:9px 1px 8px;border-color:#d0bda0aa}
.brand{
 font-family:"Yuji Boku","Kaisei Tokumin","Noto Serif JP",serif;
 font-weight:400;font-size:clamp(19px,5.6vw,26px);
 color:#1b160e;letter-spacing:-.06em;
}
.header-actions{gap:7px}
.header-actions .smallbtn{
 min-height:39px;height:39px;
 background:linear-gradient(#fffef8,#f5eee3);border:1px solid #cfbd9e;
 border-radius:9px;color:#27221a;box-shadow:0 2px 4px #5c3c1831;
 font-size:11px;font-weight:850;
}
.menu{
 grid-template-columns:1fr 1fr;
 gap:7px;
 margin:7px 0 7px;
}
.menu>button,.online-choice{
 height:43px;min-height:43px;min-width:0;
 border-radius:9px;
}
.menu>button,.online-choice button{
 font-size:clamp(11px,3.2vw,15px);font-weight:850;
}
.menu>button{padding:3px 7px}
.menu #cpuBtn{background:linear-gradient(140deg,#275d46,#16442e);color:#fff;border-color:#16442e}
.menu #cpuBtn:not(.current){background:linear-gradient(#faf8f2,#efe7da);color:#363028;border-color:#c8bda9}
.online-choice{
 display:grid;grid-template-columns:minmax(0,1fr) 49px;
 gap:0;overflow:hidden;
 background:linear-gradient(#fefcf6,#eee5d7);
 border:1px solid #c7bca9;box-shadow:0 2px 6px #49331f23;
}
.menu .online-choice button{
 width:100%;height:100%;min-height:0;border:0;border-radius:0;
 background:transparent;color:#2c281d;margin:0;padding:0 3px;
 box-shadow:none;
}
.menu #matchBtn{font-size:clamp(12px,3.3vw,16px);white-space:nowrap;letter-spacing:0}
.menu #onlineBtn{
 border-left:1px solid #b9ac96;font-size:10px;white-space:normal;
 line-height:1.12;color:#63513a;
}
.menu .online-choice:has(button.current){border-color:#235740;box-shadow:0 0 0 1px #23574066}
.menu .online-choice button.current{background:linear-gradient(#ecf4ea,#d8e8d8);color:#1d543c}
.menu #galleryBtn{
 grid-column:1/-1;height:27px;min-height:27px;
 background:linear-gradient(#fffbf1,#eee3d1);
 font-size:11px;color:#554a37;box-shadow:none;
}
body.ui-in-game #galleryBtn{display:none}
.hint{margin:5px 0 5px;min-height:20px;padding:3px 6px;background:#f8f2e4c2;border:1px solid #d2bc9370;color:#746a56}
.match-alert-bar{grid-template-columns:minmax(0,1fr) 83px;gap:8px;margin:7px 0 7px;height:53px;min-height:53px}
.effect-slot{
 height:53px;min-height:53px;border-radius:9px;
 background:linear-gradient(#fff8e5,#f9eacb);border:1px solid #c49a56;
 box-shadow:inset 0 1px 0 #fff9e8,0 2px 5px #76512b22;
}
.effect-slot .live-effect-normal{color:#6d512b;font-size:14px}
.match-alert-bar .resign{
 color:#fffaf2;background:linear-gradient(145deg,#af3d29,#952d23);
 border:1px solid #852b1f;border-radius:9px;
 box-shadow:inset 0 1px 0 #ffffff27,0 3px 7px #65241b3d;
 font-size:14px;
}
.match-player-name{
 background:transparent;border:0;box-shadow:none;
 font-size:14px;color:#27241e;
 margin:4px 3px 5px;line-height:1.35;
 font-weight:900;
}
.match-player-name small{color:#756f65;font-size:12px;font-weight:700}
.match-player-name.self-name{margin-top:5px;margin-bottom:6px}
.match-player-row{
 grid-template-columns:minmax(0,1fr) 84px;
 gap:8px;min-height:49px;margin-bottom:6px;
}
.match-player-row.self-row{margin-top:7px;margin-bottom:0}
.match-player-row .hands{
 min-height:49px;height:49px;gap:3px;
 padding:3px 8px;
 color:#271c0e;
 border:1px solid #c39053;border-radius:9px;
 background-image:linear-gradient(180deg,#ffe3b422,#8154260c),var(--approved-wood);
 background-size:auto,100% 100%;
 box-shadow:inset 0 1px 0 #ffe7bb90,0 2px 5px #4d2d0f2f;
}
.match-player-row .hand-title{min-width:37px;font-size:12px;color:#33210f;font-weight:900}
.match-player-row .hand-piece{height:40px;min-width:33px}
.match-player-row .hand-piece .piece{height:38px;max-height:38px}
.match-player-row .clock{
 width:84px;height:49px;border-radius:9px;
 border:1px solid #c9b89f;background:linear-gradient(#fffef8,#f9f3e8);
 box-shadow:0 2px 5px #4d301529;
 font-size:26px;font-weight:850;color:#322a20;
}
.match-player-row .clock.turn{color:#1f6849;border-color:#74a28d}
.boardwrap{
 margin:0;padding:5px 5px 6px;
 border:2px solid #9d6939;border-radius:10px;
 background-image:var(--approved-wood);background-size:100% 100%;
 box-shadow:inset 0 1px 0 #ffeccebf,0 4px 11px #623e1f48;
}
.board{
 aspect-ratio:1/1.06;
 background-color:#dfaa70;
 background-image:var(--approved-wood);background-size:100% 100%;
 border:1.25px solid #3d2a19;
 box-shadow:inset 0 1px 0 #ffdea462;
}
.board .square{
 aspect-ratio:auto;
 min-width:0;min-height:0;
 background:transparent;border-right:1px solid #49331bcb;border-bottom:1px solid #49331bcb;
}
.board .square:nth-child(9n){border-right:none}
.board .square:nth-child(n+73){border-bottom:none}
.board .square.selected{background:#9cc38f83!important}
.board .square.last{background:#eac87573!important}
.boardframe{grid-template-columns:minmax(0,1fr) 14px;grid-template-rows:16px minmax(0,auto)}
.file-coords,.rank-coords{
 color:#332417;font-weight:900;
 font-family:"Noto Sans JP","Yu Gothic",sans-serif;
 -webkit-text-stroke:.1px currentColor;
}
.file-coords{height:16px;font-size:12px}
.rank-coords{width:14px;font-size:12px}
.piece{filter:drop-shadow(0 1.15px 1px #51351e65)}
.piece text{
 font-family:"Yuji Boku","Kaisei Tokumin","Yu Mincho",serif;
 font-weight:400;stroke:#20160d;stroke-width:.54px;
 fill:#20160d;paint-order:stroke fill;
}
.piece .promoted-text{fill:#b11c21;stroke:#9b2420;stroke-width:.37px}
.footnote{font-size:9px;padding:7px 0 8px;color:#847966}
@media(max-width:390px){
 .shell{padding-left:8px;padding-right:8px}
 .menu{gap:5px}
 .match-alert-bar{height:50px;min-height:50px;grid-template-columns:minmax(0,1fr) 76px;gap:6px}
 .effect-slot{height:50px;min-height:50px}
 .match-player-row{grid-template-columns:minmax(0,1fr) 78px;gap:6px}
 .match-player-row .clock{width:78px;font-size:24px}
 .boardframe{grid-template-columns:minmax(0,1fr) 13px}
 .rank-coords{width:13px}
}
@media(max-height:760px){
 .boardwrap{width:min(100%,max(258px,calc(94dvh - 286px)));margin-left:auto;margin-right:auto}
 .test-switch{max-height:145px;overflow-y:auto}
}



/* All header controls use matching Gothic typography and button dimensions.
   During formation setup, the New Game button is hidden, leaving three buttons
   on ONE row. The rare-event label is the only explicitly two-line control. */
.header-actions{
 grid-template-columns:repeat(4,minmax(0,1fr));
 flex:0 1 clamp(194px,55vw,282px);
 gap:5px;
}
body.setup-before-play .header-actions{
 grid-template-columns:repeat(3,minmax(0,1fr));
 flex:0 1 clamp(188px,54vw,252px);
}
.header-actions .smallbtn{
 min-width:0;
 width:100%;
 font-family:"Noto Sans JP","Yu Gothic","Hiragino Kaku Gothic ProN",Meiryo,sans-serif;
 font-size:clamp(10px,2.8vw,12px);
 line-height:1.2;
 font-weight:800;
 overflow-wrap:normal;
 word-break:keep-all;
 white-space:nowrap;
}
#luckBtn .header-double-label{display:block;line-height:1.2}
#luckBtn .header-double-label span{display:block;white-space:nowrap}
/* Keep the pre-existing New Game label intact outside the setup view. */
#newBtn .new-btn-label{display:inline-block;max-width:100%;line-height:1.2;text-align:center;white-space:normal}
#newBtn .new-btn-part{display:inline-block;white-space:nowrap}
@media(max-width:390px){
 .header-actions{flex-basis:clamp(194px,55vw,216px);gap:4px}
 body.setup-before-play .header-actions{flex-basis:clamp(188px,54vw,211px)}
 body:not(.setup-before-play) .header-actions .smallbtn{font-size:9px}
}
@media(max-width:340px){
 header{flex-wrap:wrap}
 .header-actions,body.setup-before-play .header-actions{margin-left:auto}
}
