/* ============================================
   common.css: アプリ全体の基礎と共通デザイン
   ============================================ */

:root {
    --primary: #6c5ce7;
    --primary-dark: #5a4bd1;
    --primary-light: #a29bfe;
    --accent: #fd79a8;
    --accent-dark: #e84393;
    --success: #00b894;
    --warning: #f39c12;
    --danger: #e74c3c;

    /* ライトテーマ用のカラー設定 */
    --bg: #f5f7fa;           
    --bg-card: #ffffff;      
    --bg-card-hover: #f8f9fa;
    --bg-input: #ffffff;     
    --text: #2d3748;         
    --text-muted: #718096;   
    --text-dim: #a0aec0;     
    --border: #e2e8f0;       
    --border-light: #cbd5e0;
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.05); 
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.08);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    /* State colors (EXボーナス用ですが変数として共通管理) */
    --normal-color: #74b9ff;
    --gokigen-color: #55efc4;
    --suki-color: #fd79a8;

    /* Card colors (EXボーナス用ですが変数として共通管理) */
    --card-normal-color: #b2bec3;
    --card-special-color: #ffeaa7;
    --card-super-color: #ff7675;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

/* ---- Background Pattern ---- */
body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(108, 92, 231, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(253, 121, 168, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(0, 184, 148, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* ============ HEADER ============ */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 16px;
    /* 左：タイトル / 右：ハンバーガー の2カラム構成 */
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    height: 64px;
}

/* メニューを開く3本線ボタン（右側に配置） */
.menu-btn {
    background: none;
    border: none;
    font-size: 1.4rem;
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    transition: var(--transition);
    flex-shrink: 0;
}
.menu-btn:hover { background: rgba(108, 92, 231, 0.08); color: var(--primary); }

.logo {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    flex: 1;
    min-width: 0;
}
.logo #header-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.logo i {
    font-size: 1.2rem;
    color: var(--primary-light);
}

/* ============ SIDEBAR & OVERLAY (新設) ============ */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    z-index: 900;
    transition: all 0.3s ease;
}

.overlay.show {
    opacity: 1;
    visibility: visible;
}

.sidebar {
    position: fixed;
    top: 0;
    left: -280px; /* 最初は画面の左外側に隠しておく */
    width: 280px;
    height: 100%;
    background: var(--bg-card);
    z-index: 1000;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
}

/* JavaScriptでこのクラスがつくと画面内にスッと出てくる */
.sidebar.open {
    left: 0; 
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.sidebar-header h3 {
    font-size: 1.1rem;
    color: var(--text);
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    padding: 20px 15px;
    gap: 10px;
}

/* タブボタン（サイドバー用に縦並びのデザインに調整） */
.tab-btn {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: bold;
    font-size: 1rem;
    transition: var(--transition);
    color: var(--text-muted);
    text-align: left;
}

.tab-btn:hover {
    background: var(--bg-card-hover);
}

.tab-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    box-shadow: var(--shadow);
}

/* ============ MAIN CONTENT LAYOUT ============ */
.main-content {
    position: relative;
    z-index: 1;
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
    min-height: calc(100vh - 64px - 60px);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.section-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
}

.section-title i {
    color: var(--primary-light);
}

/* ============ CALCULATOR LAYOUT ============ */
.calc-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
}

.input-panel,
.result-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow);
}

.result-panel {
    position: sticky;
    top: 88px;
    max-height: calc(100vh - 112px);
    overflow-y: auto;
}

/* ---- Input Groups ---- */
.input-group {
    margin-bottom: 28px;
}

.input-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text);
}

.label-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: 700;
}

