:root {
  color-scheme: dark;
  --line: #2e3c52;
  --bg: #050b16;
  --bg-card: #0f1726;
  --text: #e4ebf8;
  --sub: #a8b4c9;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", "Noto Sans JP", sans-serif;
  background: radial-gradient(900px 500px at 20% -20%, #1f3d64 0%, transparent 60%), var(--bg);
  color: var(--text);
}
.wrap {
  width: min(1180px, 95vw);
  margin: 24px auto 40px;
}
.hero {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
}
.hero img {
  width: 100%;
  height: 260px;
  object-fit: cover;
  filter: brightness(.63);
  display: block;
}
.hero .overlay {
  position: absolute;
  inset: 0;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background: linear-gradient(180deg, rgba(0,0,0,.2), rgba(0,0,0,.7));
}
.badge {
  display: inline-block;
  width: fit-content;
  margin-bottom: 8px;
  padding: 5px 10px;
  border: 1px solid #476182;
  border-radius: 999px;
  font-size: 12px;
}
h1 { margin: 0; font-size: clamp(28px, 4vw, 52px); }
.lead { margin: 6px 0 0; color: #d2deef; }
.about {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(10, 18, 30, .92);
  padding: 14px;
}
.about h2 {
  margin: 0 0 8px;
  font-size: 22px;
}
.about p {
  margin: 0;
  color: #d3dfef;
  line-height: 1.6;
}
.about ul {
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--sub);
  line-height: 1.7;
}
.wallet {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(13, 22, 38, .9);
  padding: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}
.wallet strong { color: #7dd3fc; font-size: 28px; }
.actions { display: flex; gap: 8px; }
.auth-status {
  color: #c7d6ed;
  font-size: 13px;
}
button {
  border: 1px solid #3a4f6d;
  background: #152339;
  color: #e7eefb;
  border-radius: 10px;
  padding: 9px 12px;
  cursor: pointer;
}
button:disabled {
  opacity: .55;
  cursor: not-allowed;
}
button:hover { filter: brightness(1.1); }
.status { min-height: 22px; margin: 10px 0; color: #8bd3a0; }
.status.err { color: #fca5a5; }
.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-card);
  padding: 12px;
}
.card h3 { margin: 0 0 6px; }
.card p { margin: 0 0 8px; color: var(--sub); font-size: 14px; }
.cost { color: #67e8f9; font-size: 13px; margin-bottom: 8px; }
.play {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(10, 18, 30, .92);
  padding: 12px;
}
.play-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}
.play-head h2 { margin: 0; font-size: 22px; }
.game { display: none; margin-top: 10px; }
.game.active { display: block; }
.note { color: var(--sub); margin-bottom: 8px; }
.othello {
  width: min(560px, 100%);
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  border: 2px solid #355070;
}
.othello button {
  aspect-ratio: 1/1;
  border: 1px solid #486789;
  background: #16543b;
  border-radius: 0;
  display: grid;
  place-items: center;
  padding: 0;
}
.othello button.hint { background: #1f6b4c; }
.disk {
  width: 76%;
  height: 76%;
  border-radius: 999px;
}
.disk.b { background: #0b111c; }
.disk.w { background: #eef4ff; }
.shogi {
  width: min(500px, 100%);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  border: 2px solid #8c6c3d;
}
.shogi button {
  aspect-ratio: 1/1;
  border: 1px solid #94784c;
  border-radius: 0;
  background: #ddbf88;
  color: #23170c;
  font-weight: 700;
  font-size: clamp(12px, 2.1vw, 18px);
}
.shogi button.sel { background: #f6dc9f; }
.shogi button.legal { background: #d8f5aa; }
.p2 { color: #8b1d1d; transform: rotate(180deg); display: inline-block; }
.c4-controls {
  width: min(620px, 100%);
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 6px;
}
.c4-board {
  width: min(620px, 100%);
  background: #1d4ed8;
  border: 2px solid #1e3a8a;
  border-radius: 10px;
  padding: 8px;
  display: grid;
  gap: 6px;
}
.c4-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.c4-cell {
  aspect-ratio: 1/1;
  border-radius: 999px;
  background: #e2e8f0;
}
.c4-cell.p1 { background: #fb923c; }
.c4-cell.p2 { background: #facc15; }
.legal-nav {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(10, 18, 30, .92);
  padding: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.legal-nav a {
  color: #8fd7ff;
  text-decoration: none;
  border: 1px solid #3a4f6d;
  border-radius: 8px;
  padding: 7px 10px;
  background: #13233a;
}
.legal-nav a:hover {
  filter: brightness(1.1);
}

/* legal pages */
.legal-wrap {
  width: min(980px, 95vw);
  margin: 24px auto 48px;
}
.legal-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(10, 18, 30, .94);
  padding: 16px;
}
.legal-card h1 {
  margin: 0 0 12px;
  font-size: clamp(24px, 4vw, 36px);
}
.legal-card h2 {
  margin: 20px 0 8px;
  font-size: 18px;
}
.legal-card p,
.legal-card li {
  color: #d3dfef;
  line-height: 1.7;
}
.legal-card ul {
  margin: 8px 0;
  padding-left: 18px;
}
.legal-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
}
.legal-table th,
.legal-table td {
  border: 1px solid #3a4f6d;
  padding: 10px;
  vertical-align: top;
}
.legal-table th {
  width: 30%;
  text-align: left;
  color: #8fd7ff;
  background: #112038;
}
.back-link {
  display: inline-block;
  margin-top: 14px;
  color: #8fd7ff;
  text-decoration: none;
}
.back-link:hover { text-decoration: underline; }
@media (max-width: 900px) {
  .cards { grid-template-columns: 1fr; }
}
