:root{
  --board-bg:#0d6b3f;
  --board-line:#0a5533;
  --cell-hover:#12824d;
  --panel-bg:#1b1f1c;
  --accent:#2e9e63;
}
*{box-sizing:border-box;}
html,body{
  height:100%;
}
body{
  margin:0;
  min-height:100vh;
  min-height:100dvh;
  display:flex;
  align-items:center;
  justify-content:center;
  background:linear-gradient(160deg,#10231a,#0a1510);
  font-family:"Hiragino Sans","Yu Gothic",system-ui,-apple-system,sans-serif;
  color:#eef5ef;
  padding:8px;
  padding-top:max(8px, env(safe-area-inset-top));
}
.app{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:8px;
  max-width:560px;
  width:100%;
}

.topbar{
  width:100%;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
}
.match-info{
  font-weight:700;
  font-size:.95rem;
  letter-spacing:.03em;
}

select, button{
  font-size:.9rem;
  padding:6px 12px;
  border-radius:8px;
  border:1px solid #3a453d;
  background:#232922;
  color:#eef5ef;
  cursor:pointer;
}
button.primary{
  background:var(--accent);
  border-color:var(--accent);
  font-weight:600;
}
button.ghost-btn{
  background:transparent;
  padding:5px 10px;
  font-size:.8rem;
  opacity:.85;
}
button:hover{filter:brightness(1.1);}
button:disabled{opacity:.5;cursor:default;}

.status-bar{
  width:100%;
  display:flex;
  justify-content:space-between;
  align-items:center;
  font-size:.85rem;
}
#statusText{font-weight:600;min-height:1.3em;}
.scores{display:flex;gap:12px;font-variant-numeric:tabular-nums;}
.score-chip{
  display:flex;align-items:center;gap:6px;
  background:#20261f;padding:3px 9px;border-radius:20px;
}
.dot{width:12px;height:12px;border-radius:50%;display:inline-block;}
.dot.black{background:radial-gradient(circle at 35% 30%,#555,#000);}
.dot.white{background:radial-gradient(circle at 35% 30%,#fff,#c9c9c9);border:1px solid #999;}

.board-wrap{
  position:relative;
  width:min(92vw, 68dvh, 480px);
  height:min(92vw, 68dvh, 480px);
}

#board{
  display:grid;
  grid-template-columns:repeat(8,1fr);
  grid-template-rows:repeat(8,1fr);
  width:100%;
  height:100%;
  background:var(--board-line);
  border:4px solid var(--board-line);
  border-radius:6px;
  overflow:hidden;
  box-shadow:0 10px 30px rgba(0,0,0,.5);
}
.cell{
  background:var(--board-bg);
  border:1px solid var(--board-line);
  position:relative;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:default;
}
.cell.legal{cursor:pointer;}
.cell.legal:hover{background:var(--cell-hover);}
.hint{
  width:20%;height:20%;
  border-radius:50%;
  background:rgba(255,255,255,.35);
  pointer-events:none;
}
.disc{
  width:82%;height:82%;
  border-radius:50%;
  box-shadow:0 3px 5px rgba(0,0,0,.4);
  transform:scale(0);
  animation:pop .22s ease forwards;
}
@keyframes pop{ to{ transform:scale(1); } }
.disc.black{background:radial-gradient(circle at 32% 28%,#5a5a5a,#050505 70%);}
.disc.white{background:radial-gradient(circle at 32% 28%,#ffffff,#c7c7c7 70%);}
.disc.flipping{animation:flipDisc .3s ease forwards;}
@keyframes flipDisc{
  0%{transform:scale(1) scaleX(1);}
  50%{transform:scale(1) scaleX(0);}
  100%{transform:scale(1) scaleX(1);}
}

.overlay{
  position:absolute;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:2.6rem;
  font-weight:800;
  letter-spacing:.06em;
  color:#fff;
  text-shadow:0 4px 20px rgba(0,0,0,.7);
  background:rgba(0,0,0,0);
  border-radius:6px;
  opacity:0;
  pointer-events:none;
  transition:opacity .25s ease, background .25s ease;
  z-index:10;
  text-align:center;
  padding:0 10px;
}
.overlay.show{
  opacity:1;
  background:rgba(0,0,0,.5);
}
.overlay.win{ color:#4ade80; }
.overlay.lose{ color:#f87171; }
.overlay.draw{ color:#e5e7eb; }
.overlay.pass{ color:#fde047; font-size:2.1rem; }

/* 対局開始前(または設定変更時)の設定モーダル */
.setup-overlay{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.65);
  display:flex;
  align-items:center;
  justify-content:center;
  padding:16px;
  z-index:100;
  opacity:1;
  transition:opacity .2s ease;
}
.setup-overlay.hidden{
  opacity:0;
  pointer-events:none;
}
.setup-card{
  background:var(--panel-bg);
  border-radius:16px;
  padding:22px 24px;
  width:min(90vw,320px);
  display:flex;
  flex-direction:column;
  gap:14px;
  box-shadow:0 12px 40px rgba(0,0,0,.5);
}
.setup-card h2{
  margin:0;
  font-size:1.1rem;
  letter-spacing:.03em;
}
.setup-card .group{
  display:flex;
  flex-direction:column;
  gap:6px;
  font-size:.85rem;
}
.setup-card .group label{opacity:.75;}
.setup-card select{width:100%;}
.setup-card button.primary{margin-top:4px;padding:9px 12px;}

.footnote{
  font-size:.75rem;
  opacity:.55;
  text-align:center;
  line-height:1.5;
}