.input-description {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 12px;
    line-height: 1.6;
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--accent-dark));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(108, 92, 231, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-outline {
    background: transparent;
    color: var(--primary-light);
    border: 1px solid var(--primary-light);
}

.btn-outline:hover {
    background: rgba(108, 92, 231, 0.1);
}

.btn-sm { padding: 6px 14px; font-size: 0.82rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-block { width: 100%; }

/* ============ FOOTER ============ */
.footer {
    text-align: center;
    padding: 20px;
    color: var(--text-dim);
    font-size: 0.8rem;
    border-top: 1px solid var(--border);
}

/* ============ GLOBAL SCROLLBAR ============ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ============ TAB NAVIGATION (共通) ============ */
.tab-navigation {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 20px 0;
}
.tab-btn {
    padding: 12px 30px;
    border: none;
    background: var(--border);
    border-radius: 30px;
    cursor: pointer;
    font-weight: bold;
    font-size: 1rem;
    transition: var(--transition);
    color: var(--text-muted);
}
.tab-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    box-shadow: var(--shadow);
}

/* ============ RESPONSIVE (レイアウト共通) ============ */
@media (max-width: 1024px) {
    .calc-container { grid-template-columns: 1fr; }
    .result-panel { position: static; max-height: none; }
}
@media (max-width: 768px) {
    /* スマホでも横並び（左：タイトル / 右：ハンバーガー）を維持 */
    .header-inner { flex-direction: row; height: 56px; padding: 0 12px; gap: 8px; }
    .main-content { padding: 16px; }
    .input-panel, .result-panel { padding: 20px; }
}
@media (max-width: 480px) {
    .logo span { font-size: 1rem; }
    .section-title { font-size: 1.1rem; }
}
/* ===== v5: ヘッダー左ハンバーガー＋中央タイトル ===== */
.header-inner {
    display: grid;
    grid-template-columns: 40px 1fr 40px;
    align-items: center;
    gap: 8px;
}
.header-inner .menu-btn { justify-self: start; }
.header-inner .logo { justify-content: center; text-align: center; flex: unset; }
.header-inner .header-spacer { width: 40px; height: 40px; }

/* responsive */
@media (max-width: 480px) {
    .header-inner { grid-template-columns: 36px 1fr 36px; gap: 6px; }
    .header-inner .header-spacer { width: 36px; height: 36px; }
    .logo { font-size: 1rem; }
}

/* ===== 「マス効果」サブタブ 準備中ポップアップ (table.js が動的生成) ===== */
.table-prep-overlay {
    position: fixed; inset: 0;
    background: rgba(20,14,30,0.65);
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
    z-index: 9999;
    display: none;
    align-items: center; justify-content: center;
    padding: 20px;
}
.table-prep-overlay.show { display: flex; animation: fadeIn 0.2s ease; }
.table-prep-card {
    position: relative;
    background: linear-gradient(180deg, #fff 0%, #fff5fa 100%);
    border-radius: 18px;
    width: 100%; max-width: 420px;
    padding: 28px 24px 24px;
    text-align: center;
    box-shadow: 0 18px 50px rgba(0,0,0,0.4);
    border: 2px solid #ffd5e6;
    animation: slideUp 0.25s cubic-bezier(0.4,0,0.2,1);
}
.table-prep-icon {
    font-size: 2.4rem;
    color: var(--accent-dark, #e84393);
    margin-bottom: 10px;
}
.table-prep-card h3 {
    margin: 0 0 8px; font-size: 1.05rem; font-weight: 800;
    color: var(--text, #333);
}
.table-prep-card p {
    margin: 0; font-size: 0.9rem; line-height: 1.7;
    color: var(--text-light, #666);
}
.table-prep-close {
    position: absolute;
    top: -14px; right: -14px;
    width: 36px; height: 36px;
    border-radius: 50%;
    background: #fff; color: #444;
    border: 2px solid #ffd5e6;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    font-size: 0.95rem;
    transition: transform 0.15s ease, background 0.15s ease;
}
.table-prep-close:hover { background: #ffe4ef; transform: scale(1.08); }
@media (max-width: 480px) {
    .table-prep-card { max-width: 92%; }
    .table-prep-close { top: -10px; right: -10px; width: 32px; height: 32px; font-size: 0.85rem; }
}


/* ===== v5.1: 自己紹介行 ===== */
.profile-intro {
    margin: 6px 0 8px;
    font-size: 0.95rem;
    color: var(--text);
    line-height: 1.7;
    text-align: left;
    opacity: 0.9;
}
.profile-intro strong {
    color: var(--primary);
    font-weight: 700;
}

/* ===== v5.1: ヘッダー強制レイアウト (左:ハンバーガー / 中央:タイトル / 右:スペーサー) ===== */
.header-inner {
    display: grid !important;
    grid-template-columns: 40px 1fr 40px !important;
    align-items: center !important;
    justify-content: initial !important;
    gap: 8px !important;
}
.header-inner .menu-btn {
    justify-self: start !important;
    margin-right: 0 !important;
    margin-left: 0 !important;
}
.header-inner .logo {
    justify-content: center !important;
    text-align: center !important;
    flex: unset !important;
}
.header-inner .header-spacer {
    width: 40px !important;
    height: 40px !important;
    justify-self: end !important;
}

/* ============================================================
 * v3.1: サイドバー(ハンバーガーメニュー) コンパクト化
 * - ログイン時 11項目でも見やすいよう全体的に小さくする
 * - スマホ(768px以下)では横幅を画面の約50%に縮小
 * - ボタン・余白・フォントサイズを縮小し、アイコンと文字を左寄せ
 * ============================================================ */

/* デスクトップでも少し詰める (幅はさらに詰めてフォントを大きく) */
.sidebar {
    width: 240px;
    left: -240px;
}

/* サイドバー内部の余白 (フォント拡大にあわせ設定) */
.sidebar-header {
    padding: 14px 16px;
}
.sidebar-header h3 {
    font-size: 1.05rem;
}
.sidebar-nav {
    padding: 10px 10px 6px;
    gap: 4px;
}
/* タブ幅統一: すべてのサイドバータブを完全に同サイズに揃える */
.sidebar .tab-btn,
#member-tabs-block .tab-btn {
    padding: 11px 14px;
    font-size: 0.98rem;
    border-radius: 8px;
    text-align: left;
    justify-content: flex-start;
    gap: 10px;
    line-height: 1.25;
    min-height: 0;
    width: 100%;          /* ★ 親幅いっぱいに広げて全タブ同幅に */
    box-sizing: border-box;
    display: flex;
    align-items: center;
}
.sidebar .tab-btn i,
#member-tabs-block .tab-btn i {
    width: 20px !important;
    font-size: 1.0rem;
    flex-shrink: 0;
    text-align: center;
}

/* 艦隊専用ブロック */
#member-tabs-block {
    gap: 4px !important;
    margin-top: 6px !important;
    padding: 0 !important;  /* 内側padding差をなくす (sidebar-navと同列に揃える) */
    display: flex;
    flex-direction: column;
}
.member-block-label {
    padding: 4px 14px 5px !important;
    font-size: 0.65rem !important;
    letter-spacing: 0.1em !important;
    margin-top: 3px !important;
}
.member-block-label i { font-size: 0.7rem !important; }

/* ログインボタン周り */
.sidebar-foot-block {
    padding: 6px 12px 12px !important;
}
.sidebar-divider {
    margin: 8px 14px 6px !important;
}
#member-login-btn,
#member-logout-btn {
    padding: 8px 10px !important;
    font-size: 0.82rem !important;
}

/* ===== モバイル: サイドバー幅はそのまま、フォントとアイコンを大きく ===== */
/* ユーザー要望: 「スキルデータベース」が右端に少し余白を残すサイズで収まるよう調整 (折り返さない) */
@media (max-width: 768px) {
    .sidebar {
        width: 50vw;
        min-width: 200px;   /* 小さすぎ防止 */
        max-width: 280px;
        left: calc(-1 * min(280px, max(200px, 50vw)));
    }
    .sidebar.open {
        left: 0;
    }
    .sidebar-nav {
        padding: 8px 6px 4px;
        gap: 4px;
    }
    /* スキルデータベース (8文字) が1行で収まるサイズに調整 - タブ幅完全統一 */
    .sidebar .tab-btn,
    #member-tabs-block .tab-btn {
        padding: 10px 10px;
        font-size: 0.86rem;
        gap: 8px;
        line-height: 1.25;
        white-space: nowrap;
        width: 100%;
        box-sizing: border-box;
        justify-content: flex-start;
    }
    .sidebar .tab-btn i,
    #member-tabs-block .tab-btn i {
        width: 18px !important;
        font-size: 0.92rem;
        flex-shrink: 0;
        text-align: center;
    }
    .sidebar-header {
        padding: 12px 14px;
    }
    .sidebar-header h3 {
        font-size: 1.0rem;
    }
    .member-block-label {
        font-size: 0.65rem !important;
        padding: 4px 12px 5px !important;
    }
    .member-block-label i { font-size: 0.7rem !important; }
    #member-login-btn,
    #member-logout-btn {
        padding: 8px 10px !important;
        font-size: 0.82rem !important;
    }
}

