/* 六牌麻雀 — 麻雀卓風スタイル */
:root {
  --felt: #2f5a43;
  --felt-dark: #23463a;
  --paper: #f3e7cf;
  --ink: #3b2a1a;
  --gold: #c9a45a;
  --red: #b23a2b;
  --sou: #1f6b3a;
  --pin: #2b4f8f;
  --wind: #3b2a1a;
  --tile-w: 44px;
  --tile-h: 60px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(ellipse at center, var(--felt) 0%, var(--felt-dark) 100%);
  color: var(--paper);
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", sans-serif;
}

/* ---------- ヘッダー ---------- */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 16px;
  background: rgba(0, 0, 0, .25);
  flex-wrap: wrap;
}
.top__back { color: var(--gold); text-decoration: none; font-size: 14px; }
.top__title { margin: 0; font-size: 20px; letter-spacing: .1em; }
.top__title small { font-size: 12px; opacity: .8; margin-left: 4px; }
.top__btns { display: flex; gap: 6px; }

.rules {
  max-width: 820px;
  margin: 12px auto 0;
  padding: 12px 20px;
  background: var(--paper);
  color: var(--ink);
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.7;
}
.rules h2 { margin: 0 0 4px; font-size: 16px; }
.rules ul { margin: 0; padding-left: 1.2em; }

