/* ピコプレ — 共通スタイル
   方針: 汎用的な白カードをやめ、暗い盤面に情報を置く「遊び場」の見た目にする。
   絵文字はUIの部品として使わない（アイコンはすべてSVG）。 */

:root {
  --bg:        #0c0e16;
  --bg-2:      #12151f;
  --panel:     #171b28;
  --panel-2:   #1e2333;
  --line:      #2a3040;
  --line-2:    #3a4256;
  --text:      #e9edf7;
  --muted:     #8b95ad;
  --dim:       #5f6980;

  --brand:     #ff5a3c;   /* 主役の色。ボタンと強調 */
  --brand-2:   #ff8a5c;
  --mint:      #38e8c8;   /* 補助。数値やリンク */
  --gold:      #ffc23c;   /* コインと報酬 */
  --ok:        #3ddb90;
  --warn:      #ff5470;

  --r1: #7d8798; --r2: #4a9eff; --r3: #b45cff; --r4: #ffa53c; --r5: #ff4d8d;

  --radius: 10px;
  --shadow: 0 2px 0 rgba(0,0,0,.5), 0 12px 30px rgba(0,0,0,.35);
  --inset: inset 0 1px 0 rgba(255,255,255,.06);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(1100px 500px at 50% -180px, rgba(255,90,60,.10), transparent 70%),
    radial-gradient(800px 400px at 100% 100%, rgba(56,232,200,.06), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP",
               -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
  line-height: 1.65;
  padding-bottom: 72px;
  letter-spacing: .01em;
}

a { color: var(--mint); text-decoration: none; }
a:hover { color: #6df0d8; }

.wrap { max-width: 1000px; margin: 0 auto; padding: 0 16px; }

/* --- ヘッダ --- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(12,14,22,.86);
  backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar .wrap { display: flex; align-items: center; gap: 16px; height: 58px; }

.logo { display: flex; align-items: center; gap: 8px; color: var(--text); white-space: nowrap; }
.logo:hover { color: var(--text); }
.logo svg { width: 26px; height: 26px; flex: none; }
.logo b { font-size: 17px; font-weight: 900; letter-spacing: .04em; }

.mainnav { display: none; gap: 2px; flex: 1; }
.mainnav a {
  position: relative; display: flex; align-items: center; gap: 6px;
  padding: 8px 12px; border-radius: 8px; color: var(--muted);
  font-size: 13px; font-weight: 700;
}
.mainnav a svg { width: 17px; height: 17px; }
.mainnav a:hover { color: var(--text); background: rgba(255,255,255,.04); }
.mainnav a.on { color: var(--text); }
.mainnav a.on::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px;
  height: 2px; border-radius: 2px; background: var(--brand);
}
@media (min-width: 760px) { .mainnav { display: flex; } body { padding-bottom: 0; } }

.account { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 13px; }
.coin {
  display: flex; align-items: center; gap: 6px; padding: 5px 12px 5px 8px;
  border-radius: 999px; background: rgba(255,194,60,.10);
  border: 1px solid rgba(255,194,60,.28); color: var(--gold);
  font-weight: 800; font-variant-numeric: tabular-nums;
}
.coin:hover { color: var(--gold); background: rgba(255,194,60,.16); }
.coin svg { width: 16px; height: 16px; }
.avatar-link { color: var(--text); font-weight: 700; }
.admin-link {
  color: var(--muted); border: 1px solid var(--line-2); padding: 4px 10px;
  border-radius: 7px; font-size: 12px; font-weight: 700;
}
.admin-link:hover { color: var(--text); border-color: var(--line-2); }
.linkbtn { background: none; border: 0; color: var(--dim); cursor: pointer; font: inherit; font-size: 12px; padding: 0; }
.linkbtn:hover { color: var(--text); }
.inline { display: inline; }

/* --- 下部タブ（スマホ） --- */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; display: flex;
  background: rgba(12,14,22,.95); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 9px 2px 10px; font-size: 10px; font-weight: 700; color: var(--dim);
}
.tabbar a svg { width: 21px; height: 21px; }
.tabbar a.on { color: var(--brand); }
@media (min-width: 760px) { .tabbar { display: none; } }

.page { padding-top: 18px; padding-bottom: 32px; }

/* --- パネル（旧カード） --- */
.card {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow), var(--inset);
  padding: 18px;
  margin-bottom: 14px;
}
.card-title {
  margin: 0 0 14px; font-size: 12px; font-weight: 900;
  letter-spacing: .14em; color: var(--muted); text-transform: uppercase;
  display: flex; align-items: center; gap: 10px;
}
.card-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.card h1 { margin: 0 0 6px; font-size: 21px; font-weight: 900; letter-spacing: .01em; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; }
.more { margin: 14px 0 0; text-align: right; font-size: 13px; }