/* さらに狭い画面 */
@media (max-width: 380px) {
    .sidebar {
        width: 56vw;
        min-width: 200px;
    }
    .sidebar .tab-btn,
    #member-tabs-block .tab-btn {
        padding: 9px 9px;
        font-size: 0.82rem;
    }
    .sidebar .tab-btn i {
        width: 17px !important;
        font-size: 0.88rem;
    }
}

/* ★ 2026-08-15: ログイン必須機能のゲート表示（スパインビューアー等） */
.llb-login-gate {
  max-width: 460px; margin: 48px auto; padding: 36px 28px; text-align: center;
  background: #fff; border: 1px solid #eee3f5; border-radius: 18px;
  box-shadow: 0 6px 24px rgba(161,140,209,.12);
}
.llb-login-gate i.fa-lock { font-size: 2.4rem; color: #c9b6e4; margin-bottom: 14px; }
.llb-login-gate h3 { margin: 0 0 10px; font-size: 1.15rem; color: #5b4b7a; }
.llb-login-gate p { margin: 0 0 22px; font-size: .9rem; line-height: 1.75; color: #7d7191; }
.llb-login-gate-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 26px; border-radius: 999px; text-decoration: none; font-weight: 700;
  color: #fff; background: linear-gradient(135deg, #a18cd1, #fbc2eb);
  box-shadow: 0 4px 14px rgba(161,140,209,.45); transition: transform .15s, filter .15s;
}
.llb-login-gate-btn:hover { transform: translateY(-1px); filter: brightness(1.05); }

/* ★ 2026-08-15: ログアウト完了トースト（Access のログアウト画面を経由せず自サイトに戻すため、
   ここで完了を知らせる） */
.llb-auth-toast{
  position:fixed; left:50%; bottom:28px; transform:translate(-50%,14px);
  background:rgba(32,26,45,.94); color:#fff; padding:12px 20px; border-radius:999px;
  font-size:14px; font-weight:600; letter-spacing:.02em; z-index:12000;
  box-shadow:0 10px 30px rgba(0,0,0,.28); opacity:0; transition:opacity .3s ease, transform .3s ease;
  display:flex; align-items:center; gap:8px; pointer-events:none; max-width:90vw;
}
.llb-auth-toast.show{ opacity:1; transform:translate(-50%,0); }
.llb-auth-toast i{ color:#7bdcb5; }
/* ログイン案内カードのボタン列（ログイン / 戻る） */
.llb-login-gate-actions{ display:flex; flex-direction:column; align-items:center; gap:12px; }
.llb-login-gate-back{
  color:#8b7fa8; font-size:13px; font-weight:600; text-decoration:none;
  display:inline-flex; align-items:center; gap:6px; padding:6px 10px; border-radius:8px;
  transition:background .15s ease, color .15s ease;
}
.llb-login-gate-back:hover{ background:rgba(161,140,209,.12); color:#6b5b95; }