/* ---------- 卓 ---------- */
.table {
  max-width: 860px;
  margin: 0 auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.side { display: flex; flex-direction: column; align-items: center; gap: 8px; }

.nameplate {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 14px;
  background: rgba(0, 0, 0, .3);
  border-radius: 999px;
  font-size: 14px;
}
.nameplate__name { font-weight: bold; }
.nameplate__points { font-variant-numeric: tabular-nums; color: var(--gold); font-weight: bold; }
.badge { font-size: 11px; padding: 1px 8px; border-radius: 4px; font-weight: bold; }
.badge--dealer { background: var(--red); color: #fff; }
.badge--riichi { background: var(--gold); color: var(--ink); }

.center {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 8px;
  border: 1px solid rgba(201, 164, 90, .5);
  border-radius: 8px;
  background: rgba(0, 0, 0, .2);
  font-size: 14px;
}
.center__round { font-weight: bold; color: var(--gold); }
.center__wall { font-variant-numeric: tabular-nums; }

.river {
  display: grid;
  grid-template-columns: repeat(10, auto);
  gap: 2px;
  min-height: 40px;
  justify-content: center;
}
.nuki { display: flex; align-items: center; gap: 6px; font-size: 12px; opacity: .95; flex-wrap: wrap; justify-content: center; }
.nuki b { color: var(--gold); font-size: 14px; }
.nuki__tiles { display: flex; flex-wrap: wrap; gap: 1px; }

.hand { display: flex; gap: 2px; flex-wrap: wrap; justify-content: center; }
.wait { margin: 0; min-height: 1.2em; font-size: 13px; color: var(--gold); }
.message { margin: 0; min-height: 1.3em; font-size: 14px; }
.actions { display: flex; gap: 8px; min-height: 40px; }

/* ---------- 牌 ---------- */
.tile {
  width: var(--tile-w);
  height: var(--tile-h);
  border-radius: 5px;
  background: linear-gradient(#fffdf6, #efe6d0);
  border: 1px solid #b9ab8c;
  box-shadow: 0 3px 0 #c9b88e, 0 4px 4px rgba(0, 0, 0, .35);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
  user-select: none;
  flex-shrink: 0;
}
.tile__num { font-size: 20px; font-weight: bold; color: var(--ink); }
.tile__suit { font-size: 15px; color: var(--sou); margin-top: 3px; font-weight: bold; }
.tile__honor { font-size: 26px; font-weight: bold; }
.tile--man .tile__suit { color: var(--red); }
.tile--pin .tile__suit { color: var(--pin); }
.tile--red .tile__honor { color: var(--red); }
.tile--wind .tile__honor { color: var(--wind); }
.tile--hatsu .tile__honor { color: var(--sou); }
.tile--haku .tile__honor {
  width: 60%; height: 70%;
  border: 2px solid #5a7fb5;
  border-radius: 3px;
}
.tile--back {
  background: linear-gradient(#e3a34a, #c27b25);
  border-color: #9c5f17;
  box-shadow: 0 3px 0 #f5ead2, 0 4px 4px rgba(0, 0, 0, .35);
}
.tile--small { --tile-w: 28px; --tile-h: 38px; }
.tile--small .tile__num { font-size: 13px; }
.tile--small .tile__suit { font-size: 10px; margin-top: 1px; }
.tile--small .tile__honor { font-size: 17px; }
.tile--side { transform: rotate(90deg); margin: 0 5px; }
.tile--drawn { margin-left: 10px; }
.tile--win { outline: 3px solid var(--red); outline-offset: 1px; }

.tile--clickable { cursor: pointer; transition: transform .1s; }
.tile--clickable:hover { transform: translateY(-8px); }
.tile--ok { outline: 3px solid var(--gold); }
.tile--ng { opacity: .45; cursor: not-allowed; }
.tile--ng:hover { transform: none; }

/* ---------- ボタン ---------- */
.btn {
  font: inherit;
  font-size: 15px;
  font-weight: bold;
  padding: 8px 18px;
  border-radius: 6px;
  border: 2px solid var(--gold);
  background: var(--gold);
  color: var(--ink);
  cursor: pointer;
}
.btn:hover { filter: brightness(1.08); }
.btn.is-active { background: var(--paper); }
.btn--win { background: var(--red); border-color: var(--red); color: #fff; }
.btn--ghost { background: transparent; color: var(--gold); padding: 5px 12px; font-size: 13px; }
.btn[hidden] { display: none; }

/* ---------- ログ ---------- */
.logbox { max-width: 860px; margin: 0 auto 20px; padding: 0 12px; font-size: 13px; }
.logbox summary { cursor: pointer; color: var(--gold); }
.logbox ul { margin: 6px 0; padding-left: 1.2em; max-height: 200px; overflow: auto; opacity: .9; }

/* ---------- 結果 ---------- */
.result {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, .55);
  display: flex; align-items: center; justify-content: center;
  padding: 12px;
  z-index: 10;
}
.result[hidden] { display: none; }
.result__card {
  background: var(--paper);
  color: var(--ink);
  border-radius: 10px;
  border: 3px double var(--gold);
  padding: 18px 22px;
  width: min(560px, 100%);
  max-height: 90vh;
  overflow: auto;
  text-align: center;
}
.result__title { margin: 0 0 12px; font-size: 22px; color: var(--red); }
.result__hand { display: flex; gap: 2px; justify-content: center; align-items: center; flex-wrap: wrap; margin: 8px 0; }
.result__who { font-size: 12px; margin-right: 6px; font-weight: bold; }
.result__yaku { list-style: none; padding: 0; margin: 10px auto; max-width: 300px; }
.result__yaku li { display: flex; justify-content: space-between; border-bottom: 1px dotted #b9ab8c; padding: 3px 0; }
.result__score { font-size: 18px; font-weight: bold; margin: 10px 0; }
.result__line { margin: 4px 0; font-size: 14px; }

@media (max-width: 600px) {
  :root { --tile-w: 25px; --tile-h: 36px; }
  .tile__num { font-size: 13px; }
  .tile__suit { font-size: 10px; margin-top: 1px; }
  .tile__honor { font-size: 16px; }
  .tile--small { --tile-w: 20px; --tile-h: 28px; }
  .tile--small .tile__num { font-size: 10px; }
  .tile--small .tile__suit { font-size: 8px; }
  .tile--small .tile__honor { font-size: 12px; }
  .tile--drawn { margin-left: 5px; }
  .river { grid-template-columns: repeat(10, auto); }
  .hand { flex-wrap: nowrap; }
}