/* --- ヒーロー --- */
.hero {
  position: relative; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--radius);
  background:
    radial-gradient(600px 220px at 20% 0%, rgba(255,90,60,.22), transparent 70%),
    radial-gradient(500px 220px at 90% 100%, rgba(56,232,200,.14), transparent 70%),
    linear-gradient(180deg, #1d2233, #141826);
  padding: 34px 20px; margin-bottom: 14px; text-align: center;
  box-shadow: var(--shadow);
}
.hero h1 { margin: 0 0 8px; font-size: 26px; font-weight: 900; letter-spacing: .02em; }
.hero p { margin: 0 0 18px; color: var(--muted); font-size: 14px; }

/* --- ボタン --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 8px; cursor: pointer; text-align: center;
  font-size: 13px; font-weight: 800; letter-spacing: .02em;
  background: linear-gradient(180deg, #262c3d, #1b2030);
  border: 1px solid var(--line-2); color: var(--text);
  box-shadow: 0 2px 0 rgba(0,0,0,.45), var(--inset);
  transition: transform .06s ease, filter .12s ease;
}
.btn:hover { filter: brightness(1.14); color: var(--text); }
.btn:active { transform: translateY(2px); box-shadow: 0 0 0 rgba(0,0,0,.45); }
.btn.primary {
  background: linear-gradient(180deg, var(--brand-2), var(--brand));
  border-color: #ff7a5c; color: #1a0d09;
  box-shadow: 0 2px 0 #a83420, 0 6px 18px rgba(255,90,60,.28), var(--inset);
}
.btn.primary:active { box-shadow: 0 0 0 #a83420; }
.btn.big { padding: 13px 30px; font-size: 15px; }
.btn.small { padding: 5px 11px; font-size: 12px; }
.btn[disabled] { opacity: .38; cursor: not-allowed; filter: grayscale(.5); }

/* --- フォーム --- */
.form { display: flex; flex-direction: column; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 800; color: var(--muted); }
.form input, .form select, .form textarea, .inline-form input, .composer textarea {
  padding: 11px 12px; border: 1px solid var(--line-2); border-radius: 8px;
  font-size: 15px; font-family: inherit; background: #0e111a; color: var(--text);
  box-shadow: inset 0 2px 6px rgba(0,0,0,.35);
}
.form input:focus, .form select:focus, .form textarea:focus, .composer textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: inset 0 2px 6px rgba(0,0,0,.35), 0 0 0 3px rgba(255,90,60,.16);
}
.form textarea, .composer textarea { min-height: 88px; resize: vertical; }
.form.grid2 { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 760px) {
  .form.grid2 { grid-template-columns: 1fr 1fr; }
  .form.grid2 button { grid-column: 1 / -1; justify-self: start; }
}
.inline-form { display: flex; gap: 8px; margin-bottom: 14px; }
.composer { display: flex; flex-direction: column; gap: 10px; }
.composer button { align-self: flex-end; }

