/*
 * sandbox-ui.css
 * アプリケーションサンドボックス 共通UIスタイルシート
 *
 * 使い方:
 *   <link rel="stylesheet" href="/sandbox-ui.css">
 *
 * ページ固有のスタイルはそれぞれの <style> ブロックに記述してください。
 * 新しいアプリを追加する場合は、このファイルをリンクするだけで
 * ヘッダー・ボトムナビ・カード・モーダル・セクション等の
 * 共通デザインが適用されます。
 */

/* ════════════════════════════════════════
   デザイントークン
════════════════════════════════════════ */
:root {
    --navy:         #1a2b4a;   /* メインカラー（ヘッダー・ボトムナビ背景） */
    --navy-light:   #243659;   /* ネイビーのライトバリアント */
    --gold:         #f0b429;   /* アクセントカラー */
    --white:        #ffffff;
    --bg:           #f4f6fb;   /* ページ背景 */
    --text-muted:   #8a96a8;   /* サブテキスト・ラベル */
    --divider:      #edf0f5;   /* セパレーター線 */
    --card-radius:  16px;      /* カード角丸 */
    --red:          #ff6b6b;   /* × プレイヤー・エラー */
    --purple:       #a78bfa;   /* 引き分け・その他 */
}


/* ════════════════════════════════════════
   リセット
════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, "Segoe UI", system-ui, sans-serif;
    background: var(--bg);
    color: var(--navy);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    /* ボトムナビ分の余白。ナビを使わないページは body に class="no-nav" を付けてください */
    padding-bottom: 80px;
}

body.no-nav { padding-bottom: 0; }


/* ════════════════════════════════════════
   ヘッダー
════════════════════════════════════════ */

/* トップページ用: 大タイトル型 */
.header {
    background: var(--navy);
    padding: 52px 20px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left .greeting {
    font-size: 13px;
    color: rgba(255,255,255,0.6);
    margin-bottom: 4px;
}

.header-left .app-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--white);
    letter-spacing: -0.3px;
    line-height: 1.15;
}

.header-left .app-title span { color: var(--gold); }

/* サブページ用: 小タイトル + 戻るリンク型 */
.header-back {
    display: flex; align-items: center; gap: 4px;
    color: var(--gold);
    font-size: 14px; font-weight: 600;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

.header-center .page-title {
    font-size: 17px;
    font-weight: 800;
    color: var(--white);
    text-align: center;
}

/* ヒーローセクション（トップページ用ネイビー背景エリア） */
.hero-section {
    background: var(--navy);
    padding: 0 20px 28px;
}

.hero-card {
    background: var(--gold);
    border-radius: var(--card-radius);
    padding: 20px;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

.hero-card .hero-deco {
    position: absolute;
    right: -8px; top: -8px;
    opacity: 0.12;
    line-height: 1;
}

.hero-card .hero-eyebrow {
    font-size: 11px; font-weight: 700;
    color: var(--navy); opacity: 0.65;
    text-transform: uppercase; letter-spacing: 0.08em;
    margin-bottom: 6px;
}

.hero-card .hero-title {
    font-size: 26px; font-weight: 900;
    color: var(--navy); letter-spacing: -0.5px;
    line-height: 1.15; margin-bottom: 6px;
}

.hero-card .hero-sub {
    font-size: 13px; color: var(--navy);
    opacity: 0.7; margin-bottom: 16px;
}

.hero-card .hero-btn {
    align-self: flex-start;
    background: var(--navy); color: var(--white);
    font-size: 13px; font-weight: 700;
    padding: 10px 20px; border-radius: 30px;
    letter-spacing: 0.05em; text-transform: uppercase;
}

/* アバター（ヘッダー右端の丸アイコン） */
.avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--gold);
    color: var(--navy);
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; font-weight: 800;
    flex-shrink: 0;
    cursor: pointer;
    border: 2px solid rgba(255,255,255,0.2);
}

/* トップページ用の大きいアバター */
.avatar.lg {
    width: 44px; height: 44px;
    font-size: 18px;
}

/* オンラインバー */
.online-bar {
    margin: 16px 20px 0;
    background: var(--navy-light);
    border-radius: var(--card-radius);
    padding: 12px 16px;
    display: flex; align-items: center; gap: 10px;
}

