/* app.css — 大富翁環遊台灣（スマホ縦持ち前提・フレームワークなし） */
:root {
	--teal: #0f766e; --teal-d: #0b5a54; --sea: #d9f0fb; --sand: #fff8e7; --ink: #1f2933; --mute: #6b7785;
	--line: #e1d9c4; --accent: #f59e0b; --danger: #dc2626; --ok: #16a34a; --card: #ffffff;
	--safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--teal); color: var(--ink);
	font-family: -apple-system, "Hiragino Sans", "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
	overscroll-behavior: none; touch-action: manipulation; -webkit-text-size-adjust: 100%; }
#app { position: fixed; inset: 0; height: 100dvh; background: var(--sand); }
.view { position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--sand); }
[hidden] { display: none !important; }
button, input { font: inherit; color: inherit; }
input[type=text] { font-size: 16px; /* iOS のズーム防止 */ }

/* ---- ボタン ---- */
.btn { border: 0; border-radius: 12px; padding: 10px 16px; background: #fff; border: 1px solid var(--line); font-weight: 600; cursor: pointer; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--teal); color: #fff; border-color: var(--teal); }
.btn.accent { background: var(--accent); color: #3b2a00; border-color: var(--accent); }
.btn.danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.ghost { background: transparent; }
.btn.tiny { padding: 6px 10px; font-size: 14px; }
.btn.big { width: 100%; padding: 14px; font-size: 18px; margin-top: 8px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.err { color: var(--danger); min-height: 1.4em; margin-top: 6px; font-size: 14px; text-align: center; }
.hint { color: var(--mute); font-size: 13px; text-align: center; }

/* ---- 登入 ---- */
#v-login { background: linear-gradient(160deg, #0f766e, #14b8a6 55%, #fde68a); overflow-y: auto; padding: calc(var(--safe-t) + 16px) 16px 24px; }
.login-card { background: #fffdf5; border-radius: 20px; padding: 20px 18px; margin: auto; width: 100%; max-width: 420px; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.login-card h1 { margin: 4px 0 2px; text-align: center; font-size: 26px; color: var(--teal-d); }
.login-card .logo { text-align: center; font-size: 44px; }
.login-card .sub { text-align: center; margin: 0 0 14px; color: var(--mute); font-size: 14px; }
.fld { display: block; margin: 10px 0; font-weight: 600; font-size: 14px; }
.fld input[type=text] { display: block; width: 100%; margin-top: 6px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; margin-top: 8px; }
.emoji-grid button { aspect-ratio: 1; font-size: 22px; border: 2px solid transparent; border-radius: 12px; background: #fff; padding: 0; }
.emoji-grid button.sel { border-color: var(--teal); background: #ccfbf1; }
.upl { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.upl-preview { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; border: 3px solid var(--teal); }

/* ---- トップバー・共通 ---- */
.topbar { display: flex; align-items: center; gap: 8px; padding: calc(var(--safe-t) + 6px) 10px 6px; background: var(--teal); color: #fff; flex: 0 0 auto; }
.topbar .title { flex: 1; text-align: center; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .btn.ghost { color: #fff; border-color: rgba(255,255,255,.5); }
.me { display: flex; align-items: center; gap: 6px; background: rgba(255,255,255,.15); border: 0; color: #fff; border-radius: 20px; padding: 3px 12px 3px 3px; }
.scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 12px; flex: 1; min-height: 0; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 12px; margin-bottom: 12px; }
.card h2, h2.sec { margin: 0 0 8px; font-size: 16px; color: var(--teal-d); }
h2.sec { margin-top: 6px; }
.row { display: flex; gap: 8px; }
.row input { flex: 1; min-width: 0; padding: 10px; border: 1px solid var(--line); border-radius: 12px; }

/* アバター（絵文字 or 画像） */
.av { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; background: #fff; overflow: hidden; font-size: 20px; flex: 0 0 auto; border: 2px solid #fff; }
.av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.av.sm { width: 24px; height: 24px; font-size: 15px; border-width: 1px; }
.av.lg { width: 44px; height: 44px; font-size: 28px; }

/* ---- 牌局一覧 ---- */
.room-item { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 10px 12px; margin-bottom: 10px; }
.room-item .info { flex: 1; min-width: 0; }
.room-item .nm { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-item .meta { color: var(--mute); font-size: 12px; margin-top: 2px; }
.room-item .faces { display: flex; margin-top: 4px; }
.room-item .faces .av { margin-right: -6px; }
.tag { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 10px; background: #e0f2fe; color: #075985; margin-left: 6px; vertical-align: middle; }
.tag.play { background: #fee2e2; color: #991b1b; }
.tag.over { background: #e5e7eb; color: #374151; }

/* ---- 牌局 ---- */
.pane { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.pane.scroll { display: block; }
.tabs { display: flex; flex: 0 0 auto; background: #fff; border-top: 1px solid var(--line); padding-bottom: var(--safe-b); }
.tabs button { flex: 1; border: 0; background: none; padding: 7px 0 6px; font-size: 12px; color: var(--mute); position: relative; }
.tabs button span { display: block; font-size: 20px; line-height: 1.1; }
.tabs button.on { color: var(--teal); font-weight: 700; }
.badge { position: absolute; top: 3px; left: calc(50% + 8px); background: var(--danger); color: #fff; border-radius: 10px; font-size: 11px; font-style: normal; min-width: 18px; padding: 1px 5px; }

.hud-players { display: flex; gap: 6px; overflow-x: auto; padding: 6px 8px; background: #fff7dc; border-bottom: 1px solid var(--line); flex: 0 0 auto; }
.pchip { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; padding: 3px 10px 3px 3px; border-radius: 22px; background: #fff; border: 2px solid var(--line); min-width: 92px; }
.pchip.turn { border-color: var(--accent); background: #fff3c4; box-shadow: 0 0 0 2px rgba(245,158,11,.3); }
.pchip.out { opacity: .4; }
.pchip .nm { font-size: 12px; font-weight: 700; max-width: 70px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pchip .mo { font-size: 12px; color: #92400e; font-variant-numeric: tabular-nums; }
.pchip.off .nm::after { content: " 💤"; }

.stage { position: relative; flex: 1; min-height: 0; background: #bfe3f5; overflow: hidden; }
.stage svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#hud { pointer-events: none; }
.cam-btns { position: absolute; right: 8px; top: 8px; display: flex; flex-direction: column; gap: 6px; }
.btn.cam { padding: 6px 10px; font-size: 13px; background: rgba(255,255,255,.92); box-shadow: 0 2px 6px rgba(0,0,0,.2); }
.mini-chat { position: absolute; left: 8px; bottom: 8px; right: 70px; pointer-events: none; display: flex; flex-direction: column; gap: 3px; }
.mini-chat div { align-self: flex-start; max-width: 100%; background: rgba(15,23,42,.62); color: #fff; font-size: 12px; padding: 3px 9px; border-radius: 12px; transition: opacity .6s; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-chat div.sys { background: rgba(120,80,0,.6); }
.mini-chat div.old { opacity: 0; }

.actions { display: flex; gap: 8px; padding: 8px; background: #fff7dc; border-top: 1px solid var(--line); flex: 0 0 auto; min-height: 58px; align-items: center; justify-content: center; flex-wrap: wrap; }
.actions .btn { flex: 1 1 0; min-width: 96px; padding: 11px 8px; font-size: 16px; }
.actions .btn.roll { font-size: 20px; animation: pulse 1.2s ease-in-out infinite; }
.actions .wait { color: var(--mute); font-size: 14px; text-align: center; }
@keyframes pulse { 50% { transform: scale(1.04); box-shadow: 0 0 0 6px rgba(245,158,11,.25); } }

.quick-chat { display: flex; gap: 6px; padding: 6px 8px; background: #fff; border-top: 1px solid var(--line); flex: 0 0 auto; }
.quick-chat input { flex: 1; min-width: 0; padding: 8px 12px; border: 1px solid var(--line); border-radius: 18px; background: #fafafa; }
.quick-chat .btn { padding: 8px 14px; }

/* ---- チャット ---- */
.chat-list { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 6px; -webkit-overflow-scrolling: touch; }
.msg { display: flex; gap: 8px; align-items: flex-end; max-width: 88%; }
.msg.me { align-self: flex-end; flex-direction: row-reverse; }
.msg .bub { background: #fff; border: 1px solid var(--line); padding: 7px 11px; border-radius: 16px 16px 16px 4px; word-break: break-word; white-space: pre-wrap; }
.msg.me .bub { background: #ccfbf1; border-color: #99f6e4; border-radius: 16px 16px 4px 16px; }
.msg .who { font-size: 11px; color: var(--mute); margin-bottom: 2px; }
.sysmsg { align-self: center; font-size: 12px; color: #92400e; background: #fef3c7; padding: 3px 12px; border-radius: 12px; text-align: center; max-width: 94%; }
.waiting { background: #fff; border-bottom: 1px solid var(--line); padding: 10px 12px; flex: 0 0 auto; }
.waiting h3 { margin: 0 0 8px; font-size: 15px; color: var(--teal-d); }
.mem-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.mem { display: flex; align-items: center; gap: 6px; background: #f0fdfa; border: 1px solid #99f6e4; border-radius: 20px; padding: 3px 12px 3px 3px; font-size: 14px; }
.mem.off { opacity: .5; }
.mem .host { font-size: 11px; color: #b45309; }

/* ---- 資産 ---- */
.cashbig { text-align: center; padding: 14px; background: linear-gradient(135deg, #0f766e, #14b8a6); color: #fff; border-radius: 18px; margin-bottom: 12px; }
.cashbig .lbl { font-size: 13px; opacity: .85; }
.cashbig .amt { font-size: 34px; font-weight: 800; font-variant-numeric: tabular-nums; }
.cashbig .sub2 { font-size: 13px; opacity: .9; margin-top: 2px; }
.prop { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--line); border-left-width: 8px; border-radius: 12px; padding: 8px 10px; margin-bottom: 8px; }
.prop .nm { font-weight: 700; }
.prop .sub { font-size: 12px; color: var(--mute); }
.prop .body { flex: 1; min-width: 0; }
.prop .btns { display: flex; gap: 6px; }
.prop .btns .btn { padding: 6px 10px; font-size: 13px; }
.lv { letter-spacing: 1px; }
.others .orow { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.others .orow .grow { flex: 1; }

/* ---- 底部シート／トースト ---- */
.sheet { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet-bg { position: absolute; inset: 0; background: rgba(0,0,0,.45); }
.sheet-body { position: relative; width: 100%; max-width: 520px; max-height: 82dvh; overflow-y: auto; background: #fffdf5; border-radius: 20px 20px 0 0; padding: 16px 16px calc(var(--safe-b) + 16px); animation: up .18s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.sheet-body h3 { margin: 0 0 8px; }
.sheet-body .btn { width: 100%; margin-top: 8px; }
.rent-table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 8px 0; }
.rent-table td { padding: 4px 6px; border-bottom: 1px dashed var(--line); }
.rent-table td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.rank-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.rank-row .no { font-size: 22px; width: 32px; text-align: center; }
.toast { position: fixed; left: 50%; bottom: calc(var(--safe-b) + 120px); transform: translateX(-50%); background: rgba(15,23,42,.9); color: #fff; padding: 8px 16px; border-radius: 20px; z-index: 80; max-width: 86%; font-size: 14px; text-align: center; }
