/* 共通の土台。寸法は rem（index.html の head で、窓に合わせて 1rem の大きさを決めている）。 */
:root {
  --ink: #f3e7cf;
  --ink-dim: #b9a583;
  --gold: #d9b45a;
  --gold-deep: #8a6a2a;
  --panel: rgba(24, 13, 8, 0.86);
  --line: rgba(217, 180, 90, 0.45);
  --danger: #e2634f;
  --serif: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", serif;
  --sans: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Noto Sans JP", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden; background: #000; }
body { color: var(--ink); font-family: var(--sans); font-size: 0.7rem; -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none; user-select: none; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* 画面の切り替え＝.active が付いた1枚だけを見せる */
.screen { position: fixed; inset: 0; display: none; overflow: hidden; }
.screen.active { display: block; }

/* ボタン */
.btn { padding: 0.4rem 0.9rem; border-radius: 0.3rem; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.06);
  color: var(--ink); font-weight: 700; font-size: 0.66rem; cursor: pointer; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn-primary { border-color: var(--gold); color: #24140a;
  background: linear-gradient(180deg, #f0d48a, #c9a046); }
.btn-small { padding: 0.25rem 0.5rem; font-size: 0.56rem; }
/* Googleでログイン＝これまでのアプリ（何切る？SNS）のボタンと同じ見た目 */
.btn-google { border: none; color: #fff; background: linear-gradient(135deg, #3498db, #8e44ad); }

/* モーダル */
.modal-backdrop { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.62); animation: fade-in 0.15s ease; }
.modal { width: 20rem; max-width: calc(100vw - 2rem); max-height: calc(100vh - 1.5rem); overflow: auto;
  padding: 0.9rem 1rem; border-radius: 0.5rem; background: #24140c; border: 1px solid var(--gold);
  box-shadow: 0 0.6rem 2rem rgba(0, 0, 0, 0.7); }
.modal-wide { width: 30rem; }
.modal h2 { margin: 0 0 0.5rem; font-family: var(--serif); font-size: 0.9rem; color: var(--gold); }
.modal p { margin: 0 0 0.6rem; line-height: 1.6; }
.modal .modal-actions { display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 0.8rem; }
.modal .modal-error { color: var(--danger); min-height: 1em; margin: 0.3rem 0 0; font-size: 0.6rem; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* 入力欄 */
.field { display: block; margin-bottom: 0.5rem; }
.field > span { display: block; margin-bottom: 0.15rem; color: var(--ink-dim); font-size: 0.58rem; }
.field input, .field select { width: 100%; padding: 0.35rem 0.45rem; border-radius: 0.25rem; border: 1px solid var(--line);
  background: #150b06; color: var(--ink); font: inherit; font-size: 16px; /* 16px 未満だと iOS が拡大する */
  -webkit-user-select: text; user-select: text; }
.field .hint { margin-top: 0.15rem; color: var(--ink-dim); font-size: 0.55rem; }

/* 回転案内オーバーレイ＝jangrid のものをそのまま使う */
#coer-rotate { position: fixed; inset: 0; z-index: 30; display: none;
  background: #0f331f; color: #dfe8e2; font-family: sans-serif;
  flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; }
#coer-rotate.show { display: flex; }
#coer-rotate .icon { font-size: 64px; line-height: 1; margin-bottom: 20px; animation: coer-rot 1.6s ease-in-out infinite; }
#coer-rotate .ja { font-size: 22px; font-weight: bold; margin-bottom: 8px; }
#coer-rotate .en { font-size: 16px; color: #9fb3a6; }
@keyframes coer-rot { 0%,40% { transform: rotate(0deg); } 60%,100% { transform: rotate(90deg); } }

/* 対局（JANGRID を入れる枠）＝jangrid のテンプレートと同じ指定 */
#unity-container { position: fixed; inset: 0; width: 100%; height: 100%; background: #000; }
#unity-canvas { position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: block; background: #0f331f; }

/* 対局の仮の表示（JANGRID を入れるまで） */
.play-placeholder { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 0.5rem; text-align: center; background: radial-gradient(ellipse at 50% 40%, #1f5c3d, #0b2417 70%);
  animation: fade-in 0.6s ease; }
.play-placeholder h2 { margin: 0; font-family: var(--serif); font-size: 1.3rem; color: var(--gold); }
.play-placeholder .prep-label { margin: 0; letter-spacing: 0.3em; color: var(--ink-dim); }
.play-note { margin: 0 0 0.6rem; max-width: 26rem; line-height: 1.7; color: var(--ink-dim); font-size: 0.6rem; }
/* 対局の画面（Unity の Web 版）を開く枠 */
.play-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #0f331f; }

/* 対局が終わったときの帯（jangrid の結果の画面の上） */
.play-ended { position: absolute; z-index: 3; left: 50%; top: calc(0.5rem + env(safe-area-inset-top)); transform: translateX(-50%);
  display: flex; align-items: center; gap: 0.6rem; max-width: calc(100% - 1rem); padding: 0.35rem 0.5rem 0.35rem 0.8rem;
  border-radius: 0.5rem; background: var(--panel); border: 1px solid var(--gold); font-size: 0.6rem; font-weight: 700;
  box-shadow: 0 0.3rem 1.2rem rgba(0, 0, 0, 0.6); animation: fade-in 0.3s ease; }
.play-ended .btn { flex: none; }