.online-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--gold);
    flex-shrink: 0;
    box-shadow: 0 0 6px var(--gold);
}

.online-text { font-size: 13px; color: rgba(255,255,255,0.75); flex: 1; }
.online-count { font-size: 13px; font-weight: 700; color: var(--gold); }


/* ════════════════════════════════════════
   セクション / カード
════════════════════════════════════════ */

.section { padding: 20px 20px 0; }

.section-title {
    font-size: 12px; font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.08em;
    margin-bottom: 10px;
}

/* 白い角丸カード */
.card {
    background: var(--white);
    border-radius: var(--card-radius);
    overflow: hidden;
}

/* カード内のリスト行 */
.list-row {
    display: flex; align-items: center;
    padding: 13px 16px; gap: 12px;
    position: relative;
}

.list-row + .list-row::before {
    content: ''; position: absolute;
    top: 0; left: 16px; right: 0;
    height: 0.5px; background: var(--divider);
}

/* 行内左アイコン */
.row-icon {
    width: 36px; height: 36px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

.row-icon.navy  { background: var(--navy); }
.row-icon.gold  { background: var(--gold); }
.row-icon.light { background: var(--divider); }
.row-icon.red   { background: rgba(255,80,80,0.12); }

/* メニューアイテム（大きめアイコン付きカードリスト） */
.menu-list { display: flex; flex-direction: column; gap: 10px; }

.menu-item {
    background: var(--white);
    border-radius: var(--card-radius);
    padding: 14px 16px;
    display: flex; align-items: center; gap: 14px;
    text-decoration: none; color: var(--navy);
    -webkit-tap-highlight-color: transparent;
}

.menu-item:active { opacity: 0.85; }
.menu-item.disabled { opacity: 0.5; pointer-events: none; }

.menu-icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    background: var(--navy);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

.menu-icon.gold  { background: var(--gold); }
.menu-icon.light { background: #eef1f7; }

.menu-body { flex: 1; }

.menu-title { font-size: 15px; font-weight: 700; color: var(--navy); margin-bottom: 2px; }
.menu-sub   { font-size: 12px; color: var(--text-muted); }

.menu-right { display: flex; align-items: center; gap: 8px; }

/* シェブロン（›） */
.chevron { font-size: 18px; color: #c5cad6; font-weight: 400; }


/* ════════════════════════════════════════
   バッジ / ピル
════════════════════════════════════════ */

.badge {
    font-size: 10px; font-weight: 700;
    padding: 3px 9px; border-radius: 20px;
    text-transform: uppercase; letter-spacing: 0.04em;
    white-space: nowrap;
}

.badge-live { background: #e6f9ed; color: #1a9e4a; }
.badge-soon { background: #f0f2f7; color: var(--text-muted); }

/* ロールバッジ（ゲーム内プレイヤー表示） */
.role-badge {
    font-size: 10px; font-weight: 700;
    padding: 4px 10px; border-radius: 20px;
    text-transform: uppercase; letter-spacing: 0.04em;
}

.role-badge.o    { background: rgba(240,180,41,0.2);  color: var(--gold); }
.role-badge.x    { background: rgba(255,80,80,0.2);   color: var(--red); }
.role-badge.spec { background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.5); }

/* ターンバッジ */
.turn-badge {
    font-size: 10px; font-weight: 700;
    padding: 3px 9px; border-radius: 20px;
    text-transform: uppercase;
}

.turn-badge.o { background: rgba(240,180,41,0.15); color: var(--gold); }
.turn-badge.x { background: rgba(255,80,80,0.12);  color: var(--red); }

/* デバッグページ用ユーザーロールピル */
.pill {
    font-size: 10px; font-weight: 700;
    padding: 3px 10px; border-radius: 20px;
    text-transform: uppercase; letter-spacing: 0.04em;
    white-space: nowrap;
}

.pill-o    { background: rgba(240,180,41,0.15); color: var(--gold); }
.pill-x    { background: rgba(255,80,80,0.12);  color: var(--red); }
.pill-spec { background: #f0f2f7; color: var(--text-muted); }


/* ════════════════════════════════════════
   ボタン
════════════════════════════════════════ */

/* メインアクションボタン（ゴールド） */
.action-btn {
    display: block; width: 100%;
    background: var(--gold); color: var(--navy);
    border: none; border-radius: var(--card-radius);
    padding: 15px; font-size: 15px; font-weight: 800;
    font-family: inherit; cursor: pointer;
    text-align: center; letter-spacing: 0.05em;
    text-transform: uppercase;
    -webkit-tap-highlight-color: transparent;
}

.action-btn:active { opacity: 0.85; }

/* テキストボタン（名前変更など） */
.icon-btn {
    background: none; border: none;
    color: var(--gold); font-size: 13px;
    font-weight: 600; cursor: pointer;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
}


/* ════════════════════════════════════════
   ボトムナビゲーション
════════════════════════════════════════ */

.bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0;
    background: var(--navy);
    padding: 10px 20px 24px;
    display: flex; justify-content: space-around;
    z-index: 100;
}

.nav-item {
    display: flex; flex-direction: column;
    align-items: center; gap: 3px;
    font-size: 10px; font-weight: 600;
    color: rgba(255,255,255,0.4);
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

.nav-item.active { color: var(--gold); }

.nav-icon svg { display: block; }


/* ════════════════════════════════════════
   モーダル（ボトムシート）
════════════════════════════════════════ */

.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex; align-items: flex-end; justify-content: center;
    z-index: 1000;
}

.modal-overlay.hidden { display: none; }

.modal-sheet {
    background: var(--bg);
    border-radius: 20px 20px 0 0;
    padding: 24px 20px 44px;
    width: 100%; max-width: 480px;
}

.modal-sheet h2 {
    font-size: 20px; font-weight: 800; color: var(--navy);
    text-align: center; margin-bottom: 6px;
}

.modal-sheet p {
    font-size: 13px; color: var(--text-muted);
    text-align: center; margin-bottom: 20px;
}

.modal-input {
    width: 100%; background: var(--white);
    border: 2px solid #e8ecf4; border-radius: 12px;
    padding: 14px 16px; font-size: 16px;
    font-family: inherit; outline: none;
    color: var(--navy); margin-bottom: 12px;
}

.modal-input:focus { border-color: var(--gold); }

.modal-btn {
    width: 100%; background: var(--navy);
    color: var(--white); border: none;
    border-radius: 12px; padding: 15px;
    font-size: 15px; font-weight: 700;
    font-family: inherit; cursor: pointer;
}


/* ════════════════════════════════════════
   ログ表示（デバッグページ用）
════════════════════════════════════════ */

.log-scroll {
    background: var(--white);
    border-radius: var(--card-radius);
    overflow: hidden;
    max-height: 230px;
    overflow-y: auto;
}

.log-row {
    display: flex; gap: 8px;
    padding: 10px 16px;
    font-size: 12px; align-items: flex-start;
    position: relative;
}

.log-row + .log-row::before {
    content: ''; position: absolute;
    top: 0; left: 16px; right: 0;
    height: 0.5px; background: var(--divider);
}

.log-time    { color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }
.log-ip      { color: var(--text-muted); white-space: nowrap; flex-shrink: 0; font-family: monospace; }
.log-method  { font-weight: 700; color: var(--gold); white-space: nowrap; flex-shrink: 0; }
.log-uri     { color: var(--navy); word-break: break-all; flex: 1; }
.log-sender  { font-weight: 700; color: var(--navy); white-space: nowrap; flex-shrink: 0; }
.log-content { flex: 1; color: var(--navy); word-break: break-all; }

/* 空データ表示 */
.empty-row {
    padding: 18px; text-align: center;
    font-size: 13px; color: #c5cad6;
}

/* 行の値（右寄せ） */
.row-label { font-size: 11px; color: var(--text-muted); margin-bottom: 1px; }
.row-value { font-size: 13px; color: var(--text-muted); text-align: right; word-break: break-all; max-width: 52%; }
.row-value.ok { color: #1a9e4a; font-weight: 700; }

/* DB行サブテキスト（monospace） */
.row-sub {
    font-size: 11px; color: var(--text-muted); margin-top: 1px;
    font-family: "SF Mono", "Consolas", monospace;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}


/* ════════════════════════════════════════
   ユーティリティ
════════════════════════════════════════ */

/* サブテキスト（観戦者数など） */
.sub-text { font-size: 12px; color: var(--text-muted); padding: 8px 4px 0; }

/* フッターノート */
.footer-note { font-size: 12px; color: var(--text-muted); padding: 10px 4px 0; }