.flash { padding: 11px 15px; border-radius: 8px; margin-bottom: 14px; font-size: 14px; border: 1px solid; }
.flash.error { background: rgba(255,84,112,.10); border-color: rgba(255,84,112,.35); color: #ff8fa3; }
.flash.ok    { background: rgba(61,219,144,.10); border-color: rgba(61,219,144,.32); color: #7ef0b8; }
.flash.info  { background: rgba(56,232,200,.08); border-color: rgba(56,232,200,.28); color: #7ef0e0; }

/* --- 投稿 --- */
.post { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.post:last-child { border-bottom: 0; }
.post-avatar {
  width: 40px; height: 40px; border-radius: 10px; flex: none; display: grid; place-items: center;
  font-weight: 900; color: #0e1018;
  background: linear-gradient(140deg, var(--brand-2), var(--brand));
}
.post-avatar:hover { color: #0e1018; }
.post-main { min-width: 0; flex: 1; }
.post-head { display: flex; gap: 8px; align-items: baseline; font-size: 13px; flex-wrap: wrap; }
.post-head b { color: var(--text); }
.post-body { margin: 5px 0 8px; word-break: break-word; }
.post-actions { font-size: 12px; }
.comment { padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.comment p { margin: 5px 0 0; }

/* --- ゲーム一覧 --- */
.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.game-card {
  display: flex; flex-direction: column; gap: 4px; padding: 16px 14px;
  border: 1px solid var(--line); border-radius: var(--radius); color: var(--text);
  background: linear-gradient(180deg, #1c2130, #161a26);
  box-shadow: var(--inset);
}
.game-card:hover { border-color: var(--brand); color: var(--text); transform: translateY(-2px); }
.game-icon { font-size: 28px; }
.game-title { font-weight: 900; font-size: 15px; }
.game-genre { font-size: 11px; color: var(--mint); font-weight: 700; letter-spacing: .06em; }
.game-plays { font-size: 11px; color: var(--dim); }
.game-detail { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.game-thumb.big { width: 96px; height: 108px; margin: 0; flex: none; }

/* --- プロフィール / ランキング --- */
.profile { display: flex; gap: 16px; align-items: flex-start; }
.profile-avatar {
  width: 68px; height: 68px; border-radius: 16px; flex: none; display: grid; place-items: center;
  font-size: 27px; font-weight: 900; color: #0e1018;
  background: linear-gradient(140deg, var(--brand-2), var(--brand));
}
.stats { font-size: 14px; display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.stats .coin { background: rgba(255,194,60,.10); }
.balance { font-size: 34px; font-weight: 900; margin: 0; color: var(--gold); font-variant-numeric: tabular-nums; }

.ranking { list-style: none; margin: 0; padding: 0; }
.ranking li { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.ranking li:last-child { border-bottom: 0; }
.ranking .rank { width: 30px; font-weight: 900; color: var(--dim); font-variant-numeric: tabular-nums; }
.ranking li:nth-child(1) .rank { color: var(--gold); }
.ranking li:nth-child(2) .rank { color: #cdd6e6; }
.ranking li:nth-child(3) .rank { color: #d99a5c; }
.ranking .coin { margin-left: auto; }

.ledger { list-style: none; margin: 0; padding: 0; }
.ledger li { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.ledger li:last-child { border-bottom: 0; }
.ledger .plus { color: var(--ok); font-weight: 800; width: 68px; font-variant-numeric: tabular-nums; }
.ledger .minus { color: var(--warn); font-weight: 800; width: 68px; font-variant-numeric: tabular-nums; }
.ledger li .muted { margin-left: auto; }

/* --- 広告（休眠中。有効化したとき用） --- */
.ad { position: relative; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 14px; overflow: hidden; background: var(--panel); }
.ad-label { position: absolute; top: 6px; right: 8px; font-size: 10px; color: var(--dim); border: 1px solid var(--line); border-radius: 3px; padding: 0 5px; }
.ad-body, .ad-house a { display: flex; align-items: center; gap: 12px; padding: 12px 14px; color: var(--text); }
.ad-thumb { font-size: 26px; width: 50px; height: 50px; flex: none; display: grid; place-items: center; background: var(--bg-2); border-radius: 8px; overflow: hidden; }
.ad-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ad-text { display: flex; flex-direction: column; min-width: 0; }
.ad-text span { font-size: 12px; color: var(--muted); }
.ad-cta { margin-left: auto; font-size: 12px; font-weight: 800; color: var(--brand); white-space: nowrap; }
.ad-house { border-style: dashed; }
.reward { display: flex; flex-direction: column; gap: 10px; }

/* --- 管理画面 --- */
.admin-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.kpi-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 16px; }
@media (min-width: 760px) { .kpi-grid { grid-template-columns: repeat(3, 1fr); } }
.kpi {
  background: #10131d; border: 1px solid var(--line); border-radius: 9px;
  padding: 13px; display: flex; flex-direction: column; gap: 1px;
}
.kpi-label { font-size: 10px; color: var(--muted); font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.kpi-value { font-size: 24px; font-weight: 900; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 11px; color: var(--dim); }
.admin-links { display: flex; gap: 8px; flex-wrap: wrap; margin: 0; }

.table { width: 100%; border-collapse: collapse; font-size: 13px; display: block; overflow-x: auto; }
.table th, .table td { padding: 9px 11px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; white-space: nowrap; }
.table th { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; font-weight: 800; }
.table tbody tr:hover { background: rgba(255,255,255,.02); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table form { display: inline; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 10px; font-weight: 800; background: var(--bg-2); color: var(--muted); letter-spacing: .06em; }
.pill.active { background: rgba(61,219,144,.14); color: var(--ok); }
.pill.paused { background: rgba(255,84,112,.14); color: var(--warn); }
code { background: #0e111a; border: 1px solid var(--line); padding: 1px 6px; border-radius: 4px; font-size: 12px; color: var(--mint); }

/* --- フッタ --- */
.footer { border-top: 1px solid var(--line); margin-top: 28px; padding: 20px 0 26px; font-size: 12px; color: var(--dim); }
.footer .wrap { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.footer .links { display: flex; gap: 16px; }
.footer a { color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

.game-thumb { width: 56px; height: 66px; object-fit: contain; margin-bottom: 2px; }
.post-actions a { display: inline-flex; align-items: center; gap: 5px; color: var(--dim); font-weight: 700; }
.post-actions a:hover { color: var(--mint); }

/* ============================================================
   ここから下はスマホ既定 → 広い画面で上書き、の順で書く。
   主戦場は縦持ちのスマホなので、狭い画面を「例外」にしない。
   ============================================================ */

/* 狭い画面では畳む要素（管理系・ログアウトなど） */
.wide-only { display: none; }

/* iOS は 16px 未満の入力欄で勝手にズームするので、下回らせない */
.form input, .form select, .form textarea,
.inline-form input, .composer textarea { font-size: 16px; padding: 12px; }

/* 指で押せる大きさを確保する（最低 44px） */
.btn { padding: 12px 18px; font-size: 14px; min-height: 44px; }
.btn.small { padding: 9px 14px; font-size: 13px; min-height: 38px; }
.btn.big { width: 100%; }

.wrap { padding: 0 12px; }
.topbar .wrap { height: 54px; gap: 10px; }
.card { padding: 15px 13px; border-radius: 12px; }
.hero { padding: 26px 16px; }
.hero h1 { font-size: 22px; }
.card h1 { font-size: 19px; }
.profile-avatar { width: 56px; height: 56px; font-size: 22px; }
.game-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
.kpi-grid { grid-template-columns: repeat(2, 1fr); }
.footer .wrap { flex-direction: column; gap: 6px; }
/* 文字数の違うリンクを等幅にすると長いものが潰れる。内容の幅は確保する */
.admin-links .btn { flex: 1 1 auto; min-width: max-content; }

/* 下タブに隠れないよう、ホームバーのぶんも空ける */
body { padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
.tabbar a { padding: 8px 2px calc(9px + env(safe-area-inset-bottom)); }

/* 極端に狭い端末 */
@media (max-width: 359px) {
  .game-grid { grid-template-columns: 1fr; }
  .logo b { font-size: 15px; }
}

/* --- ここから広い画面（タブレット・PC）--- */
@media (min-width: 760px) {
  .wide-only { display: inline-flex; }
  form.wide-only { display: inline; }
  body { padding-bottom: 0; }
  .wrap { padding: 0 16px; }
  .topbar .wrap { height: 58px; gap: 16px; }
  .card { padding: 18px; border-radius: var(--radius); }
  .card h1 { font-size: 21px; }
  .hero { padding: 34px 20px; }
  .hero h1 { font-size: 26px; }
  .profile-avatar { width: 68px; height: 68px; font-size: 27px; }
  .btn { padding: 9px 16px; font-size: 13px; min-height: 0; }
  .btn.small { padding: 5px 11px; font-size: 12px; min-height: 0; }
  .btn.big { padding: 13px 30px; font-size: 15px; width: auto; }
  .form input, .form select, .form textarea,
  .inline-form input, .composer textarea { font-size: 15px; padding: 11px 12px; }
  .game-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .footer .wrap { flex-direction: row; gap: 12px; }
}

/* コイン残高。数字を主役にする */
.balance { display: flex; align-items: center; gap: 8px; }
.balance svg { width: 26px; height: 26px; flex: none; }

/* --- 運営コンソールの帯（プレイヤー画面と取り違えないための目印）--- */
.opsbar {
  background: linear-gradient(180deg, #2a1d12, #1d1610);
  border: 1px solid #4a3320; border-radius: var(--radius);
  margin-bottom: 14px; box-shadow: var(--inset);
}
.opsbar-in { display: flex; align-items: center; gap: 10px; padding: 10px 12px; flex-wrap: wrap; }
.opsbar-tag {
  font-size: 10px; font-weight: 900; letter-spacing: .14em; color: #ffb45c;
  border: 1px solid #7a4f22; border-radius: 4px; padding: 3px 8px; white-space: nowrap;
}
.opsnav { display: flex; gap: 2px; flex-wrap: wrap; flex: 1; }
.opsnav a {
  font-size: 12px; font-weight: 700; color: var(--muted);
  padding: 6px 10px; border-radius: 6px; white-space: nowrap;
}
.opsnav a:hover { color: var(--text); background: rgba(255,255,255,.05); }
.opsnav a.on { color: #ffb45c; background: rgba(255,180,92,.12); }
.opsbar-back { font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap; }

/* --- ゲーム内ナビゲーション（各ゲームが自分の画面を束ねる帯）--- */
.gamenav {
  background: linear-gradient(180deg, #1b2233, #141926);
  border: 1px solid var(--line); border-radius: var(--radius);
  margin-bottom: 14px; box-shadow: var(--inset);
}
.gamenav-in { display: flex; align-items: center; gap: 10px; padding: 9px 12px; flex-wrap: wrap; }
.gamenav-title {
  font-size: 11px; font-weight: 900; letter-spacing: .1em; color: var(--brand);
  border: 1px solid rgba(255,90,60,.4); border-radius: 4px; padding: 3px 9px; white-space: nowrap;
}
.gamenav nav { display: flex; gap: 2px; flex: 1; flex-wrap: wrap; }
.gamenav nav a {
  font-size: 12px; font-weight: 700; color: var(--muted);
  padding: 7px 11px; border-radius: 6px; white-space: nowrap; min-height: 0;
}
.gamenav nav a:hover { color: var(--text); background: rgba(255,255,255,.05); }
.gamenav nav a.on { color: var(--text); background: rgba(255,90,60,.14); }
.gamenav-exit { font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap; }

/* --- なかま / メッセージ --- */
.subnav { display: flex; gap: 2px; margin-bottom: 14px; overflow-x: auto; padding-bottom: 2px; }
.subnav a {
  font-size: 13px; font-weight: 800; color: var(--muted); padding: 9px 14px;
  border-radius: 8px; white-space: nowrap; display: flex; align-items: center; gap: 6px;
}
.subnav a:hover { color: var(--text); background: rgba(255,255,255,.04); }
.subnav a.on { color: var(--text); background: rgba(255,90,60,.14); }

.badge, .nav-badge {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--brand); color: #1a0d09;
  font-size: 10px; font-weight: 900; line-height: 1;
}
.mainnav a, .tabbar a { position: relative; }
.nav-badge { position: absolute; top: 2px; right: 6px; }
.tabbar .nav-badge { top: 4px; right: calc(50% - 20px); }

.mini-avatar {
  width: 38px; height: 38px; border-radius: 10px; flex: none; display: grid; place-items: center;
  font-weight: 900; color: #0e1018; background: linear-gradient(140deg, var(--brand-2), var(--brand));
}
.people { list-style: none; margin: 0; padding: 0; }
.person {
  display: flex; align-items: center; gap: 11px; padding: 11px 0;
  border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.person:last-child { border-bottom: 0; }
.person-name { display: flex; flex-direction: column; min-width: 0; flex: 1; color: var(--text); }
.person-name:hover { color: var(--text); }
.person-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.profile-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }

.threads { display: flex; flex-direction: column; }
.thread {
  display: flex; align-items: center; gap: 11px; padding: 12px 0;
  border-bottom: 1px solid var(--line); color: var(--text);
}
.thread:last-child { border-bottom: 0; }
.thread:hover { color: var(--text); background: rgba(255,255,255,.02); }
.thread-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.thread-preview { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread.unread .thread-preview { color: var(--text); font-weight: 700; }
.thread-meta { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--dim); flex: none; }

.chat-head { display: flex; align-items: center; gap: 11px; padding-bottom: 12px;
  border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.chat-head div { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.chat { display: flex; flex-direction: column; gap: 8px; max-height: 60vh; overflow-y: auto;
  padding: 4px 2px 12px; }
.bubble { max-width: 78%; padding: 9px 13px; border-radius: 14px; font-size: 14px; }
.bubble p { margin: 0; word-break: break-word; }
.bubble .stamp { font-size: 10px; opacity: .6; display: block; margin-top: 3px; }
.bubble.mine { align-self: flex-end; background: linear-gradient(180deg, var(--brand-2), var(--brand));
  color: #1a0d09; border-bottom-right-radius: 4px; }
.bubble.theirs { align-self: flex-start; background: #222839; border-bottom-left-radius: 4px; }
.msg-form { border-top: 1px solid var(--line); padding-top: 12px; }

/* 下タブが6つになったので、狭い画面でも潰れないよう詰める */
.tabbar a { font-size: 9px; letter-spacing: -.02em; padding-left: 0; padding-right: 0; }
.tabbar a svg { width: 19px; height: 19px; }
.tabbar .nav-badge { right: calc(50% - 18px); min-width: 15px; height: 15px; font-size: 9px; }
@media (max-width: 359px) {
  .tabbar a { font-size: 8px; }
  .tabbar a svg { width: 17px; height: 17px; }
}
@media (min-width: 760px) {
  .tabbar a { font-size: 10px; }
  .mainnav a { padding: 8px 10px; }
}

/* いいね */
.like {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px;
  border-radius: 999px; border: 1px solid var(--line); background: transparent;
  color: var(--dim); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer;
  min-height: 0; margin-right: 8px;
}
.like:hover { color: var(--warn); border-color: rgba(255,84,112,.4); }
.like svg { width: 14px; height: 14px; }
.like.on { color: var(--warn); border-color: rgba(255,84,112,.5); background: rgba(255,84,112,.12); }
.post-actions { display: flex; align-items: center; }

/* --- ガチャ --- */
.gacha-wallet { display: flex; align-items: center; gap: 8px; }
.gacha-wallet svg { width: 22px; height: 22px; color: var(--gold); }
.gacha-wallet b { font-size: 26px; font-weight: 900; color: var(--gold); font-variant-numeric: tabular-nums; }
.gacha-wallet span { font-size: 12px; color: var(--muted); }

.rate-chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; }
.rate-chip { font-size: 11px; padding: 3px 9px; border-radius: 999px; background: var(--bg-2);
  border: 1px solid var(--line); color: var(--muted); font-variant-numeric: tabular-nums; }
.rate-chip b { margin-right: 4px; }
.rate-chip.r5 { color: var(--r5); border-color: rgba(255,77,141,.4); }
.rate-chip.r4 { color: var(--r4); border-color: rgba(255,165,60,.4); }
.rate-chip.r3 { color: var(--r3); border-color: rgba(180,92,255,.4); }

.pity { margin: 10px 0; }
.pity-bar { display: block; height: 5px; border-radius: 999px; background: var(--line);
  overflow: hidden; margin-top: 5px; }
.pity-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--r3), var(--r5)); }

.gacha-actions { display: flex; gap: 8px; margin-top: 12px; }
.gacha-actions .btn { flex: 1; }

.drops { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.drops.big { justify-content: center; margin: 18px 0; }
.drop { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px;
  width: 84px; padding: 8px 4px; border-radius: 10px; background: #10131d;
  border: 1px solid var(--line); border-top-width: 3px; }
.drops.big .drop { width: 104px; padding: 12px 6px; }
.drop.r1 { border-top-color: var(--r1); } .drop.r2 { border-top-color: var(--r2); }
.drop.r3 { border-top-color: var(--r3); } .drop.r4 { border-top-color: var(--r4); }
.drop.r5 { border-top-color: var(--r5); box-shadow: 0 0 18px rgba(255,77,141,.35); }
.drop-art { width: 46px; height: 54px; object-fit: contain; }
.drops.big .drop-art { width: 62px; height: 72px; }
.drop-slot { font-size: 11px; color: var(--muted); height: 54px; display: grid; place-items: center; }
.drop-name { font-size: 11px; font-weight: 700; text-align: center; line-height: 1.2; }
.drop .q { font-size: 10px; color: var(--muted); }

.gacha-result { text-align: center; }
.gacha-result h1 { margin: 0 0 4px; }
.gacha-history { list-style: none; margin: 0; padding: 0; }
.gacha-history li { padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.gacha-history li:last-child { border-bottom: 0; }
.rules { margin: 0 0 14px; padding-left: 20px; font-size: 13px; color: var(--muted); }
.rules li { margin-bottom: 4px; }

.promo { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 10px;
  background: linear-gradient(135deg, rgba(180,92,255,.18), rgba(255,90,60,.12));
  border: 1px solid var(--line-2); color: var(--text); }
.promo:hover { color: var(--text); border-color: var(--r3); }
.promo-icon { color: var(--r4); display: grid; place-items: center; }
.promo-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.promo-go { color: var(--muted); font-weight: 900; }

/* --- ログインボーナス / ミッション --- */
.daily-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 14px 0; }
@media (min-width: 760px) { .daily-grid { grid-template-columns: repeat(7, 1fr); } }
.daily-slot {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px;
  border-radius: 10px; background: #10131d; border: 1px solid var(--line); text-align: center;
}
.daily-slot.got { opacity: .5; }
.daily-slot.now { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(255,90,60,.2); }
.daily-day { font-size: 11px; font-weight: 800; color: var(--muted); }
.daily-mark { font-size: 10px; color: var(--dim); }
.daily-mark.now { color: var(--brand); font-weight: 900; }
.reward { display: inline-flex; align-items: center; gap: 4px; font-size: 12px;
  color: var(--gold); font-weight: 700; flex-wrap: wrap; justify-content: center; }
.reward svg { width: 13px; height: 13px; }

.missions { list-style: none; margin: 0; padding: 0; }
.mission { display: flex; align-items: center; gap: 12px; padding: 12px 0;
  border-bottom: 1px solid var(--line); }
.mission:last-child { border-bottom: 0; }
.mission-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.mission-main b { font-size: 14px; }
.mission-bar { display: block; height: 5px; border-radius: 999px; background: var(--line);
  overflow: hidden; }
.mission-bar i { display: block; height: 100%; background: var(--mint); }
.mission.is-done .mission-bar i { background: var(--ok); }
.mission-done { font-size: 12px; color: var(--dim); }
.mission .reward { justify-content: flex-start; }

.daily-promo { background: linear-gradient(135deg, rgba(255,194,60,.2), rgba(61,219,144,.12));
  margin-bottom: 14px; }
.daily-promo .promo-icon { color: var(--gold); }

/* 装備の絵 */
.gart { width: 100%; height: 100%; object-fit: contain; display: block; }
.gemoji { width: 46px; height: 46px; padding: 2px; }
.gemoji.r3 { border-color: rgba(180,92,255,.5); }
.gemoji.r4 { border-color: rgba(255,165,60,.55); }
.gear-slot { width: 34px; height: 34px; padding: 1px; }
.drop-line { display: flex; align-items: center; gap: 8px; }
.drop-line .gart { width: 30px; height: 34px; flex: none; }
.drop.is-dup { opacity: .88; }
.dup { font-size: 9px; color: var(--mint); font-weight: 700; line-height: 1.2; }

.gacha-group { display: flex; align-items: center; gap: 10px; margin: 20px 0 10px;
  font-size: 13px; font-weight: 900; letter-spacing: .06em; color: var(--muted); }
.gacha-group::after { content: ""; flex: 1; height: 1px; background: var(--line); order: 1; }
.gacha-group .btn { order: 2; }

/* --- コインの購入 --- */
.pack-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.pack {
  border: 1px solid var(--line); border-radius: 14px; padding: 14px 12px; background: var(--surface);
  display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
}
.pack-coins { display: flex; align-items: center; gap: 6px; font-size: 20px; font-weight: 800; }
.pack-bonus { font-size: 12px; color: var(--r4); font-weight: 700; }
.pack-bonus.muted { color: var(--muted); font-weight: 400; }
.pack form { width: 100%; }
.pack .btn { width: 100%; }
/* 法定表示は長い文章が入るので、表として横に並べない。
   スマホでは「見出し → 本文」の縦積み、広い画面だけ2列にする。 */
.table.legal, .table.legal tbody, .table.legal tr, .table.legal th, .table.legal td {
  display: block; width: auto; white-space: normal; overflow: visible;
}
.table.legal tr { padding: 12px 0; border-bottom: 1px solid var(--line); }
.table.legal tr:last-child { border-bottom: 0; }
.table.legal th { padding: 0 0 4px; border: 0; }
.table.legal td { padding: 0; font-size: 14px; line-height: 1.7; }
@media (min-width: 620px) {
  .table.legal { display: table; table-layout: fixed; }
  .table.legal tbody { display: table-row-group; }
  .table.legal tr { display: table-row; padding: 0; }
  .table.legal th, .table.legal td { display: table-cell; vertical-align: top; padding: 12px 14px 12px 0; }
  .table.legal th { width: 34%; border-bottom: 1px solid var(--line); }
  .table.legal td { border-bottom: 1px solid var(--line); }
}
.sep { border: 0; border-top: 1px solid var(--line); margin: 18px 0 14px; }
.warn-text { color: var(--warn); }
.donate-hero { text-align: center; padding: 6px 0 2px; }
.donate-hero h1 { font-size: 20px; line-height: 1.45; }

/* --- 外部広告・アフィリエイト（運営コンソール）--- */
.check-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.check-list li { display: flex; flex-direction: column; gap: 2px; padding-left: 26px; position: relative; }
.check-list li::before {
  content: "×"; position: absolute; left: 0; top: 0; width: 18px; height: 18px;
  border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 900;
  background: #4a2a28; color: #ff8f86;
}
.check-list li.done::before { content: "✓"; background: #1f3d2e; color: #6fd39b; }
.adnet-slot {
  display: flex; flex-direction: column; gap: 8px; padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.adnet-head { display: flex; align-items: center; gap: 12px; justify-content: space-between; }
.adnet-slot textarea { width: 100%; font-family: ui-monospace, monospace; font-size: 12px; }
.adnet-slot .btn { align-self: flex-start; }
.ad-net .ad-slot { min-height: 1px; }
.ad-shot { padding: 0; }
/* バナーの上に「広告」を重ねると、画像の柄しだいで読めなくなる。
   帯として画像の外に出す。表記が読めなければ表示していないのと同じ。 */
.ad-shot .ad-label {
  position: static; display: block; width: 100%; box-sizing: border-box;
  text-align: right; padding: 3px 8px; border: 0;
  border-bottom: 1px solid var(--line); background: var(--bg-2); border-radius: 0;
}
.ad-shot .ad-slot { padding: 10px; text-align: center; line-height: 0; }
.ad-shot > a { display: block; padding: 10px; text-align: center; line-height: 0; }
/* ASPのバナーは 728x90 や 300x250 など固定寸法で来る。
   スマホでは必ずはみ出すので、幅を器に合わせて縮める。 */
.ad-banner, .ad-shot .ad-slot img { max-width: 100%; height: auto; }
.adnet-preview { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
h3.sub { margin: 22px 0 8px; font-size: 13px; letter-spacing: .1em; color: var(--muted); }

/* --- プロフィールの絵（app/avatar.py が描く SVG）--- */
/* 画像の持ち込みは受け付けないので、崩れた比率が来ることはない。 */
.ava { border-radius: 999px; flex: none; display: block; background: #1a1c26; }
.ava.big { width: 72px; height: 72px; }
.avatar-link .ava { display: inline-block; vertical-align: middle; margin-right: 6px; }
.post-avatar { background: none; padding: 0; }
.post-avatar .ava { width: 40px; height: 40px; }

.ava-now { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }

/* 図案えらび。指で押せる大きさ（最低44px）を確保する。 */
.pick-avas { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.pick-ava {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 4px; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--line); background: #17141c; font-size: 11px; color: var(--muted);
}
.pick-ava input { position: absolute; opacity: 0; pointer-events: none; }
.pick-ava.on, .pick-ava:has(input:checked) {
  border-color: #ffc247; background: #251f14; color: var(--text);
}
.pick-colors { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 14px; }
.pick-color {
  width: 34px; height: 34px; border-radius: 999px; cursor: pointer;
  border: 2px solid transparent; box-shadow: 0 0 0 1px var(--line) inset;
}
.pick-color input { position: absolute; opacity: 0; pointer-events: none; }
.pick-color.on, .pick-color:has(input:checked) { border-color: #fff; }

/* --- IDでさがす --- */
.id-search { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.id-search label { flex: 1; min-width: 180px; }
.my-id { display: flex; align-items: center; gap: 12px; }
.my-id b { font-size: 20px; letter-spacing: .04em; }

@media (min-width: 560px) {
  .pick-avas { grid-template-columns: repeat(6, 1fr); }
}
