html, body { margin: 0; padding: 0; background: #f5f1e6; font-family: "Yu Gothic", "Hiragino Sans", sans-serif; }
/* 指のスクロールはふつうに効くようにする (2026-11-14 まで body 全体に touch-action: none があり、編集画面がスクロールできなかった)。止めるのは対局の画面だけ */
body { display: flex; flex-direction: column; align-items: center; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
#game { touch-action: none; }
#ui { width: 100%; text-align: center; padding: 4px 0; }
/* 文の欄はいつも 2 行ぶんの高さ (中身の長さで盤が動かないように)。1 行目 = 状況、2 行目 = 補足 */
#status { font-size: 16px; font-weight: bold; line-height: 21px; height: 42px; overflow: hidden; white-space: pre-line; padding: 0 6px; }
#status.over { color: #c02020; }
#controls { margin-top: 4px; }
button { font-size: 16px; padding: 6px 14px; margin: 0 3px; border: 1px solid #6b4a1c; border-radius: 0; background: #fff; cursor: pointer; }
button:hover:not(:disabled) { background: #fbf1d8; }
.corner { position: fixed; z-index: 5; display: flex; gap: 6px; }
.corner button { margin: 0; }
#actButtons { position: absolute; top: 8px; left: 8px; flex-direction: column; align-items: stretch; gap: 4px; }
#actButtons button { font-size: 20px; padding: 18px 12px; font-weight: bold; display: flex; justify-content: space-between; gap: 8px; }
#actButtons button .cost { font-weight: bold; }
#actButtons button .cost.plus { color: #1a8a1a; }
#actButtons button .cost.minus { color: #c03020; }
#sysButtons { top: 8px; left: 8px; }
/* 縦長の画面 (スマホ): パス・スキルは盤の下に横並び。ホームは左上なので、状態の文はその下から */
#actButtons.row { flex-direction: row; }
#actButtons.row button { flex: 1; padding: 12px 10px; font-size: 18px; justify-content: center; }
body.portrait #ui { padding-top: 46px; }
body.portrait #status { font-size: 14px; line-height: 19px; height: 38px; }
body.portrait #timer { font-size: 15px; height: 20px; line-height: 20px; }
body.portrait #timer.warn { font-size: 17px; }
body.portrait #sysButtons button { padding: 6px 12px; font-size: 15px; }
button.on { background: #f0c040; font-weight: bold; }
button:disabled { opacity: 0.4; }
#promo { display: none; position: absolute; z-index: 10; padding: 4px; background: rgba(255,250,235,0.95); border: 2px solid #6b4a1c; border-radius: 0; box-shadow: 0 2px 8px rgba(0,0,0,0.3); white-space: nowrap; }
#promo button { margin: 0 2px; font-weight: bold; }
#btnPromo { background: #f6d0c8; color: #b01010; }
#board { touch-action: none; display: block; }
/* パスの知らせ: 盤の真ん中に大きく出て、すっと消える */
#passBanner { position: absolute; z-index: 6; transform: translate(-50%, -50%); pointer-events: none; opacity: 0; font-size: 44px; font-weight: bold; color: #fff; background: rgba(40, 40, 50, 0.85); padding: 10px 28px; border: 3px solid #1a8a1a; white-space: nowrap; }
#passBanner.show { animation: passPop 1.1s ease-out; }
@keyframes passPop { 0% { opacity: 0; transform: translate(-50%, -50%) scale(0.6); } 15% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); } 70% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1); } }
.screen { display: none; flex-direction: column; align-items: center; width: 100%; }
#home .homeTop { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 90vh; gap: 18px; }
/* ホームの下のルール (ボタンの画面より下。スクロールした人だけが読む) */
#rules { max-width: 720px; padding: 0 16px 40px; box-sizing: border-box; color: #333; font-size: 15px; line-height: 1.7; user-select: text; -webkit-user-select: text; }
#rules h2 { color: #5a3d17; border-bottom: 2px solid #d9b77a; padding-bottom: 4px; }
#rules h3 { color: #5a3d17; margin: 20px 0 4px; }
#rules ul { padding-left: 1.3em; margin: 4px 0; }
#rules table { border-collapse: collapse; background: #fffaf0; }
#rules th, #rules td { border: 1px solid #c9a96b; padding: 3px 10px; }
#rules .note { color: #777; font-size: 13px; }
#home h1 { font-size: 44px; margin: 0 0 20px; color: #5a3d17; letter-spacing: 4px; }
button.big { font-size: 24px; padding: 14px 0; width: 240px; border-width: 2px; }
#edit h2 { margin: 12px 0 6px; }
#edit .hint { margin: 6px 0; color: #555; font-size: 14px; }
#editTabs button { width: 90px; }
#pieceTable { border-collapse: collapse; background: #fffaf0; }
#pieceTable th, #pieceTable td { border: 1px solid #c9a96b; padding: 4px 10px; text-align: center; font-size: 16px; }
#pieceTable td.name { font-weight: bold; font-size: 20px; }
#pieceTable .val { display: inline-block; min-width: 36px; font-weight: bold; }
#pieceTable .minus { color: #2f6fd0; }
#pieceTable .plus { color: #c03020; }
#pieceTable button { padding: 2px 10px; }
#skillList { display: flex; flex-direction: column; gap: 6px; width: 340px; }
label.skill { display: block; border: 1px solid #c9a96b; border-radius: 0; padding: 6px 10px; background: #fffaf0; cursor: pointer; }
label.skill.on { background: #f8e3a8; border-color: #6b4a1c; }
label.skill span { font-size: 13px; color: #555; }
#edit .row { margin: 14px 0; }
#opponent, #cpuSelect, #settings { justify-content: center; min-height: 90vh; gap: 12px; }
#opponent h2, #cpuSelect h2, #settings h2 { margin: 0 0 10px; color: #5a3d17; }
button.opp, #oppRated, #oppCpu, #oppFriends, #goEdit { display: flex; flex-direction: column; align-items: center; gap: 2px; }
button.opp span, #oppRated span, #oppCpu span, #oppFriends span, #goEdit span { font-size: 13px; color: #6b5a3a; font-weight: normal; }
/* ランキングと編集: 対戦のボタンの下に線を引いて、横に 2 つ並べる */
#opponent .oppTools { display: flex; gap: 8px; width: 240px; padding-top: 12px; margin-top: 4px; border-top: 1px solid #c9a96b; }
#opponent .oppTools button { flex: 1; margin: 0; font-size: 17px; padding: 6px 0; display: flex; flex-direction: column; align-items: center; gap: 2px; }
#opponent .oppTools button span { font-size: 12px; color: #6b5a3a; }
#oppBack { margin-top: 6px; }
.setRow { display: flex; align-items: center; gap: 20px; font-size: 20px; margin-bottom: 10px; }
.setRow span { width: 70px; text-align: right; } /* 項目名の幅をそろえて、ボタンの位置をそろえる */
.setRow button { width: 110px; font-size: 18px; }
#timer { font-size: 18px; font-weight: bold; height: 24px; line-height: 24px; color: #3a3a3a; }
#timer.warn { color: #d02020; font-size: 22px; }
#pieceTable canvas.koma { width: 44px; height: 44px; display: block; margin: 0 auto; }
#pieceTable .look { font-size: 12px; color: #6b5a3a; }
#pieceTable td.val { display: table-cell; }
#pieceTable .look { display: block; }
/* オンライン対戦 */
#online { justify-content: center; min-height: 90vh; gap: 12px; }
#online h2 { margin: 0 0 10px; color: #5a3d17; }
#onMenu, #onWait { display: flex; flex-direction: column; align-items: center; gap: 14px; }
#onJoinRow { display: flex; gap: 8px; align-items: center; }
#onCode { font-size: 24px; width: 170px; padding: 8px; border: 2px solid #6b4a1c; border-radius: 0; text-align: center; letter-spacing: 4px; user-select: text; -webkit-user-select: text; background: #fff; }
#onCodeBig { font-size: 72px; font-weight: bold; letter-spacing: 12px; color: #5a3d17; padding-left: 12px; }
#onWait { font-size: 18px; }
#onInfo { font-size: 18px; min-height: 24px; }
#onOpp { font-size: 18px; font-weight: bold; color: #5a3d17; max-width: 420px; text-align: center; }
#onError { font-size: 16px; color: #c02020; font-weight: bold; min-height: 22px; max-width: 420px; text-align: center; }
#online .row { display: flex; gap: 8px; }

/* コインとレーティング戦の待ち */
.coins { font-size: 20px; font-weight: bold; color: #8a5a00; margin-bottom: 4px; }
.coins b { font-size: 24px; }
button.small { font-size: 15px; padding: 6px 14px; width: 240px; margin-top: 6px; }
#onQueue { display: flex; flex-direction: column; align-items: center; gap: 12px; font-size: 18px; }
#editHint { max-width: 420px; text-align: center; }
#skillList .skillBuy { display: flex; align-items: center; justify-content: space-between; gap: 8px; border: 1px dashed #c9a96b; padding: 6px 10px; background: #f3ede0; }
#skillList .skillBuy span { font-size: 13px; color: #555; display: block; }
#skillList .skillBuy button.confirm, #editReset.confirm { background: #f6d0c8; font-weight: bold; }

/* アカウント・保存・設定のコード */
#account { justify-content: center; min-height: 90vh; gap: 12px; }
#account h2 { margin: 0 0 6px; color: #5a3d17; }
#account .hint { margin: 2px 0; color: #555; font-size: 14px; max-width: 420px; text-align: center; }
#accName { font-size: 22px; width: 220px; padding: 8px; border: 2px solid #6b4a1c; border-radius: 0; text-align: center; background: #fff; user-select: text; -webkit-user-select: text; }
.setImportRow { display: flex; gap: 6px; align-items: center; }
.setImportRow input, #setCode { font-size: 14px; width: 300px; padding: 6px; border: 1px solid #6b4a1c; border-radius: 0; background: #fff; user-select: text; -webkit-user-select: text; }
#accError, #setImportMsg, #setCodeMsg { font-size: 15px; color: #c02020; font-weight: bold; min-height: 20px; max-width: 420px; text-align: center; }
#setCodeMsg { color: #2a6a2a; }
#setCodeRow { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-bottom: 8px; }
#setCodeRow .warn { font-size: 14px; color: #c02020; font-weight: bold; }
.setRow .accName { width: auto; text-align: left; font-weight: bold; }
.setRow #setShowCode { width: auto; font-size: 16px; }
#editStatus { min-height: 20px; font-size: 15px; color: #c02020; font-weight: bold; max-width: 420px; text-align: center; margin-bottom: 4px; }
#editSave.confirm { background: #f6d0c8; font-weight: bold; }
.coins .who { font-size: 16px; color: #5a3d17; margin-left: 10px; }
/* バトルの画面の上: 名前とコイン・レートのカード */
#oppCoins.card { width: 240px; max-width: 92vw; box-sizing: border-box; border: 2px solid #6b4a1c; background: #fffaf0; padding: 8px 10px; margin-bottom: 4px; }
#oppCoins .who { font-size: 16px; font-weight: bold; color: #5a3d17; text-align: center; overflow-wrap: anywhere; margin-bottom: 6px; }
#oppCoins .stats { display: flex; gap: 8px; }
#oppCoins .stat { flex: 1; display: flex; flex-direction: column; align-items: center; background: #f5ecd6; padding: 4px 0; }
#oppCoins .stat span { font-size: 12px; color: #6b5a3a; }
#oppCoins .stat b { font-size: 26px; color: #8a5a00; line-height: 1.1; }
#oppCoins .stat.rate b { color: #2a4a8a; }
.coins .rate { font-size: 16px; color: #2a4a8a; margin-left: 10px; }
.coins .rate b { font-size: 20px; }

/* ランキング (スマホの幅 390px に収める。長い名前は ... で切る。指でスクロールできる) */
#ranking { justify-content: flex-start; padding: 16px 0 28px; gap: 10px; }
#ranking h2 { margin: 0; color: #5a3d17; }
#rankBody { width: 360px; max-width: 94vw; box-sizing: border-box; }
#rankBody .msg { text-align: center; font-size: 16px; color: #555; padding: 24px 6px; }
#rankBody .msg.err { color: #c02020; font-weight: bold; }
#rankBody .rk { display: grid; grid-template-columns: 34px minmax(0, 1fr) 76px 40px; align-items: center; gap: 6px; padding: 6px 8px; border-bottom: 1px solid #e0d3b0; font-size: 15px; background: #fffaf0; }
#rankBody .rk.head { font-size: 12px; color: #6b5a3a; background: transparent; padding-top: 0; padding-bottom: 2px; }
#rankBody .rk .n { text-align: center; font-weight: bold; }
#rankBody .rk .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#rankBody .rk .r, #rankBody .rk .g { text-align: right; }
#rankBody .rk .r { font-weight: bold; color: #2a4a8a; }
#rankBody .rk.top1 { background: #fbe39a; font-size: 17px; font-weight: bold; }
#rankBody .rk.top2 { background: #e8e8ee; font-size: 16px; font-weight: bold; }
#rankBody .rk.top3 { background: #f0d2b0; font-size: 16px; font-weight: bold; }
#rankBody .rk.me { background: #cfe6f7; border-left: 4px solid #2a4a8a; }
#rankBody .mine { margin-top: 12px; }
#rankBody .mine .lbl { font-size: 13px; color: #6b5a3a; margin-bottom: 2px; }
#rankBody .mine .need { text-align: center; font-size: 14px; color: #555; padding: 6px; }
#ranking .row { display: flex; gap: 8px; margin-top: 6px; }
#ranking .rk .r small { font-size: 10px; color: #8a6d3b; margin-left: 3px; font-weight: normal; }
