/**
 * 鉱物カードゲーム - スタイルシート
 *
 * DESIGN RULES - MEMORICA Inspired
 * ================================
 *
 * 【カラールール】
 * - 背景: 深いティール/シアン系のダークトーン
 * - テキスト: 温かみのあるベージュ/クリーム色
 * - アクセント: ゴールド系で高級感を演出
 * - ミニマルで洗練された配色
 *
 * 【デザインルール】
 * - クリーンでミニマルなUI
 * - カード中心のレイアウト
 * - 明確な視覚的階層
 * - 上品で大人向けの雰囲気
 * - 直感的で分かりやすい操作性
 * - 余白を活かした洗練されたデザイン
 *
 * FOUNDATIONS.md準拠:
 * - モバイルファースト設計
 * - 最大2スクロール領域
 * - コスト状態の視覚的区別
 */

/* =====================
   CSS Variables - MEMORICA Style
   ===================== */
:root {
    /* Primary Deep Teal Palette */
    --color-primary: #1d6262;
    --color-primary-dark: #154a4a;
    --color-primary-light: #2a7a7a;
    --color-secondary: #3d8a8a;
    --color-accent: #c9a227;
    --color-accent-dark: #a8871f;
    --color-accent-light: #dbb84a;
    --color-success: #4a9a6a;
    --color-danger: #b54a4a;
    --color-warning: #c9a227;
    --color-info: #4a8a9a;

    /* Rarity Colors - Refined Fantasy */
    --color-common: #7a9a9a;
    --color-uncommon: #4a9a6a;
    --color-rare: #4a7ab5;
    --color-epic: #8a5ab5;
    --color-legendary: #c9a227;

    /* Battle State Colors */
    --color-available: #4a9a6a;
    --color-insufficient: #b54a4a;
    --color-cooldown: #6a8a8a;
    --color-locked: #4a6a6a;

    /* Background - Deep Teal Gradient */
    --bg-primary: #0f3a3a;
    --bg-secondary: #1a4a4a;
    --bg-tertiary: #2a5a5a;
    --bg-card: #1d5252;
    --bg-card-hover: #2a6262;
    --bg-card-light: #fbe8d6;
    --bg-overlay: rgba(15, 58, 58, 0.92);
    --bg-panel: rgba(29, 82, 82, 0.95);

    /* Text - Warm Beige/Cream */
    --text-primary: #fbe8d6;
    --text-secondary: #d4c4b0;
    --text-muted: #9a8a7a;
    --text-dark: #2a3a3a;
    --text-accent: #c9a227;
    --text-disabled: #6a7a7a;

    /* Spacing - Generous for elegance */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;

    /* Border Radius - Subtle roundness */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;

    /* Shadows - Soft and subtle */
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.25);
    --shadow-button: 0 2px 6px rgba(0, 0, 0, 0.2);
    --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 20px rgba(201, 162, 39, 0.3);

    /* Font - Clean modern */
    --font-family: 'M PLUS Rounded 1c', 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-display: 'M PLUS Rounded 1c', sans-serif;
    --font-tabular: 'Roboto Mono', monospace;
    --font-heading: 'M PLUS Rounded 1c', sans-serif;

    /* Safe Area */
    --safe-area-top: env(safe-area-inset-top);
    --safe-area-bottom: env(safe-area-inset-bottom);
}

/* =====================
   Reset & Base
   ===================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Hide scrollbars for mobile (maintain scroll functionality) */
* {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}
*::-webkit-scrollbar {
    display: none; /* Chrome/Safari/Opera */
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-family);
    background: linear-gradient(180deg, #1a4a5a 0%, #2d6a6a 50%, #3d7a8a 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
    /* 選択・保存を禁止 */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    opacity: 1;
    transition: opacity 0.2s ease-out;
}
body.page-exit {
    opacity: 0;
}

/* 画像の選択・保存・ドラッグを禁止 */
img {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-user-drag: none;
    pointer-events: none;
}

/* クリック可能な画像はpointer-eventsを有効に */
a img,
button img,
.clickable img,
[onclick] img {
    pointer-events: auto;
}

/* 入力フィールドでは選択を許可 */
input,
textarea,
[contenteditable="true"] {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
    -webkit-touch-callout: default;
}

#app {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    min-height: 100dvh;
    position: relative;
    background: transparent;
}

/* =====================
   Screen Layout
   ===================== */
.screen {
    display: none;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    padding-top: var(--safe-area-top);
    padding-bottom: var(--safe-area-bottom);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.screen.active {
    display: flex;
}

/* 画面別背景 */
#home-screen {
    background-image: linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.6)), url('/assets/backgrounds/menu/menu_main_01.jpg');
    justify-content: center;
    padding-top: 10vh;
}

#deck-screen {
    background-image: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.7)), url('/assets/backgrounds/menu/menu_deck.jpg');
    background-attachment: fixed;
    overflow-y: auto;
    height: 100vh;
    height: 100dvh;
}

#story-screen {
    background-image: linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.6)), url('/assets/backgrounds/menu/menu_story.jpg');
}

#collection-screen {
    background-image: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.7)), url('/assets/backgrounds/menu/menu_collection.jpg');
    background-attachment: fixed;
}

#collection-screen.active {
    height: 100vh;
    height: 100dvh;
    min-height: unset;
    overflow: hidden;
}

#battle-setup-screen {
    background-image: linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.6)), url('/assets/backgrounds/menu/menu_battle_select.jpg');
    overflow-y: auto;
}

.screen-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: rgba(15, 58, 58, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 101;
    flex-shrink: 0;
}

.screen-header h2 {
    flex: 1;
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.header-info {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-family: var(--font-tabular);
    font-weight: 500;
}

.back-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--text-primary);
    font-size: 1.25rem;
    cursor: pointer;
    border-radius: var(--radius-full);
    transition: all 0.15s ease-out;
    transform: scale(1);
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.back-btn:active {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(0.95);
    transition: all 0.05s ease-out;
}

/* =====================
   Login Screen
   ===================== */
.login-header {
    text-align: center;
    padding: var(--space-xl) var(--space-md);
    background: transparent;
}

.login-icon {
    width: 96px;
    height: 96px;
    margin-bottom: var(--space-md);
    border-radius: 20px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.login-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: var(--space-xs);
    letter-spacing: 0.1em;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.login-header .subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    letter-spacing: 0.05em;
}

.login-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: var(--space-lg);
    max-width: 400px;
    margin: 0 auto;
    width: 100%;
}

.login-tabs {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
}

.login-tab {
    flex: 1;
    padding: var(--space-md);
    background: var(--bg-tertiary);
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease-out;
}

.login-tab.active {
    background: var(--color-primary);
    color: var(--text-primary);
}

.login-tab:hover:not(.active) {
    background: var(--bg-card);
}

.login-form {
    display: none;
    flex-direction: column;
    gap: var(--space-md);
}

.login-form.active {
    display: flex;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.form-group label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.form-group input {
    padding: var(--space-md);
    background: var(--bg-tertiary);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.15s ease-out;
}

.form-group input:focus {
    outline: none;
    border-color: var(--color-primary);
    background: var(--bg-secondary);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.form-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.form-error {
    color: var(--color-danger);
    font-size: 0.875rem;
    min-height: 1.25rem;
}

.login-footer {
    text-align: center;
    padding: var(--space-lg);
}

.text-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.875rem;
    cursor: pointer;
    padding: var(--space-sm) var(--space-md);
    text-decoration: underline;
    transition: color 0.15s ease-out;
}

.text-btn:hover {
    color: var(--text-primary);
}

/* =====================
   Game Rules Modal
   ===================== */
.rules-modal {
    max-width: 500px;
    max-height: 85vh;
    overflow-y: auto !important;
    overflow-x: hidden;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
}

.rules-content {
    color: var(--text-primary);
}

.rules-content h2 {
    text-align: center;
    margin-bottom: var(--space-lg);
    color: #fbbf24;
    font-size: 1.5rem;
    border-bottom: 2px solid #fbbf24;
    padding-bottom: var(--space-sm);
}

.rules-section {
    margin-bottom: var(--space-lg);
}

.rules-section h3 {
    color: #a78bfa;
    font-size: 1.1rem;
    margin-bottom: var(--space-sm);
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-weight: 600;
}

.rules-section h3::before {
    content: '◆';
    font-size: 0.75rem;
    color: #fbbf24;
}

.rules-section h4 {
    color: #60a5fa;
    font-size: 0.95rem;
    margin: var(--space-md) 0 var(--space-xs);
    font-weight: 500;
}

.rules-section h4:first-of-type {
    margin-top: var(--space-sm);
}

.rules-section p {
    color: #e2e8f0;
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: var(--space-sm);
}

.rules-list {
    list-style: none;
    padding: 0;
    margin: var(--space-sm) 0;
}

.rules-list li {
    color: #e2e8f0;
    font-size: 0.875rem;
    padding: var(--space-xs) 0;
    padding-left: var(--space-md);
    position: relative;
}

.rules-list li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: #fbbf24;
}

.rules-list.numbered {
    counter-reset: rules-counter;
}

.rules-list.numbered li {
    counter-increment: rules-counter;
}

.rules-list.numbered li::before {
    content: counter(rules-counter) '.';
    color: #fbbf24;
    font-weight: 600;
}

.rules-list li strong {
    color: var(--text-primary);
}

.crystal-cycle-diagram {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(168, 85, 247, 0.15));
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin: var(--space-sm) 0;
    overflow-x: auto;
}

.crystal-cycle-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    font-size: 0.85rem;
    color: #fbbf24;
    font-weight: bold;
}

.crystal-cycle-list span {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    color: #ffffff;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* =====================
   Settings Modal
   ===================== */
.settings-modal {
    max-width: 400px;
    max-height: 85vh;
    overflow-y: auto;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
}

.settings-modal h2 {
    text-align: center;
    margin-bottom: var(--space-lg);
    color: var(--color-accent);
    font-size: 1.5rem;
    border-bottom: 2px solid var(--color-accent);
    padding-bottom: var(--space-sm);
}

.settings-section {
    margin-bottom: var(--space-lg);
}

.settings-section h3 {
    color: var(--color-primary);
    font-size: 1rem;
    margin-bottom: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.settings-section h3::before {
    content: '◆';
    font-size: 0.75rem;
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--border-color);
}

.settings-row:last-child {
    border-bottom: none;
}

.settings-label {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.settings-icon {
    font-size: 1.2rem;
    line-height: 1;
}

.settings-sublabel {
    color: var(--text-secondary);
    font-size: 0.8rem;
    padding-left: 28px;
}

.settings-control {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

/* Toggle Button */
.toggle-btn {
    display: flex;
    align-items: center;
    background: var(--bg-tertiary);
    border: none;
    border-radius: var(--radius-md);
    padding: 2px;
    cursor: pointer;
    width: 60px;
    position: relative;
}

.toggle-btn .toggle-on,
.toggle-btn .toggle-off {
    flex: 1;
    padding: var(--space-xs);
    font-size: 0.7rem;
    font-weight: 600;
    text-align: center;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.toggle-btn .toggle-on {
    background: var(--color-success);
    color: white;
}

.toggle-btn .toggle-off {
    background: transparent;
    color: var(--text-muted);
}

.toggle-btn:not(.active) .toggle-on {
    background: transparent;
    color: var(--text-muted);
}

.toggle-btn:not(.active) .toggle-off {
    background: var(--color-danger);
    color: white;
}

/* Language Toggle Button */
.language-toggle-btn {
    display: flex;
    align-items: center;
    background: var(--bg-tertiary);
    border: none;
    border-radius: var(--radius-md);
    padding: 2px;
    cursor: pointer;
    width: 90px;
    position: relative;
}

.language-toggle-btn .lang-ja,
.language-toggle-btn .lang-en {
    flex: 1;
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.language-toggle-btn.ja .lang-ja {
    background: var(--color-primary);
    color: white;
}

.language-toggle-btn.ja .lang-en {
    background: transparent;
    color: var(--text-muted);
}

.language-toggle-btn.en .lang-ja {
    background: transparent;
    color: var(--text-muted);
}

.language-toggle-btn.en .lang-en {
    background: var(--color-primary);
    color: white;
}

/* Settings Slider */
.settings-slider {
    width: 100px;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    appearance: none;
    cursor: pointer;
}

.settings-slider::-webkit-slider-thumb {
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--color-primary);
    border-radius: 50%;
    cursor: pointer;
}

.settings-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--color-primary);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.volume-value {
    font-size: 0.8rem;
    color: var(--text-secondary);
    min-width: 35px;
    text-align: right;
}

.version-info {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* User Info Display in Home Header */
.user-info {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    z-index: 10;
}

.user-name {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.btn.small {
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.75rem;
    border-radius: var(--radius-sm);
}

/* =====================
   Audio Control (BGM & SFX)
   ===================== */
/* オーディオコントロールは設定モーダルに統合されたため非表示 */
.audio-control {
    display: none !important;
    position: fixed;
    top: var(--space-sm);
    left: var(--space-sm);
    gap: 4px;
    z-index: 1000;
    background: rgba(15, 58, 58, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: var(--radius-lg);
    padding: 6px;
    border: 1px solid rgba(251, 232, 214, 0.1);
}

.audio-btn {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.audio-btn:hover {
    background: rgba(251, 232, 214, 0.1);
}

.audio-btn:active {
    transform: scale(0.95);
}

.audio-btn span {
    font-size: 1rem;
    line-height: 1;
    opacity: 0.9;
}

.audio-btn.muted span {
    opacity: 0.4;
}

/* =====================
   Home Screen
   ===================== */
.home-header {
    text-align: center;
    padding: var(--space-md) var(--space-md) 0;
    background: transparent;
}

.home-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: var(--space-xs);
    letter-spacing: 0.1em;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.home-header .subtitle {
    color: var(--text-secondary);
    font-size: 0.85rem;
    letter-spacing: 0.05em;
}

.home-menu {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-xs);
    padding: var(--space-sm);
    max-width: 100%;
    margin: var(--space-lg) auto 0;
}

.menu-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 0;
    min-height: 110px;
    padding: var(--space-sm) var(--space-xs);
    background: rgba(30, 42, 56, 0.85);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.65rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease-out;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    letter-spacing: 0.02em;
    transform: translateY(0);
    text-align: center;
    line-height: 1.2;
    position: relative;
}

/* タイトル画像 */
.menu-btn .title-img {
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 92%;
    height: auto;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

/* メニューラベル（日本語タイトル） */
.menu-btn .menu-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    line-height: 1.2;
    text-align: center;
    width: 100%;
    padding-bottom: var(--space-xs);
}


/* Hover - lift up with glow */
.menu-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
    background: rgba(80, 140, 200, 0.85);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Active/Pressed - push down */
.menu-btn:active {
    transform: translateY(1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: all 0.05s ease-out;
}

.menu-btn.primary {
    background: rgba(212, 165, 71, 0.9);
    color: #1a2a2a;
    border-color: var(--color-accent);
}

.menu-btn.primary:hover {
    background: var(--color-accent);
    box-shadow: 0 6px 20px rgba(212, 165, 71, 0.4);
}

.menu-btn .icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -60%);
    width: 40px;
    height: 40px;
    object-fit: contain;
    opacity: 0.9;
}

/* ポポロクロイス風SVGアイコン */
.menu-btn .icon.svg-icon {
    width: 52px;
    height: 52px;
    opacity: 1;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    transition: transform 0.3s ease, filter 0.3s ease;
}

.menu-btn:hover .icon.svg-icon {
    transform: translate(-50%, -60%) scale(1.1);
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4)) brightness(1.1);
}

.menu-btn:active .icon.svg-icon {
    transform: translate(-50%, -60%) scale(0.95);
}

.menu-btn.primary .icon {
    filter: brightness(0.3);
}

/* Daily Bonus Menu Button */
.daily-bonus-menu-btn {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.85), rgba(168, 85, 247, 0.85)) !important;
    border-color: #a855f7 !important;
    position: relative;
    overflow: hidden;
}

.daily-bonus-menu-btn:hover {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.95), rgba(168, 85, 247, 0.95)) !important;
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.4) !important;
}

.menu-icon-daily {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -60%);
    font-size: 2.2rem;
    line-height: 1;
}

/* Menu Link (styled as button) */
a.menu-link {
    text-decoration: none;
    color: inherit;
}

/* Game Logo */
.game-logo {
    text-align: center;
    padding: var(--space-md) 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.game-logo-img {
    display: none;
    max-width: 280px;
    width: 80%;
    height: auto;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.5));
    margin: 0 auto;
}

.game-logo-fallback {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.game-logo-fallback h1 {
    font-size: 1.5rem;
    color: var(--color-accent);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    margin: 0;
}

.game-logo-fallback .subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: var(--space-xs);
}

.home-footer {
    text-align: center;
    padding: var(--space-md);
    color: var(--text-muted);
    font-size: 0.75rem;
    letter-spacing: 0.1em;
}

/* =====================
   Buttons
   ===================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-lg);
    border: none;
    border-radius: var(--radius-lg);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease-out;
    box-shadow: var(--shadow-button);
    letter-spacing: 0.05em;
    position: relative;
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Hover - lift up */
.btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

/* Active/Pressed - push down */
.btn:active:not(:disabled) {
    transform: translateY(1px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: all 0.05s ease-out;
}

.btn.primary {
    background: var(--color-accent);
    color: #2a3a3a;
}

.btn.primary:hover:not(:disabled) {
    background: var(--color-accent-dark);
}

.btn.primary:active:not(:disabled) {
    background: var(--color-accent-dark);
}

.btn.secondary {
    background: var(--bg-card);
    color: var(--text-primary);
}

.btn.secondary:hover:not(:disabled) {
    background: var(--color-primary);
}

.btn.secondary:active:not(:disabled) {
    background: var(--color-primary-dark);
}

.btn.large {
    padding: var(--space-md) var(--space-lg);
    font-size: 1.125rem;
    width: 100%;
}

/* =====================
   Deck Screen
   ===================== */
/* デッキスロットと共生ボーナスを常に表示 */
.deck-header-sticky {
    position: sticky;
    top: 52px; /* ヘッダーの高さ分 */
    z-index: 99;
    background: var(--bg-secondary);
}

.deck-slots {
    display: flex;
    gap: var(--space-md);
    padding: 36px var(--space-md) 32px;
    background: var(--bg-secondary);
}

.deck-slot {
    flex: 1;
    aspect-ratio: 3/4;
    background: var(--bg-card);
    border: 2px dashed var(--text-muted);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    overflow: visible;
    transition: all 0.15s ease-out;
    transform: translateY(0);
}

.deck-slot:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    border-color: var(--color-primary);
}

.deck-slot:active {
    transform: translateY(0);
    transition: all 0.05s ease-out;
}

.deck-slot.selected {
    border-color: var(--color-accent);
    border-style: solid;
    border-width: 4px;
    transform: translateY(-6px) scale(1.05);
    box-shadow: 0 0 30px var(--color-accent),
                0 0 60px rgba(212, 165, 71, 0.5),
                inset 0 0 20px rgba(212, 165, 71, 0.2);
    animation: slotPulse 1s ease-in-out infinite;
    background: rgba(212, 165, 71, 0.15);
    z-index: 10;
}

/* 選択中のスロットの上部バナー */
.deck-slot.selected::before {
    content: '▼ 選択中 ▼';
    position: absolute;
    top: -28px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-accent);
    color: #000;
    padding: 4px 12px;
    border-radius: var(--radius-md);
    font-size: 0.7rem;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
    animation: bannerPulse 1s ease-in-out infinite;
    z-index: 20;
}

@keyframes bannerPulse {
    0%, 100% {
        transform: translateX(-50%) scale(1);
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
    }
    50% {
        transform: translateX(-50%) scale(1.1);
        box-shadow: 0 4px 20px rgba(212, 165, 71, 0.6);
    }
}

/* 下部テキストは削除（十分強調されているため） */

@keyframes slotPulse {
    0%, 100% {
        box-shadow: 0 0 20px var(--color-accent),
                    0 0 40px rgba(212, 165, 71, 0.3),
                    inset 0 0 15px rgba(212, 165, 71, 0.1);
    }
    50% {
        box-shadow: 0 0 30px var(--color-accent),
                    0 0 60px rgba(212, 165, 71, 0.5),
                    inset 0 0 20px rgba(212, 165, 71, 0.2);
    }
}

@keyframes bounceArrow {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(4px); }
}

.deck-slot.filled {
    border-style: solid;
    border-color: var(--bg-card);
}

/* 選択中かつカードが入っている場合（入れ替え） */
.deck-slot.selected.filled {
    border-color: var(--color-warning, #f59e0b);
    box-shadow: 0 0 30px rgba(245, 158, 11, 0.7),
                0 0 60px rgba(245, 158, 11, 0.4);
    animation: slotReplacePulse 1s ease-in-out infinite;
    background: rgba(245, 158, 11, 0.15);
}

/* 入れ替えバナーは削除（十分強調されているため） */
.deck-slot.selected.filled::before {
    display: none;
}

/* 入れ替えテキストは削除 */

@keyframes slotReplacePulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(245, 158, 11, 0.6),
                    0 0 40px rgba(245, 158, 11, 0.3);
    }
    50% {
        box-shadow: 0 0 30px rgba(245, 158, 11, 0.8),
                    0 0 60px rgba(245, 158, 11, 0.5);
    }
}

.slot-label {
    position: absolute;
    top: var(--space-xs);
    left: var(--space-xs);
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-overlay);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    transition: all 0.3s ease;
    z-index: 5;
}

/* 選択中のスロット番号を強調 */
.deck-slot.selected .slot-label {
    background: var(--color-accent);
    color: #000;
    transform: scale(1.2);
    box-shadow: 0 0 10px var(--color-accent);
}

.deck-slot.selected.filled .slot-label {
    background: var(--color-warning, #f59e0b);
}

.slot-content {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
}

.slot-content.empty {
    padding: var(--space-md);
}

.slot-card-preview {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.slot-card-preview img {
    flex: 1;
    width: 100%;
    object-fit: cover;
}

.slot-card-preview .name {
    padding: var(--space-xs);
    font-size: 0.625rem;
    text-align: center;
    background: var(--bg-overlay);
}

.synergy-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm);
    background: var(--bg-card);
    font-size: 0.875rem;
}

.synergy-value {
    color: var(--color-success);
    font-weight: 700;
}

.synergy-value.none {
    color: var(--text-muted);
}

/* Card List */
.card-list-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.filter-bar {
    display: flex;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-md);
    background: rgba(0, 0, 0, 0.1);
    flex-wrap: wrap;
}

.filter-bar select {
    flex: 0 0 auto;
    min-width: 90px;
    padding: var(--space-xs) var(--space-sm);
    background: var(--bg-card);
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.75rem;
    box-shadow: var(--shadow-button);
}

.filter-bar input {
    flex: 1;
    min-width: 80px;
    padding: var(--space-xs) var(--space-sm);
    background: var(--bg-card);
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.75rem;
    box-shadow: var(--shadow-button);
}

.card-list {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-sm);
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-sm);
    align-content: start;
}

/* Integrate new card component into card list */
.card-list .mineral-card-small {
    width: 100%;
    max-width: none;
    height: auto;
}

.card-item {
    aspect-ratio: 3/4;
    background: var(--bg-card-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: pointer;
    position: relative;
    border: none;
    transition: all 0.15s ease-out;
    box-shadow: var(--shadow-card);
    transform: translateY(0);
}

.card-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.card-item:active {
    transform: translateY(0) scale(0.98);
    box-shadow: var(--shadow-button);
    transition: all 0.05s ease-out;
}

.card-item.selected {
    box-shadow: 0 0 0 3px var(--color-accent), var(--shadow-hover);
    transform: translateY(-2px) scale(1.02);
}

.card-item.selected:hover {
    transform: translateY(-4px) scale(1.02);
}

.card-item.in-deck {
    opacity: 0.6;
}

.card-item img {
    width: 100%;
    height: 70%;
    object-fit: cover;
}

.card-item .card-info {
    padding: var(--space-xs);
    font-size: 0.625rem;
    color: var(--text-dark);
    background: var(--bg-card-light);
}

.card-item .card-name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-dark);
}

.card-item .card-rarity {
    font-size: 0.5rem;
    color: var(--text-dark);
    opacity: 0.7;
}

.card-item .rarity-badge {
    position: absolute;
    top: var(--space-sm);
    right: var(--space-sm);
    width: 10px;
    height: 10px;
    border-radius: var(--radius-full);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.card-item .rarity-badge.Common { background: var(--color-common); }
.card-item .rarity-badge.Uncommon { background: var(--color-uncommon); }
.card-item .rarity-badge.Rare { background: var(--color-rare); }
.card-item .rarity-badge.Epic { background: var(--color-epic); }
.card-item .rarity-badge.Legendary { background: var(--color-legendary); }

.deck-actions {
    display: flex;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--bg-secondary);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
}

.deck-actions .btn {
    flex: 1;
}

/* デッキ画面のカードリストに下部の余白を追加 */
#deck-screen .card-list-container {
    padding-bottom: 100px;
}

#deck-screen .card-list {
    padding-bottom: var(--space-md);
}

/* =====================
   Flippable Cards (Deck Screen)
   ===================== */

/* Flippable Card Container */
.mineral-card-small.flippable {
    width: 100%;
    aspect-ratio: 2/3;
    perspective: 1000px;
    cursor: pointer;
    position: relative;
    -webkit-tap-highlight-color: transparent;
    /* 長押しメニュー・選択を無効化 */
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    touch-action: pan-y;  /* 縦スクロールのみ許可 */
}

.mineral-card-small.flippable img {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    pointer-events: none;
    -webkit-user-drag: none;
}

/* Card Flipper - the rotating element */
.card-small-flipper {
    width: 100%;
    height: 100%;
    position: relative;
    transition: transform 0.5s ease;
    transform-style: preserve-3d;
}

.card-small-flipper.flipped {
    transform: rotateY(180deg);
}

/* Card Faces - shared styles */
.card-small-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: var(--radius-lg);
    overflow: hidden;
}

/* Front Face (Card Image) */
.card-small-front {
    z-index: 2;
}

/* Back Face (Stats) */
.card-small-back {
    transform: rotateY(180deg);
    z-index: 1;
}

/* Card Frame - shared for both faces */
.card-small-frame {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-card);
}

/* Card Inner Content */
.card-small-inner {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-secondary) 100%);
    position: relative;
}

.card-small-inner.has-bg-image {
    background-image: var(--card-bg-image);
    background-size: cover;
    background-position: center;
}

/* Card Header (Front) */
.card-small-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 6px;
    background: rgba(0, 0, 0, 0.3);
}

.kingdom-icon-small {
    font-size: 0.75rem;
}

.rarity-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.rarity-indicator.rarity-common { background: var(--color-common); }
.rarity-indicator.rarity-uncommon { background: var(--color-uncommon); }
.rarity-indicator.rarity-rare { background: var(--color-rare); }
.rarity-indicator.rarity-epic { background: var(--color-epic); }
.rarity-indicator.rarity-legendary { background: var(--color-legendary); }

/* Card Image (Front) */
.card-small-image {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    overflow: hidden;
}

.card-small-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: var(--radius-sm);
}

/* Card Name (Front) */
.card-small-info {
    padding: 4px 6px;
    background: rgba(0, 0, 0, 0.4);
}

.card-small-name {
    font-size: 0.625rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-small-level {
    font-size: 0.5625rem;
    font-weight: 700;
    color: #ffd700;
    text-align: center;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
    margin-top: 2px;
}

/* =====================
   Card Back - Stats View (Beautiful Design)
   ===================== */
.card-back-inner {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    border-radius: var(--radius-lg);
    padding: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* 背景の装飾 */
.card-back-inner::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.03) 0%, transparent 50%);
    animation: shimmer 8s linear infinite;
}

@keyframes shimmer {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ヘッダー */
.card-back-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    margin-bottom: 6px;
    position: relative;
    z-index: 1;
}

.card-back-name {
    font-size: 0.65rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.card-back-level {
    font-size: 0.6rem;
    font-weight: 700;
    color: #ffd700;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.3), rgba(255, 165, 0, 0.2));
    padding: 2px 8px;
    border-radius: 10px;
    border: 1px solid rgba(255, 215, 0, 0.4);
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
}

/* ステータスオーブ */
.card-back-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    flex: 1;
    align-content: center;
    position: relative;
    z-index: 1;
}

.stat-orb-small {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4px 2px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
}

.stat-orb-small::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 8px;
    background: radial-gradient(circle at center, var(--orb-color) 0%, transparent 70%);
    opacity: 0.2;
}

.stat-orb-small::after {
    content: '';
    position: absolute;
    inset: 1px;
    border-radius: 7px;
    border: 1px solid var(--orb-color);
    opacity: 0.4;
}

.stat-val-small {
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 0 6px var(--orb-color);
    position: relative;
    z-index: 1;
}

.stat-label-small {
    font-size: 0.45rem;
    color: var(--orb-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    z-index: 1;
}

/* オーブの色 */
.stat-orb-small.atk { --orb-color: #ff6b6b; }
.stat-orb-small.def { --orb-color: #4ecdc4; }
.stat-orb-small.spd { --orb-color: #ffe66d; }
.stat-orb-small.matk { --orb-color: #c77dff; }
.stat-orb-small.mdef { --orb-color: #7ec8e3; }
.stat-orb-small.crit { --orb-color: #ff9f43; }

/* HP/MPバー */
.card-back-bars {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 6px;
    position: relative;
    z-index: 1;
}

.stat-bar-row {
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat-bar-row .bar-icon {
    font-size: 0.6rem;
    width: 14px;
    text-align: center;
}

.stat-bar {
    flex: 1;
    height: 8px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.stat-bar-row.hp .stat-bar {
    border: 1px solid rgba(255, 107, 107, 0.3);
}

.stat-bar-row.mp .stat-bar {
    border: 1px solid rgba(100, 149, 237, 0.3);
}

.stat-bar-fill {
    height: 100%;
    border-radius: 4px;
    position: relative;
}

.stat-bar-row.hp .stat-bar-fill {
    background: linear-gradient(90deg, #ff6b6b, #ee5a5a, #ff8585);
    box-shadow: 0 0 8px rgba(255, 107, 107, 0.5);
}

.stat-bar-row.mp .stat-bar-fill {
    background: linear-gradient(90deg, #6495ed, #4169e1, #87ceeb);
    box-shadow: 0 0 8px rgba(100, 149, 237, 0.5);
}

.stat-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(180deg, rgba(255,255,255,0.3) 0%, transparent 100%);
    border-radius: 4px 4px 0 0;
}

.stat-bar-row .bar-value {
    font-size: 0.55rem;
    font-weight: 700;
    min-width: 24px;
    text-align: right;
}

.stat-bar-row.hp .bar-value {
    color: #ff8585;
}

.stat-bar-row.mp .bar-value {
    color: #87ceeb;
}

/* 古いスタイルは削除済み */

/* Visual Feedback States */
.mineral-card-small.flippable.pressing {
    transform: scale(0.97);
    transition: transform 0.1s ease;
}

.mineral-card-small.flippable.long-press-active {
    animation: longPressSuccess 0.2s ease;
}

@keyframes longPressSuccess {
    0% { transform: scale(0.97); }
    50% { transform: scale(1.05); box-shadow: 0 0 20px var(--color-accent); }
    100% { transform: scale(1); }
}

/* Tap feedback animation */
.mineral-card-small.flippable.tap-feedback {
    animation: tapFeedback 0.2s ease;
}

@keyframes tapFeedback {
    0% { transform: scale(1); }
    50% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

/* ヒントテキストは削除 */

/* In-Deck State - デッキに入っているカードの表示 */
.mineral-card-small.flippable.in-deck {
    opacity: 0.5;
}

/* コーナーリボン - 通常非表示、in-deck時のみ表示 */
.in-deck-badge {
    display: none;
    position: absolute;
    top: 0;
    right: 0;
    width: 50px;
    height: 50px;
    overflow: hidden;
    z-index: 100;
    pointer-events: none;
}

.in-deck-badge::before {
    content: 'IN DECK';
    position: absolute;
    top: 8px;
    right: -20px;
    width: 80px;
    padding: 3px 0;
    background: linear-gradient(135deg, #ffd700 0%, #f0a500 100%);
    color: #1a1a2e;
    font-size: 0.45rem;
    font-weight: 800;
    text-align: center;
    letter-spacing: 0.5px;
    transform: rotate(45deg);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.mineral-card-small.flippable.in-deck .in-deck-badge {
    display: block;
}

/* Toast Notification */
.deck-toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--bg-panel);
    color: var(--text-primary);
    padding: 12px 24px;
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    border: 1px solid var(--color-accent);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
    max-width: 90%;
    text-align: center;
}

.deck-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Kingdom-specific card borders */
.mineral-card-small.kingdom-flamecrest .card-small-frame {
    box-shadow: 0 0 8px rgba(255, 100, 50, 0.3), var(--shadow-card);
}

.mineral-card-small.kingdom-crystalbloom .card-small-frame {
    box-shadow: 0 0 8px rgba(100, 200, 255, 0.3), var(--shadow-card);
}

.mineral-card-small.kingdom-ironblood .card-small-frame {
    box-shadow: 0 0 8px rgba(150, 150, 150, 0.3), var(--shadow-card);
}

.mineral-card-small.kingdom-abyssal .card-small-frame {
    box-shadow: 0 0 8px rgba(100, 100, 200, 0.3), var(--shadow-card);
}

.mineral-card-small.kingdom-sentinel .card-small-frame {
    box-shadow: 0 0 8px rgba(107, 114, 128, 0.3), var(--shadow-card);
}

/* Rarity-specific glow effects */
.mineral-card-small.rarity-legendary .card-small-frame {
    box-shadow: 0 0 12px rgba(201, 162, 39, 0.5), var(--shadow-card);
}

.mineral-card-small.rarity-epic .card-small-frame {
    box-shadow: 0 0 10px rgba(138, 90, 181, 0.4), var(--shadow-card);
}

.mineral-card-small.rarity-rare .card-small-frame {
    box-shadow: 0 0 8px rgba(74, 122, 181, 0.4), var(--shadow-card);
}

/* =====================
   Scan Screen
   ===================== */
.scan-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: var(--space-md);
}

.scan-tabs {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.scan-tab {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-card);
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.15s ease-out;
    transform: translateY(0);
}

.scan-tab:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    background: var(--color-primary);
    color: white;
}

.scan-tab:active {
    transform: translateY(1px);
    transition: all 0.05s ease-out;
}

.scan-tab.active {
    background: var(--color-primary);
    color: white;
}

.scan-tab.active:hover {
    background: var(--color-primary-dark);
}

.scan-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    min-height: 300px;
    text-align: center;
    padding: var(--space-lg);
}

.scan-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: -8px;
    margin-bottom: 16px;
}

.scan-nfc,
.scan-qr {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
    text-align: center;
    padding: var(--space-lg);
}

.scan-nfc.active,
.scan-qr.active {
    display: flex;
}

.scan-icon {
    font-size: 4rem;
}

.scan-icon img {
    width: 64px;
    height: 64px;
    object-fit: contain;
}

.scan-status {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.scan-status.success {
    color: var(--color-success);
}

.scan-status.error {
    color: var(--color-danger);
}

#qr-reader {
    width: 100%;
    max-width: 300px;
}

.scanned-cards {
    margin-top: var(--space-md);
}

.scanned-cards h3 {
    font-size: 1rem;
    margin-bottom: var(--space-sm);
}

.scanned-list {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.scanned-card {
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-card);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
}

/* Scan Content */
.scan-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: var(--space-md);
    gap: var(--space-md);
}

.scan-section {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
}

.scan-section.hidden {
    display: none;
}

/* Scanned Cards Section */
.scanned-cards-section {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
}

.scanned-cards-section h3 {
    font-size: 1rem;
    margin-bottom: var(--space-sm);
    color: var(--text-primary);
}

.scanned-cards-list {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
    min-height: 60px;
}

.scanned-cards-list .empty-message {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.scanned-cards-actions {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-md);
    justify-content: flex-end;
}

/* =====================
   Battle Setup
   ===================== */
.battle-setup-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: var(--space-md);
    gap: var(--space-md);
}

.setup-section {
    margin-bottom: 0;
}

.setup-section h3 {
    font-size: 1rem;
    margin-bottom: var(--space-sm);
    color: var(--text-secondary);
}

/* ステップタイトル */
.step-title {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-md);
}

.step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: var(--color-accent);
    color: var(--bg-primary);
    border-radius: 50%;
    font-size: 0.875rem;
    font-weight: 700;
}

/* デッキセクション */
.deck-section {
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
}

.deck-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-sm);
}

.deck-header h3 {
    margin-bottom: 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.setup-deck {
    display: flex;
    gap: var(--space-sm);
    min-height: 80px;
    padding: var(--space-md);
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
}

.setup-deck .empty-message {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.player-deck-preview {
    display: flex;
    gap: var(--space-sm);
    justify-content: center;
    flex-wrap: wrap;
}

.setup-card {
    width: 70px;
    height: 95px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.setup-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.vs-divider {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-muted);
    padding: var(--space-md) 0;
}

.opponent-options {
    display: flex;
    gap: var(--space-md);
}

.option-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-md);
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    cursor: pointer;
    box-shadow: none;
    transition: all 0.15s ease-out;
    transform: translateY(0);
}

.option-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    background: rgba(42, 122, 122, 0.3);
    border-color: var(--color-secondary);
}

.option-card:active {
    transform: translateY(1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: all 0.05s ease-out;
}

.option-card input {
    display: none;
}

.option-card.selected,
.option-card:has(input:checked) {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 2px var(--color-accent), 0 0 20px rgba(201, 162, 39, 0.3);
    background: rgba(201, 162, 39, 0.15);
    transform: translateY(-2px);
}

.option-card.selected:hover,
.option-card:has(input:checked):hover {
    box-shadow: 0 0 0 2px var(--color-accent), 0 8px 24px rgba(0, 0, 0, 0.3), 0 0 28px rgba(201, 162, 39, 0.4);
    transform: translateY(-4px);
}

/* オプションコンテンツ */
.option-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xs);
    text-align: center;
}

/* アイコンラッパー（大きいアイコン用） */
.option-icon-wrap {
    width: 72px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-xs);
    animation: iconFloat 3s ease-in-out infinite;
}

.option-icon-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.4)) drop-shadow(0 8px 20px rgba(0, 0, 0, 0.2));
}

@keyframes iconFloat {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-8px);
    }
}

.option-icon-wrap.emoji-fallback::after {
    content: attr(data-fallback);
    font-size: 3rem;
}

.option-icon-wrap.emoji-fallback img {
    display: none;
}

/* 旧スタイル互換 */
.option-icon {
    font-size: 2rem;
}

/* 敵レベルセレクター */
.enemy-level-selector {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-md);
}

.level-slider {
    flex: 1;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-secondary);
    border-radius: 4px;
    outline: none;
}

.level-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    background: var(--color-accent);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s;
}

.level-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.level-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    background: var(--color-accent);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.level-display {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    min-width: 80px;
}

.level-label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.level-input {
    width: 50px;
    padding: var(--space-xs) var(--space-sm);
    font-size: 1.25rem;
    font-weight: 700;
    text-align: center;
    background: var(--bg-secondary);
    border: 2px solid var(--color-accent);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    outline: none;
}

.level-input:focus {
    box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.3);
}

/* スピンボタンを非表示 */
.level-input::-webkit-outer-spin-button,
.level-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.level-input[type=number] {
    -moz-appearance: textfield;
}

.level-presets {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    justify-content: center;
}

.preset-btn {
    padding: var(--space-xs) var(--space-md);
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.preset-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--color-accent);
}

.preset-btn:active {
    transform: scale(0.95);
}

.option-icon img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: 8px;
}

.option-icon.emoji-fallback::after {
    content: attr(data-fallback);
    font-size: 2rem;
}

.option-icon.emoji-fallback img {
    display: none;
}

.option-label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
}

.option-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* セットアップオプション（Step形式） */
.setup-options {
    display: flex;
    gap: var(--space-sm);
}

/* 大きいアイコン用のオプショングリッド */
.setup-options.large-icons {
    gap: var(--space-md);
}

.setup-options.large-icons .option-card {
    padding: var(--space-md) var(--space-sm);
    min-height: 140px;
}

/* 無効化状態のオプションカード */
.option-card.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.option-card.disabled:hover {
    transform: none;
    box-shadow: var(--shadow-sm);
}

/* 準備中バッジ */
.coming-soon {
    display: inline-block;
    font-size: 0.625rem;
    padding: 2px 6px;
    background: var(--color-warning, #f59e0b);
    color: #000;
    border-radius: 8px;
    font-weight: 700;
    margin-top: 4px;
}

/* バトル開始ボタンエリア */
.battle-start-actions {
    margin-top: auto;
    padding-top: var(--space-md);
}

#start-battle-btn {
    width: 100%;
    padding: var(--space-md) var(--space-lg);
    font-size: 1.125rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-dark) 100%);
    border: none;
    border-radius: var(--radius-lg);
    color: var(--bg-primary);
    box-shadow: 0 4px 12px rgba(201, 162, 39, 0.4);
    transition: all 0.2s ease;
}

#start-battle-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(201, 162, 39, 0.5);
}

#start-battle-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(201, 162, 39, 0.3);
}

/* =====================
   Battle Screen
   ===================== */
#battle-screen.active {
    padding: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-color: var(--bg-body);
}

.battle-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px var(--space-sm);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--bg-card);
    position: sticky;
    top: 0;
    z-index: 100;
    min-height: 36px;
}

.turn-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.turn-label {
    font-size: 0.625rem;
    color: var(--text-muted);
}

.turn-number {
    font-size: 1.1rem;
    font-weight: 700;
    font-family: var(--font-tabular);
}

.actor-pin {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.actor-portrait {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 2px solid var(--color-primary);
}

.actor-name {
    font-size: 0.875rem;
    font-weight: 500;
}

.resource-meter {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    background: var(--bg-card);
    border-radius: var(--radius-md);
}

.resource-icon {
    font-size: 1rem;
    display: flex;
    align-items: center;
}

.resource-icon img {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

.resource-value {
    font-family: var(--font-tabular);
    font-size: 0.875rem;
}

/* Battle Log in Topbar */
.battle-log-topbar {
    position: relative;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(251, 232, 214, 0.2);
    border-radius: var(--radius-sm);
    min-width: 50px;
    cursor: pointer;
}

.battle-log-topbar .log-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.75rem;
    color: var(--text-secondary);
    gap: var(--space-xs);
}

.battle-log-topbar .log-toggle {
    font-size: 0.625rem;
    transition: transform 0.3s;
}

.battle-log-topbar.collapsed .log-toggle {
    transform: rotate(180deg);
}

.battle-log-topbar .log-content {
    position: absolute;
    top: 100%;
    right: 0;
    width: 280px;
    max-height: 200px;
    overflow-y: auto;
    background: var(--bg-secondary);
    border: 1px solid var(--bg-card);
    border-radius: var(--radius-sm);
    padding: var(--space-sm);
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.battle-log-topbar.collapsed .log-content {
    display: none;
}

/* Battle Log Panel */
.battle-log {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 0;
    overflow: hidden;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    transition: max-height 0.3s ease;
    z-index: 200;
}

.battle-log.expanded {
    max-height: 40vh;
    overflow-y: auto;
}

.battle-log-content {
    padding: var(--space-md);
    font-size: 0.85rem;
    color: var(--text-primary);
}

.battle-log-content .log-entry {
    padding: var(--space-xs) 0;
    border-bottom: 1px solid var(--border-color);
}

.battle-log-content .log-entry:last-child {
    border-bottom: none;
}

.battle-log-content .log-entry {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    align-items: center;
}

.battle-log-content .log-turn {
    font-weight: 600;
    color: var(--color-accent);
    font-size: 0.75rem;
}

.battle-log-content .log-actor {
    font-weight: 600;
    font-size: 0.75rem;
    padding: 1px 6px;
    border-radius: var(--radius-sm);
}

.battle-log-content .log-actor.player {
    background: var(--color-info);
    color: white;
}

.battle-log-content .log-actor.opponent {
    background: var(--color-danger);
    color: white;
}

.battle-log-content .log-message {
    font-size: 0.8rem;
    color: var(--text-primary);
}

/* Battle Field */
.battle-field {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-sm);
    padding-bottom: 200px; /* アクションドック用の余白（可変高さ対応） */
    gap: var(--space-sm);
    overflow-y: auto;
    min-height: 0; /* flexbox内でスクロール可能にする */
}

.party-bar,
.party-row {
    display: flex;
    gap: var(--space-sm);
    justify-content: center;
    width: 100%;
}

.party-container {
    display: flex;
    gap: var(--space-sm);
    justify-content: center;
    flex-wrap: wrap;
}

.party-bar.enemy,
.party-row.enemy-row {
    /* 敵は上部 */
}

.party-bar.ally,
.party-row.ally-row {
    /* 味方は下部 */
}

/* Party Member Cards - MEMORICA Style */
.party-member {
    width: 80px;
    min-width: 70px;
    flex-shrink: 0;
    background: linear-gradient(145deg, var(--bg-card) 0%, rgba(21, 74, 74, 0.95) 100%);
    border-radius: var(--radius-md);
    padding: var(--space-xs);
    position: relative;
    cursor: pointer;
    border: 1px solid rgba(251, 232, 214, 0.1);
    transition: all 0.2s ease-out;
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

/* カード背景画像サポート */
.party-member[style*="--card-bg-image"] {
    background: var(--card-bg-image) center/cover no-repeat;
}

.party-member .card-bg-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0.5) 100%);
    pointer-events: none;
    z-index: 0;
}

.party-member > *:not(.card-bg-overlay) {
    position: relative;
    z-index: 1;
}

/* 大きい画面ではカードを大きく */
@media (min-height: 700px) {
    .party-member {
        width: 90px;
    }
}

.party-member:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: rgba(251, 232, 214, 0.2);
}

.party-member:active {
    transform: scale(0.97);
    transition: all 0.05s ease-out;
}

/* 現在行動中のキャラクター - 明確な青枠とアニメーション */
.party-member.current-actor {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px #3b82f6, 0 0 20px rgba(59, 130, 246, 0.6);
    transform: translateY(-4px) scale(1.05);
    animation: currentActorPulse 1.5s ease-in-out infinite;
}

.party-member.current-actor:hover {
    transform: translateY(-6px) scale(1.05);
}

.party-member.current-actor::before {
    content: '▶';
    position: absolute;
    top: -18px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.8rem;
    color: #3b82f6;
    text-shadow: 0 0 8px rgba(59, 130, 246, 0.8);
    animation: actorArrowBounce 0.8s ease-in-out infinite;
    z-index: 10;
}

@keyframes currentActorPulse {
    0%, 100% { box-shadow: 0 0 0 3px #3b82f6, 0 0 20px rgba(59, 130, 246, 0.6); }
    50% { box-shadow: 0 0 0 4px #3b82f6, 0 0 30px rgba(59, 130, 246, 0.8); }
}

@keyframes actorArrowBounce {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(-4px); }
}

.party-member.switchable {
    border-color: var(--color-success);
    box-shadow: 0 0 0 1px var(--color-success), var(--shadow-card);
    cursor: pointer;
}

.party-member.switchable:hover {
    box-shadow: 0 0 0 2px var(--color-success), var(--shadow-hover);
    transform: translateY(-3px);
}

.party-member.switchable::after {
    content: '⇄';
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--color-success);
    color: var(--text-dark);
    font-size: 0.75rem;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 700;
    line-height: 1;
}

/* 選択中のターゲット - オレンジ枠で明確に表示 */
.party-member.selected-target {
    border-color: #f97316;
    box-shadow: 0 0 0 3px #f97316, 0 0 20px rgba(249, 115, 22, 0.5);
    transform: scale(1.05);
    animation: selectedTargetPulse 1s ease-in-out infinite;
}

.party-member.selected-target::after {
    content: 'TARGET';
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    background: #f97316;
    color: white;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    white-space: nowrap;
    z-index: 10;
}

@keyframes selectedTargetPulse {
    0%, 100% { box-shadow: 0 0 0 3px #f97316, 0 0 20px rgba(249, 115, 22, 0.5); }
    50% { box-shadow: 0 0 0 4px #f97316, 0 0 30px rgba(249, 115, 22, 0.7); }
}

/* 選択可能なターゲット（軽いハイライト） */
.party-member.targeted {
    cursor: pointer;
}

.party-member.targeted:not(.selected-target) {
    border-color: rgba(249, 115, 22, 0.5);
    box-shadow: 0 0 0 1px rgba(249, 115, 22, 0.5);
}

.party-member.targeted:not(.selected-target):hover {
    border-color: #f97316;
    box-shadow: 0 0 0 2px #f97316, 0 0 10px rgba(249, 115, 22, 0.4);
    transform: translateY(-2px);
}

.party-member.down {
    opacity: 0.8;
}

/* 戦闘不能時の棺表示 */
.party-member.down .member-portrait img {
    display: none;
}

.party-member.down .member-portrait::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70%;
    height: 90%;
    background: url('/assets/images/ui/coffin.svg') no-repeat center center;
    background-size: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
    animation: coffinAppear 0.5s ease-out;
}

.party-member.down .member-portrait {
    position: relative;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.4) 0%, rgba(0, 0, 0, 0.6) 100%);
}

@keyframes coffinAppear {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5) rotate(-10deg);
    }
    60% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.1) rotate(3deg);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1) rotate(0deg);
    }
}

/* 味方の行動済み - プレイヤーターン中のみ視覚的にマーク */
.party-bar.ally .party-member.acted {
    opacity: 0.5;
}

.party-bar.ally .party-member.acted::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-lg);
    pointer-events: none;
    z-index: 1;
}

/* 敵の行動済み - 視認性維持 */
.party-bar.enemy .party-member.acted {
    opacity: 1;
}

.party-bar.enemy .party-member.acted::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.1);
    border-radius: var(--radius-lg);
    pointer-events: none;
    z-index: 1;
}

.acted-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(100, 100, 100, 0.85);
    color: #fff;
    font-size: 0.6rem;
    z-index: 3;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-weight: bold;
    letter-spacing: 0.05em;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* 攻撃・スキル発動アニメーション */
.party-member.attacking {
    z-index: 100;
    animation: attackMove 0.6s ease-out;
}

.party-bar.ally .party-member.attacking {
    animation: attackMoveUp 0.6s ease-out;
}

.party-bar.enemy .party-member.attacking {
    animation: attackMoveDown 0.6s ease-out;
}

@keyframes attackMoveUp {
    0% { transform: translateY(0) scale(1); }
    30% { transform: translateY(-40px) scale(1.15); }
    50% { transform: translateY(-50px) scale(1.2); box-shadow: 0 0 20px var(--color-accent); }
    70% { transform: translateY(-40px) scale(1.15); }
    100% { transform: translateY(0) scale(1); }
}

@keyframes attackMoveDown {
    0% { transform: translateY(0) scale(1); }
    30% { transform: translateY(40px) scale(1.15); }
    50% { transform: translateY(50px) scale(1.2); box-shadow: 0 0 20px var(--color-accent); }
    70% { transform: translateY(40px) scale(1.15); }
    100% { transform: translateY(0) scale(1); }
}

/* 被ダメージアニメーション */
.party-member.hit {
    animation: hitShake 0.4s ease-out;
}

@keyframes hitShake {
    0%, 100% { filter: brightness(1); }
    15% { filter: brightness(2) saturate(0.3); }
    30% { filter: brightness(0.6) saturate(1.5) hue-rotate(-10deg); }
    50% { filter: brightness(1.5) saturate(0.5); }
    70% { filter: brightness(0.8) saturate(1.2); }
}

/* スキル発動エフェクト */
.party-member.skill-active {
    animation: skillGlow 0.8s ease-out;
}

@keyframes skillGlow {
    0% { transform: scale(1); box-shadow: 0 0 0 rgba(155, 123, 184, 0); }
    30% { transform: scale(1.1); box-shadow: 0 0 30px rgba(155, 123, 184, 0.8); }
    60% { transform: scale(1.15); box-shadow: 0 0 40px rgba(155, 123, 184, 1); }
    100% { transform: scale(1); box-shadow: 0 0 0 rgba(155, 123, 184, 0); }
}

/* キャラクター飛び出しエフェクト */
.character-popup-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.character-popup {
    position: absolute;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    overflow: hidden;
    border: 4px solid var(--kingdom-color, var(--color-accent));
    box-shadow:
        0 0 30px var(--kingdom-glow, rgba(155, 123, 184, 0.8)),
        0 0 60px var(--kingdom-glow, rgba(155, 123, 184, 0.5)),
        inset 0 0 20px rgba(0,0,0,0.5);
    animation: characterPopup 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    background: radial-gradient(circle, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0.7) 100%);
}

.character-popup img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
}

.character-popup .skill-name {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    font-size: 0.9rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 0 10px var(--kingdom-glow, rgba(155, 123, 184, 1)),
                 0 2px 4px rgba(0,0,0,0.8);
    animation: skillNameFade 0.8s ease-out forwards;
}

/* 王国別のカラー */
.character-popup.kingdom-flamecrest {
    --kingdom-color: #ff4d2a;
    --kingdom-glow: rgba(255, 77, 42, 0.8);
    border-color: #ff4d2a;
}

.character-popup.kingdom-crystalbloom {
    --kingdom-color: #bf6dff;
    --kingdom-glow: rgba(191, 109, 255, 0.8);
    border-color: #bf6dff;
}

.character-popup.kingdom-ironblood {
    --kingdom-color: #7a8899;
    --kingdom-glow: rgba(122, 136, 153, 0.8);
    border-color: #7a8899;
}

.character-popup.kingdom-abyssal {
    --kingdom-color: #00a8cc;
    --kingdom-glow: rgba(0, 168, 204, 0.8);
    border-color: #00a8cc;
}

.character-popup.kingdom-sentinel {
    --kingdom-color: #6b7280;
    --kingdom-glow: rgba(107, 114, 128, 0.8);
    border-color: #6b7280;
}

@keyframes characterPopup {
    0% {
        opacity: 0;
        transform: scale(0.3) translateY(50px);
    }
    30% {
        opacity: 1;
        transform: scale(1.2) translateY(-20px);
    }
    50% {
        transform: scale(1.1) translateY(-10px);
    }
    70% {
        transform: scale(1.15) translateY(-15px);
    }
    85% {
        opacity: 1;
        transform: scale(1.1) translateY(-10px);
    }
    100% {
        opacity: 0;
        transform: scale(0.8) translateY(30px);
    }
}

@keyframes skillNameFade {
    0% { opacity: 0; transform: translateX(-50%) translateY(10px); }
    30% { opacity: 1; transform: translateX(-50%) translateY(0); }
    70% { opacity: 1; transform: translateX(-50%) translateY(0); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-10px); }
}

/* 回復エフェクト */
.party-member.healing {
    animation: healGlow 0.6s ease-out;
}

@keyframes healGlow {
    0% { box-shadow: 0 0 0 rgba(92, 184, 92, 0); }
    50% { box-shadow: 0 0 25px rgba(92, 184, 92, 1); }
    100% { box-shadow: 0 0 0 rgba(92, 184, 92, 0); }
}

/* 物理攻撃突進アニメーション */
.party-member.attack-rush-up {
    z-index: 100;
    animation: attackRushUp 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.party-member.attack-rush-down {
    z-index: 100;
    animation: attackRushDown 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@keyframes attackRushUp {
    0% { transform: translateY(0) scale(1); }
    15% { transform: translateY(5px) scale(0.95); }
    40% { transform: translateY(-60px) scale(1.1); box-shadow: 0 0 20px var(--color-danger); }
    50% { transform: translateY(-70px) scale(1.15); box-shadow: 0 0 30px var(--color-danger); }
    60% { transform: translateY(-60px) scale(1.1); }
    100% { transform: translateY(0) scale(1); box-shadow: none; }
}

@keyframes attackRushDown {
    0% { transform: translateY(0) scale(1); }
    15% { transform: translateY(-5px) scale(0.95); }
    40% { transform: translateY(60px) scale(1.1); box-shadow: 0 0 20px var(--color-danger); }
    50% { transform: translateY(70px) scale(1.15); box-shadow: 0 0 30px var(--color-danger); }
    60% { transform: translateY(60px) scale(1.1); }
    100% { transform: translateY(0) scale(1); box-shadow: none; }
}

/* 魔法攻撃発光アニメーション */
.party-member.magic-cast {
    z-index: 100;
    animation: magicCast 0.6s ease-out;
}

@keyframes magicCast {
    0% { transform: scale(1); box-shadow: 0 0 0 rgba(138, 90, 181, 0); }
    20% { transform: scale(1.05); box-shadow: 0 0 15px rgba(138, 90, 181, 0.5); }
    40% { transform: scale(1.1); box-shadow: 0 0 30px rgba(138, 90, 181, 0.8); }
    60% { transform: scale(1.05); box-shadow: 0 0 40px rgba(138, 90, 181, 1); filter: brightness(1.3); }
    100% { transform: scale(1); box-shadow: 0 0 0 rgba(138, 90, 181, 0); filter: brightness(1); }
}

/* アクション名ラベル */
.action-label {
    position: fixed;
    top: 40%;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 20px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: var(--radius-md);
    z-index: 500;
    animation: actionLabelAnim 0.8s ease-out forwards;
    white-space: nowrap;
}

.action-label.player {
    border: 2px solid var(--color-info);
    text-shadow: 0 0 10px var(--color-info);
}

.action-label.opponent {
    border: 2px solid var(--color-danger);
    text-shadow: 0 0 10px var(--color-danger);
}

@keyframes actionLabelAnim {
    0% { opacity: 0; transform: translateX(-50%) translateY(20px) scale(0.8); }
    20% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1.1); }
    40% { transform: translateX(-50%) translateY(-5px) scale(1); }
    70% { opacity: 1; }
    100% { opacity: 0; transform: translateX(-50%) translateY(-20px); }
}

/* ヒットエフェクト */
.hit-effect {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    z-index: 200;
    animation: hitEffectAnim 0.5s ease-out forwards;
    pointer-events: none;
}

.hit-effect.critical {
    font-size: 2.5rem;
    animation: hitEffectCritical 0.5s ease-out forwards;
}

@keyframes hitEffectAnim {
    0% { opacity: 1; transform: translate(-50%, -50%) scale(0.5); }
    50% { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(1.5); }
}

@keyframes hitEffectCritical {
    0% { opacity: 1; transform: translate(-50%, -50%) scale(0.5) rotate(0deg); }
    50% { opacity: 1; transform: translate(-50%, -50%) scale(1.5) rotate(15deg); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(2) rotate(-15deg); }
}

/* エフェクトエリア アクション名表示 */
.effect-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 20px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    animation: effectContainerPop 1.2s ease-out forwards;
}

.effect-actor-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    margin-bottom: 2px;
    letter-spacing: 0.03em;
}

.effect-details {
    display: flex;
    flex-direction: column;
    gap: 3px;
    align-items: center;
}

.effect-detail-line {
    font-size: 0.85rem;
    font-weight: 600;
    color: #a5f3a5;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

.effect-action-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
    letter-spacing: 0.05em;
}

/* アクションタイプ別の色分け */
.effect-action-name.attack-type {
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.15);
    border: 1px solid rgba(255, 107, 107, 0.3);
}

.effect-action-name.magic-type {
    color: #a78bfa;
    background: rgba(167, 139, 250, 0.15);
    border: 1px solid rgba(167, 139, 250, 0.3);
}

.effect-action-name.skill-type {
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.15);
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.effect-action-name.heal-type {
    color: #34d399;
    background: rgba(52, 211, 153, 0.15);
    border: 1px solid rgba(52, 211, 153, 0.3);
}

@keyframes effectContainerPop {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(10px);
    }
    15% {
        opacity: 1;
        transform: scale(1.05) translateY(-5px);
    }
    30% {
        transform: scale(1) translateY(0);
    }
    80% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
    100% {
        opacity: 0;
        transform: scale(0.9) translateY(-10px);
    }
}

.party-member .portrait,
.party-member .member-portrait {
    width: 100%;
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.party-member .portrait img,
.party-member .member-portrait img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.party-member .name,
.party-member .member-name {
    font-size: 0.6rem;
    text-align: center;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 詳細ボタン */
.party-member .member-stats-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(251, 232, 214, 0.3);
    color: var(--color-accent);
    font-size: 0.65rem;
    font-weight: 700;
    font-style: italic;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.party-member .member-stats-btn:hover {
    background: rgba(251, 232, 214, 0.2);
    transform: scale(1.1);
}

/* レベル表示 */
.party-member .member-level {
    position: absolute;
    top: 2px;
    left: 2px;
    background: linear-gradient(135deg, rgba(186, 73, 73, 0.9), rgba(139, 69, 19, 0.9));
    color: white;
    font-size: 0.5rem;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: var(--radius-sm);
    z-index: 10;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.party-member .hp-bar {
    height: 4px;
    background: var(--bg-card);
    border-radius: var(--radius-full);
    margin-top: 2px;
    position: relative;
    overflow: hidden;
}

.party-member .hp-bar-fill,
.party-member .hp-fill {
    height: 100%;
    background: var(--color-success);
    transition: width 0.3s;
}

.party-member .hp-bar-fill.low,
.party-member .hp-fill.low {
    background: var(--color-danger);
}

.party-member .hp-bar-fill.medium,
.party-member .hp-fill.medium {
    background: var(--color-warning);
}

.party-member .hp-text {
    display: block;
    font-size: 0.5rem;
    text-align: center;
    color: var(--text-secondary);
    font-family: var(--font-tabular);
    margin-top: 2px;
}

.party-member .mp-text {
    display: block;
    font-size: 0.5rem;
    text-align: center;
    color: #4a90d9;
    font-family: var(--font-tabular);
    margin-top: 2px;
}

/* Level Badge */
.party-member .level-badge {
    position: absolute;
    top: 2px;
    left: 2px;
    background: linear-gradient(135deg, var(--color-legendary), var(--color-epic));
    color: white;
    font-size: 0.5rem;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: var(--radius-sm);
    z-index: 2;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* MP Bar */
.party-member .mp-bar {
    height: 4px;
    background: var(--bg-card);
    border-radius: var(--radius-full);
    margin-top: 2px;
    overflow: hidden;
    position: relative;
}

.party-member .mp-bar-fill,
.party-member .mp-fill {
    height: 100%;
    background: linear-gradient(90deg, #4a90d9, #7eb3e8);
    transition: width 0.3s;
}

/* HP/MP Text Row */
.party-member .hp-mp-text {
    display: flex;
    justify-content: space-between;
    font-size: 0.45rem;
    color: var(--text-secondary);
    font-family: var(--font-tabular);
    margin-top: 1px;
    padding: 0 2px;
}

.party-member .hp-text-small {
    color: var(--color-success);
}

.party-member .mp-text-small {
    color: #4a90d9;
}

.party-member .status-labels {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    justify-content: center;
    margin-top: 3px;
    z-index: 5;
}

.party-member .status-label {
    font-size: 0.55rem;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: var(--radius-sm);
    line-height: 1.2;
    border: 1px solid rgba(255, 255, 255, 0.3);
    white-space: nowrap;
    color: #fff;
    background: rgba(0, 0, 0, 0.8);
}

/* バフ効果（緑系） */
.party-member .status-label.buff {
    background: rgba(34, 139, 34, 0.85);
    border-color: rgba(50, 205, 50, 0.6);
}

/* デバフ効果（紫系） */
.party-member .status-label.debuff {
    background: rgba(138, 43, 226, 0.85);
    border-color: rgba(186, 85, 211, 0.6);
}

/* 状態異常（赤/オレンジ系） */
.party-member .status-label.ailment {
    background: rgba(220, 20, 60, 0.85);
    border-color: rgba(255, 99, 71, 0.6);
    animation: ailment-pulse 1.5s ease-in-out infinite;
}

@keyframes ailment-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* 元素ブースト */
.party-member .status-label.element-boost {
    font-size: 0.5rem;
}

.party-member .status-label.element-boost.contained {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.9), rgba(255, 165, 0, 0.9));
    border-color: rgba(255, 215, 0, 0.8);
    color: #333;
}

.party-member .status-label.element-boost.other {
    background: linear-gradient(135deg, rgba(160, 82, 45, 0.9), rgba(139, 69, 19, 0.9));
    border-color: rgba(160, 82, 45, 0.8);
}

/* 新規適用ステータスエフェクトアニメーション */
@keyframes statusPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}
.party-member .status-label.newly-applied.buff {
    animation: statusPulse 0.6s ease-in-out 2;
    text-shadow: 0 0 6px rgba(251, 191, 36, 0.6);
}
.party-member .status-label.newly-applied.debuff {
    animation: statusPulse 0.6s ease-in-out 2;
    text-shadow: 0 0 6px rgba(239, 68, 68, 0.6);
}
.party-member .status-label.newly-applied.ailment {
    animation: statusPulse 0.6s ease-in-out 2;
    text-shadow: 0 0 6px rgba(168, 85, 247, 0.6);
}

/* 元素バッジ */
.party-member .element-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    justify-content: center;
    margin-top: var(--space-xs);
    max-width: 100%;
}

.party-member .element-badge {
    font-size: 0.5rem;
    font-weight: 700;
    padding: 1px 3px;
    border-radius: var(--radius-sm);
    color: white;
    background: var(--color-uncommon);
    line-height: 1;
}

.party-member .element-badge.contained {
    background: var(--color-legendary);
}

.party-member .element-badge.none {
    background: var(--text-disabled);
}

/* エフェクト表示エリア */
.effect-area,
.battle-effect-area {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    min-height: 60px;
    min-width: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    pointer-events: none;
}

.effect-text {
    font-size: 1.8rem;
    font-weight: 700;
    animation: effectDamagePop 0.8s ease-out forwards;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8),
                 0 0 20px currentColor;
    padding: 4px 0;
}

@keyframes effectDamagePop {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }
    30% {
        opacity: 1;
        transform: scale(1.15);
    }
    60% {
        transform: scale(1);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.effect-text.damage {
    color: var(--color-danger);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8),
                 0 0 20px rgba(239, 68, 68, 0.6);
}

.effect-text.heal {
    color: var(--color-success);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8),
                 0 0 20px rgba(34, 197, 94, 0.6);
}

.effect-text.buff {
    color: var(--color-accent);
    font-size: 1.4rem;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8),
                 0 0 20px rgba(201, 162, 39, 0.6);
}

.effect-text.miss {
    color: #93c5fd;
    font-size: 1.6rem;
    font-style: italic;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8),
                 0 0 20px rgba(147, 197, 253, 0.5);
}

.effect-text.reflect {
    color: #c084fc;
    font-size: 1.4rem;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8),
                 0 0 25px rgba(192, 132, 252, 0.8);
    animation: reflectPulse 0.8s ease-out forwards;
}

.effect-action-name.reflect-type {
    color: #c084fc;
    font-size: 1.6rem;
    text-shadow: 0 0 20px rgba(192, 132, 252, 0.8);
}

.effect-container.reflect-effect {
    animation: reflectAppear 0.5s ease-out forwards;
}

@keyframes reflectPulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes reflectAppear {
    0% { transform: scale(0.5) rotate(-10deg); opacity: 0; }
    50% { transform: scale(1.1) rotate(5deg); opacity: 1; }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* Counter attack effect */
.effect-container.counter-effect {
    animation: counterFlash 0.5s ease-out;
    border: 2px solid rgba(239, 68, 68, 0.6);
    border-radius: var(--radius-md);
    padding: var(--space-sm);
    background: rgba(239, 68, 68, 0.15);
}

@keyframes counterFlash {
    0% { opacity: 0; transform: scale(1.2); }
    100% { opacity: 1; transform: scale(1); }
}

/* ========================================
   派手なスキルエフェクト
   ======================================== */

/* スキルエフェクトオーバーレイ */
.skill-effect-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 150;
    overflow: hidden;
}

/* 王国別スクリーンフラッシュ */
.screen-flash {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    animation: screenFlash 0.5s ease-out forwards;
}

.screen-flash.flamecrest { background: radial-gradient(circle, rgba(239, 68, 68, 0.6) 0%, transparent 70%); }
.screen-flash.abyssal { background: radial-gradient(circle, rgba(59, 130, 246, 0.6) 0%, transparent 70%); }
.screen-flash.crystalbloom { background: radial-gradient(circle, rgba(168, 85, 247, 0.6) 0%, transparent 70%); }
.screen-flash.ironblood { background: radial-gradient(circle, rgba(245, 158, 11, 0.6) 0%, transparent 70%); }

/* スキルタイプ別フラッシュ */
.screen-flash.attack { background: radial-gradient(circle, rgba(239, 68, 68, 0.7) 0%, transparent 70%); }
.screen-flash.heal { background: radial-gradient(circle, rgba(34, 197, 94, 0.6) 0%, transparent 70%); }
.screen-flash.buff { background: radial-gradient(circle, rgba(251, 191, 36, 0.6) 0%, transparent 70%); }
.screen-flash.debuff { background: radial-gradient(circle, rgba(139, 92, 246, 0.7) 0%, transparent 70%); }

@keyframes screenFlash {
    0% { opacity: 0; }
    20% { opacity: 1; }
    100% { opacity: 0; }
}

/* パーティクルコンテナ */
.skill-particles {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 300px;
    height: 300px;
}

/* パーティクル */
.skill-particle {
    position: absolute;
    border-radius: 50%;
    animation: particleExplode 1s ease-out forwards;
}

/* 王国別パーティクルカラー */
.skill-particle.flamecrest { background: radial-gradient(circle, #fbbf24 0%, #ef4444 50%, transparent 100%); box-shadow: 0 0 10px #ef4444; }
.skill-particle.abyssal { background: radial-gradient(circle, #93c5fd 0%, #3b82f6 50%, transparent 100%); box-shadow: 0 0 10px #3b82f6; }
.skill-particle.crystalbloom { background: radial-gradient(circle, #e9d5ff 0%, #a855f7 50%, transparent 100%); box-shadow: 0 0 10px #a855f7; }
.skill-particle.ironblood { background: radial-gradient(circle, #fde68a 0%, #f59e0b 50%, transparent 100%); box-shadow: 0 0 10px #f59e0b; }

/* スキルタイプ別パーティクル */
.skill-particle.attack-type { background: radial-gradient(circle, #fbbf24 0%, #ef4444 50%, transparent 100%); }
.skill-particle.heal-type { background: radial-gradient(circle, #86efac 0%, #22c55e 50%, transparent 100%); }
.skill-particle.buff-type { background: radial-gradient(circle, #fef08a 0%, #eab308 50%, transparent 100%); }
.skill-particle.debuff-type { background: radial-gradient(circle, #c4b5fd 0%, #8b5cf6 50%, transparent 100%); }

@keyframes particleExplode {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 1;
    }
    100% {
        transform: translate(var(--tx), var(--ty)) scale(1);
        opacity: 0;
    }
}

/* スキル名表示（派手版） */
.skill-name-display {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    font-weight: 900;
    text-align: center;
    white-space: nowrap;
    animation: skillNameAppear 1.2s ease-out forwards;
    z-index: 160;
}

.skill-name-display.flamecrest {
    color: #fbbf24;
    text-shadow: 0 0 20px #ef4444, 0 0 40px #ef4444, 0 0 60px #dc2626, 0 4px 8px rgba(0,0,0,0.8);
}
.skill-name-display.abyssal {
    color: #93c5fd;
    text-shadow: 0 0 20px #3b82f6, 0 0 40px #3b82f6, 0 0 60px #1d4ed8, 0 4px 8px rgba(0,0,0,0.8);
}
.skill-name-display.crystalbloom {
    color: #e9d5ff;
    text-shadow: 0 0 20px #a855f7, 0 0 40px #a855f7, 0 0 60px #7c3aed, 0 4px 8px rgba(0,0,0,0.8);
}
.skill-name-display.ironblood {
    color: #fde68a;
    text-shadow: 0 0 20px #f59e0b, 0 0 40px #f59e0b, 0 0 60px #d97706, 0 4px 8px rgba(0,0,0,0.8);
}

/* スキルタイプ別スキル名 */
.skill-name-display.attack-type {
    color: #fca5a5;
    text-shadow: 0 0 20px #ef4444, 0 0 40px #dc2626, 0 4px 8px rgba(0,0,0,0.8);
}
.skill-name-display.heal-type {
    color: #86efac;
    text-shadow: 0 0 20px #22c55e, 0 0 40px #16a34a, 0 4px 8px rgba(0,0,0,0.8);
}
.skill-name-display.buff-type {
    color: #fef08a;
    text-shadow: 0 0 20px #eab308, 0 0 40px #ca8a04, 0 4px 8px rgba(0,0,0,0.8);
}
.skill-name-display.debuff-type {
    color: #c4b5fd;
    text-shadow: 0 0 20px #8b5cf6, 0 0 40px #7c3aed, 0 4px 8px rgba(0,0,0,0.8);
}

@keyframes skillNameAppear {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.3);
        filter: blur(10px);
    }
    20% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.3);
        filter: blur(0);
    }
    40% {
        transform: translate(-50%, -50%) scale(1);
    }
    80% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1.1);
    }
}

/* 攻撃エフェクト - 爆発 */
.explosion-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 4px solid;
    animation: explosionExpand 0.6s ease-out forwards;
}

.explosion-ring.flamecrest { border-color: #ef4444; box-shadow: 0 0 30px #ef4444; }
.explosion-ring.abyssal { border-color: #3b82f6; box-shadow: 0 0 30px #3b82f6; }
.explosion-ring.crystalbloom { border-color: #a855f7; box-shadow: 0 0 30px #a855f7; }
.explosion-ring.ironblood { border-color: #f59e0b; box-shadow: 0 0 30px #f59e0b; }

@keyframes explosionExpand {
    0% {
        width: 20px;
        height: 20px;
        opacity: 1;
    }
    100% {
        width: 300px;
        height: 300px;
        opacity: 0;
    }
}

/* 回復エフェクト - 輝く光 */
.heal-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(34, 197, 94, 0.8) 0%, rgba(34, 197, 94, 0.3) 40%, transparent 70%);
    animation: healPulse 1s ease-out forwards;
}

@keyframes healPulse {
    0% { transform: translate(-50%, -50%) scale(0.3); opacity: 0; }
    30% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1.5); opacity: 0; }
}

/* デバフエフェクト - 暗黒オーラ */
.debuff-aura {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 250px;
    height: 250px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.6) 0%, rgba(88, 28, 135, 0.4) 50%, transparent 70%);
    animation: debuffSwirl 1s ease-out forwards;
}

@keyframes debuffSwirl {
    0% { transform: translate(-50%, -50%) scale(0.5) rotate(0deg); opacity: 0; }
    50% { transform: translate(-50%, -50%) scale(1.1) rotate(180deg); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1.3) rotate(360deg); opacity: 0; }
}

/* 上昇する光の粒子（回復用） */
.rising-particle {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 10px #22c55e, 0 0 20px #86efac;
    animation: riseAndFade 1.5s ease-out forwards;
}

@keyframes riseAndFade {
    0% { transform: translateY(0) scale(1); opacity: 1; }
    100% { transform: translateY(-150px) scale(0.3); opacity: 0; }
}

/* 落下する暗い粒子（デバフ用） */
.falling-particle {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #8b5cf6;
    box-shadow: 0 0 8px #8b5cf6;
    animation: fallAndFade 1s ease-in forwards;
}

@keyframes fallAndFade {
    0% { transform: translateY(0) scale(1); opacity: 1; }
    100% { transform: translateY(100px) scale(0.5); opacity: 0; }
}

.effect-text.critical {
    color: var(--color-legendary);
    font-size: 2.2rem;
    animation: criticalDamagePop 1s ease-out forwards;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8),
                 0 0 30px rgba(255, 215, 0, 0.8);
}

@keyframes criticalDamagePop {
    0% {
        opacity: 0;
        transform: scale(0.3) rotate(-5deg);
    }
    20% {
        opacity: 1;
        transform: scale(1.3) rotate(3deg);
    }
    40% {
        transform: scale(1.1) rotate(-2deg);
    }
    60% {
        transform: scale(1.2) rotate(1deg);
    }
    80% {
        transform: scale(1.1) rotate(0deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

.effect-text.element-buff {
    color: var(--color-epic);
    font-size: 1.25rem;
    white-space: pre-line;
    text-align: center;
}

@keyframes effectPop {
    0% {
        opacity: 0;
        transform: scale(0.5) translateY(20px);
    }
    30% {
        opacity: 1;
        transform: scale(1.2) translateY(-10px);
    }
    60% {
        transform: scale(1) translateY(0);
    }
    100% {
        opacity: 0;
        transform: scale(0.8) translateY(-20px);
    }
}

@keyframes criticalPop {
    0% {
        opacity: 0;
        transform: scale(0.3) rotate(-10deg);
    }
    20% {
        opacity: 1;
        transform: scale(1.5) rotate(5deg);
    }
    40% {
        transform: scale(1.2) rotate(-3deg);
    }
    60% {
        transform: scale(1.3) rotate(2deg);
    }
    80% {
        opacity: 1;
        transform: scale(1.1) rotate(0deg);
    }
    100% {
        opacity: 0;
        transform: scale(0.8) translateY(-30px);
    }
}

/* ステータスパネル - 詳細表示 */
.stats-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 200;
    background: rgba(15, 40, 40, 0.98);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(251, 232, 214, 0.2);
    min-width: 300px;
    max-width: 360px;
    max-height: 80vh;
    overflow-y: auto;
}

.stats-panel.hidden {
    display: none;
}

.stats-panel-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(251, 232, 214, 0.1);
}

.stats-panel-header span:first-child {
    flex: 1;
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-accent);
}

.stats-panel-header .stats-level {
    background: linear-gradient(135deg, var(--color-legendary), var(--color-epic));
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
}

.stats-panel-header button {
    background: rgba(220, 38, 38, 0.3);
    border: none;
    color: #ef4444;
    font-size: 1rem;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
}

.stats-panel-content {
    padding: var(--space-sm) var(--space-md);
}

.stats-section {
    margin-bottom: var(--space-sm);
}

.stats-section:last-child {
    margin-bottom: 0;
}

.stats-title {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: var(--space-xs);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* HP/MP バー */
.stats-bars {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stat-bar-row {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.stat-bar-row .stat-label {
    width: 24px;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
}

.stat-bar-container {
    flex: 1;
    height: 12px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.stat-bar-fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 0.3s ease;
}

.stat-bar-fill.hp {
    background: linear-gradient(90deg, var(--color-success), #7dd87d);
}

.stat-bar-fill.mp {
    background: linear-gradient(90deg, #4a90d9, #7eb3e8);
}

.stat-bar-row .stat-value {
    width: 70px;
    text-align: right;
    font-size: 0.75rem;
    font-family: var(--font-tabular);
    color: var(--text-primary);
}

/* ステータスグリッド */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.stats-grid .stat-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 8px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
}

.stats-grid .stat-icon {
    font-size: 0.8rem;
}

.stats-grid .stat-item span:nth-child(2) {
    flex: 1;
    font-size: 0.65rem;
    color: var(--text-muted);
}

.stats-grid .stat-num {
    font-size: 0.8rem;
    font-weight: 700;
    font-family: var(--font-tabular);
    color: var(--text-primary);
}

/* 晶系・相性 */
.crystal-affinity-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.crystal-system-name {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-primary);
}

.crystal-affinity-row {
    display: flex;
    gap: 8px;
    font-size: 0.7rem;
}

.affinity-advantage {
    color: #4caf50;
    font-weight: 600;
}

.affinity-disadvantage {
    color: #f44336;
    font-weight: 600;
}

/* ステータス効果タグ */
.status-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.status-detail-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.status-detail-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
}

.status-detail-item.buff {
    background: rgba(34, 197, 94, 0.2);
    border-left: 3px solid #4ade80;
    color: #4ade80;
}

.status-detail-item.debuff {
    background: rgba(168, 85, 247, 0.2);
    border-left: 3px solid #c084fc;
    color: #c084fc;
}

.status-detail-item.ailment {
    background: rgba(239, 68, 68, 0.2);
    border-left: 3px solid #f87171;
    color: #f87171;
}

.status-detail-item.element {
    background: rgba(251, 191, 36, 0.2);
    border-left: 3px solid #fbbf24;
    color: #fbbf24;
}

.status-detail-name {
    font-weight: 600;
}

.status-detail-turns {
    font-size: 0.6rem;
    opacity: 0.8;
    margin-left: 8px;
}

/* スキルリスト */
.skills-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.skill-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px 8px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
}

.skill-item.on-cooldown {
    opacity: 0.5;
}

.skill-item .skill-header {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.skill-item .skill-name {
    flex: 1;
    font-size: 0.75rem;
    color: var(--text-primary);
    font-weight: 600;
}

.skill-item .skill-cost {
    font-size: 0.65rem;
    color: #4a90d9;
    font-family: var(--font-tabular);
}

.skill-item .skill-cd {
    font-size: 0.6rem;
    background: rgba(239, 68, 68, 0.3);
    color: #f87171;
    padding: 1px 4px;
    border-radius: var(--radius-sm);
}

.skill-item .skill-desc {
    font-size: 0.6rem;
    color: var(--text-muted);
    line-height: 1.3;
    padding-left: 2px;
}

.stats-panel.enemy-stats .stats-panel-content {
    border-top: 2px solid var(--color-danger);
}

.stats-panel.ally-stats .stats-panel-content {
    border-bottom: 2px solid var(--color-accent);
}

.stats-panel .stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-xs);
    padding-bottom: 2px;
    border-bottom: 1px solid rgba(251, 232, 214, 0.15);
}

.stats-panel .card-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
    letter-spacing: 0.5px;
}

.stats-panel .hp-display {
    font-size: 0.8rem;
    font-family: var(--font-tabular);
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.2);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
}

.stats-panel .hp-current {
    color: var(--color-success);
    font-weight: 700;
}

.stats-panel .hp-max {
    color: var(--text-muted);
}

/* Level Badge in Stats Panel */
.stats-panel .card-level-badge {
    background: linear-gradient(135deg, var(--color-legendary), var(--color-epic));
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* Stats Bars (HP/MP) */
.stats-panel .stats-bars {
    margin-bottom: var(--space-xs);
}

.stats-panel .stat-bar-row {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    margin-bottom: 3px;
}

.stats-panel .stat-bar-row:last-child {
    margin-bottom: 0;
}

.stats-panel .bar-label {
    width: 24px;
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--text-muted);
}

.stats-panel .bar-container {
    flex: 1;
    height: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-full);
    position: relative;
    overflow: hidden;
}

.stats-panel .bar-fill {
    height: 100%;
    transition: width 0.3s ease;
    border-radius: var(--radius-full);
}

.stats-panel .hp-bar {
    background: linear-gradient(90deg, var(--color-success), #7dd87d);
}

.stats-panel .mp-bar {
    background: linear-gradient(90deg, #4a90d9, #7eb3e8);
}

.stats-panel .bar-text {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.55rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    font-family: var(--font-tabular);
}

.stats-panel .stats-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 2px;
}

.stats-panel .stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 3px 2px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: var(--radius-sm);
    transition: background 0.2s ease;
}

.stats-panel .stat-item:hover {
    background: rgba(0, 0, 0, 0.25);
}

.stats-panel .stat-item .stat-label {
    font-size: 0.5rem;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    margin-bottom: 1px;
    font-weight: 500;
}

.stats-panel .stat-item .stat-value {
    font-size: 0.75rem;
    font-family: var(--font-tabular);
    font-weight: 700;
    color: var(--text-primary);
}

/* ステータスタイプ別カラー - 洗練されたトーン */
.stats-panel .stat-item.physical {
    border-bottom: 2px solid var(--color-danger);
}

.stats-panel .stat-item.physical .stat-label {
    color: #d4a0a0;
}

.stats-panel .stat-item.magical {
    border-bottom: 2px solid var(--color-epic);
}

.stats-panel .stat-item.magical .stat-label {
    color: #c4a0d4;
}

.stats-panel .stat-item.utility {
    border-bottom: 2px solid var(--color-info);
}

.stats-panel .stat-item.utility .stat-label {
    color: #a0c4d4;
}

/* 元素カードアニメーションオーバーレイ */
.element-card-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    pointer-events: none;
}

.element-card-overlay.hidden {
    display: none;
}

.element-card-container {
    position: relative;
}

.element-card {
    width: 120px;
    height: 160px;
    background: linear-gradient(135deg, #1e3a5f 0%, #0f2847 100%);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 40px rgba(155, 123, 184, 0.6), 0 0 80px rgba(155, 123, 184, 0.3);
    border: 3px solid var(--color-epic);
    animation: elementCardAppear 0.5s ease-out;
}

.element-card.absorbing {
    animation: elementCardAbsorb 0.8s ease-in forwards;
}

.element-card .element-symbol {
    font-size: 2.5rem;
    font-weight: 900;
    color: white;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
    font-family: var(--font-heading);
}

.element-card .element-name {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.9);
    margin-top: var(--space-xs);
}

.element-card .element-effect {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-success);
    margin-top: var(--space-sm);
    text-shadow: 0 0 10px rgba(92, 184, 92, 0.8);
}

.element-card.major {
    border-color: var(--color-legendary);
    box-shadow: 0 0 40px rgba(255, 215, 0, 0.6), 0 0 80px rgba(255, 215, 0, 0.3);
}

.element-card.major .element-effect {
    color: var(--color-legendary);
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
}

.element-card.trace {
    border-color: var(--color-rare);
    box-shadow: 0 0 40px rgba(51, 153, 255, 0.6), 0 0 80px rgba(51, 153, 255, 0.3);
}

.element-card.trace .element-effect {
    color: var(--color-rare);
    text-shadow: 0 0 10px rgba(51, 153, 255, 0.8);
}

.element-card.none {
    border-color: var(--text-muted);
    box-shadow: 0 0 20px rgba(100, 116, 139, 0.4);
}

.element-card.none .element-effect {
    color: var(--text-muted);
    text-shadow: none;
}

@keyframes elementCardAppear {
    0% {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }
    60% {
        transform: scale(1.1) rotate(10deg);
        opacity: 1;
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

@keyframes elementCardAbsorb {
    0% {
        transform: scale(1) translate(0, 0);
        opacity: 1;
    }
    30% {
        transform: scale(1.2) translate(0, 0);
        opacity: 1;
    }
    100% {
        transform: scale(0.1) translate(var(--absorb-x, 0), var(--absorb-y, 100px));
        opacity: 0;
    }
}

/* ターゲットに吸収されるパーティクル */
.element-particle {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--color-epic);
    animation: particleFloat 0.6s ease-out forwards;
}

@keyframes particleFloat {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(var(--particle-x, 0), var(--particle-y, 50px)) scale(0);
        opacity: 0;
    }
}

.effect-text.element-major {
    color: var(--color-legendary);
    font-size: 1.5rem;
    white-space: pre-line;
    text-align: center;
}

.effect-text.element-trace {
    color: var(--color-rare);
    font-size: 1.25rem;
    white-space: pre-line;
    text-align: center;
}

.effect-text.element-none {
    color: var(--text-secondary);
    font-size: 1.25rem;
    white-space: pre-line;
    text-align: center;
}

@keyframes effectPop {
    0% { transform: scale(0.5); opacity: 0; }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

/* Energy Badge (Header) */
.energy-badge {
    background: rgba(0, 0, 0, 0.3);
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-family: var(--font-tabular);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--color-accent);
    border: 1px solid rgba(251, 232, 214, 0.2);
    letter-spacing: 0.5px;
}

/* Action Dock - タップで展開 */
.action-dock {
    background: linear-gradient(to top, var(--bg-primary) 0%, rgba(15, 58, 58, 0.95) 100%);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    height: auto;
    max-height: 48px; /* 最小化状態 - タブ行のみ表示 */
    flex-shrink: 0;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    z-index: 50;
    transition: max-height 0.3s ease-out, box-shadow 0.3s ease-out;
    border-top: 1px solid rgba(251, 232, 214, 0.1);
    overflow: hidden;
}

/* タップで展開（ホバーは無効） */
.action-dock.expanded {
    max-height: 45vh;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.4);
}

.action-tabs {
    display: flex;
    padding: var(--space-xs) var(--space-sm);
    gap: var(--space-xs);
    align-items: center;
    flex-shrink: 0;
    cursor: pointer;
    min-height: 44px;
}

/* 展開/折りたたみボタン */
.dock-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    background: rgba(99, 102, 241, 0.3);
    border: 1px solid rgba(99, 102, 241, 0.5);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease-out;
    flex-shrink: 0;
}

.dock-toggle-btn:hover {
    background: rgba(99, 102, 241, 0.5);
}

.dock-toggle-btn:active {
    transform: scale(0.95);
}

.dock-toggle-icon {
    font-size: 0.9rem;
    transition: transform 0.3s ease-out;
}

/* タブ内カウント */
.tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    font-size: 0.65rem;
    margin-left: 4px;
}

.end-turn-btn {
    margin-left: auto;
    padding: var(--space-xs) var(--space-md);
    background: var(--color-danger);
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease-out;
    letter-spacing: 0.5px;
}

.end-turn-btn:hover {
    background: #c54545;
    box-shadow: var(--shadow-glow);
}

.end-turn-btn:active {
    transform: scale(0.97);
}

.end-turn-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.action-tab {
    padding: var(--space-xs) var(--space-md);
    background: transparent;
    border: 1px solid rgba(251, 232, 214, 0.2);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease-out;
    letter-spacing: 0.5px;
}

.action-tab:hover {
    background: rgba(251, 232, 214, 0.1);
    color: var(--text-primary);
    border-color: rgba(251, 232, 214, 0.3);
}

.action-tab:active {
    transform: scale(0.97);
}

.action-tab.active {
    background: var(--color-accent);
    color: var(--text-dark);
    font-weight: 600;
    border-color: var(--color-accent);
}

.action-tab.active:hover {
    background: var(--color-accent-light);
}

.action-tab.end-turn-tab {
    border-color: rgba(239, 68, 68, 0.4);
    color: #f87171;
    margin-left: auto;
}

.action-tab.end-turn-tab:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.6);
}

.action-chip .action-cost.insufficient {
    color: #f87171;
}

.action-list {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-xs) var(--space-sm);
    padding-bottom: calc(var(--space-md) + env(safe-area-inset-bottom, 0px));
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    min-height: 0;
    max-height: calc(45vh - 50px);
}

/* ActionChip - タップ式アクション選択 */
.action-chip {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 10px 12px;
    background: rgba(29, 82, 82, 0.85);
    border-radius: var(--radius-md);
    cursor: pointer;
    border: 1px solid rgba(251, 232, 214, 0.12);
    transition: all 0.2s ease-out;
    box-shadow: var(--shadow-card);
    min-height: 48px;
}

/* アクションタイプバッジ */
.action-chip .action-type {
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.65rem;
    font-weight: 600;
    text-align: center;
    min-width: 36px;
    flex-shrink: 0;
}

.action-chip .action-type.攻撃 { background: rgba(239, 68, 68, 0.25); color: #f87171; }
.action-chip .action-type.防御 { background: rgba(34, 197, 94, 0.25); color: #4ade80; }
.action-chip .action-type.スキル { background: rgba(168, 85, 247, 0.25); color: #c084fc; }
.action-chip .action-type.回復 { background: rgba(59, 130, 246, 0.25); color: #60a5fa; }

/* コスト表示エリア */
.action-chip .action-costs {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    flex-shrink: 0;
}

.action-chip:hover:not(.disabled) {
    background: rgba(42, 98, 98, 0.95);
    border-color: rgba(251, 232, 214, 0.25);
    box-shadow: var(--shadow-hover);
}

.action-chip:active:not(.disabled) {
    transform: scale(0.98);
    transition: all 0.05s ease-out;
}

.action-chip.selected {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 2px var(--color-accent), var(--shadow-hover);
}

.action-chip.selected:hover:not(.disabled) {
    box-shadow: 0 0 0 2px var(--color-accent), var(--shadow-glow);
}

.action-chip.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.action-chip.ultimate {
    background: linear-gradient(135deg, rgba(186, 73, 73, 0.5) 0%, rgba(29, 82, 82, 0.85) 100%);
    border-color: rgba(186, 73, 73, 0.35);
}

.action-chip.ultimate:hover:not(.disabled) {
    background: linear-gradient(135deg, rgba(186, 73, 73, 0.65) 0%, rgba(42, 98, 98, 0.95) 100%);
    border-color: rgba(186, 73, 73, 0.5);
}

.action-chip .action-mp {
    font-family: var(--font-tabular);
    font-size: 0.65rem;
    color: var(--color-info);
    font-weight: 500;
}

.action-chip .action-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.action-chip .action-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0.3px;
}

/* アクションチップのホバー時詳細ツールチップ */
.action-chip {
    position: relative;
}

.action-chip .action-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 40, 40, 0.98);
    border: 1px solid rgba(251, 232, 214, 0.3);
    border-radius: var(--radius-sm);
    padding: var(--space-sm);
    font-size: 0.75rem;
    color: var(--text-primary);
    white-space: nowrap;
    width: auto;
    min-width: 120px;
    max-width: 280px;
    z-index: 200;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s, visibility 0.15s;
    pointer-events: none;
    margin-bottom: 6px;
}

/* 内容が長い場合は折り返す */
.action-chip .action-tooltip.multiline {
    white-space: normal;
}

.action-chip .action-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(251, 232, 214, 0.3);
}

.action-chip:hover .action-tooltip {
    opacity: 1;
    visibility: visible;
}

.action-chip .action-tooltip .tooltip-name {
    font-weight: 600;
    color: var(--color-accent);
    margin-bottom: 4px;
}

.action-chip .action-tooltip .tooltip-desc {
    color: var(--text-secondary);
    line-height: 1.4;
}

.action-chip .action-tooltip .tooltip-effect {
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px solid rgba(251, 232, 214, 0.1);
    color: var(--text-muted);
    font-size: 0.7rem;
}

.action-chip .action-description {
    font-size: 0.6rem;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-top: 2px;
    word-break: break-all;
}

.action-chip .action-desc {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.action-chip .action-cost {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: var(--radius-sm);
    font-family: var(--font-tabular);
    font-size: 0.75rem;
    color: var(--color-accent);
    font-weight: 600;
}

.action-chip .action-cost .cost-icon {
    font-size: 0.7rem;
}

.action-chip .action-cost .cost-icon img {
    width: 12px;
    height: 12px;
    filter: brightness(0) saturate(100%) invert(73%) sepia(35%) saturate(671%) hue-rotate(8deg) brightness(93%) contrast(87%);
}

.action-chip.disabled .disabled-reason {
    font-size: 0.65rem;
    color: var(--color-danger);
}

/* Action Buttons - バトルアクションボタン */
.action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: var(--space-xs) var(--space-sm);
    padding-bottom: var(--space-md);
    overflow-y: auto;
    max-height: calc(50vh - 60px);
    align-content: start;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 10px 8px;
    background: rgba(29, 82, 82, 0.85);
    border-radius: var(--radius-md);
    cursor: pointer;
    border: 1px solid rgba(251, 232, 214, 0.15);
    transition: all 0.2s ease-out;
    box-shadow: var(--shadow-card);
    min-height: 56px;
}

.action-btn:hover:not(.disabled) {
    background: rgba(42, 98, 98, 0.95);
    border-color: rgba(251, 232, 214, 0.3);
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.action-btn:active:not(.disabled) {
    transform: scale(0.97) translateY(0);
    transition: all 0.05s ease-out;
}

.action-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.action-btn.ultimate {
    background: linear-gradient(135deg, rgba(186, 73, 73, 0.6) 0%, rgba(29, 82, 82, 0.85) 100%);
    border-color: rgba(186, 73, 73, 0.4);
}

.action-btn.ultimate:hover:not(.disabled) {
    background: linear-gradient(135deg, rgba(186, 73, 73, 0.75) 0%, rgba(42, 98, 98, 0.95) 100%);
    border-color: rgba(186, 73, 73, 0.6);
}

.action-btn .action-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
    line-height: 1.2;
}

.action-btn .action-cost {
    font-family: var(--font-tabular);
    font-size: 0.7rem;
    color: var(--color-accent);
    font-weight: 600;
    background: rgba(0, 0, 0, 0.25);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
}

.action-btn .action-mp {
    font-family: var(--font-tabular);
    font-size: 0.65rem;
    color: var(--color-info);
    font-weight: 500;
}

.action-message {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80px;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-style: italic;
}

/* action-dock-footer removed - end turn button moved to tabs */

/* Confirm Bar - MEMORICA Style */
.confirm-bar {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    background: linear-gradient(to top, var(--bg-primary) 0%, rgba(15, 58, 58, 0.95) 100%);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: var(--space-sm) var(--space-md);
    z-index: 200;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border-top: 1px solid rgba(251, 232, 214, 0.1);
}

.confirm-bar.hidden {
    display: none;
}

.confirm-prediction {
    background: var(--bg-panel);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
    margin-bottom: var(--space-sm);
    text-align: left;
    box-shadow: var(--shadow-card);
    border: 1px solid rgba(251, 232, 214, 0.1);
}

.confirm-prediction .prediction-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.confirm-prediction .prediction-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.confirm-prediction .prediction-value.damage {
    color: var(--color-danger);
}

.confirm-prediction .prediction-value.heal,
.confirm-prediction .prediction-value.buff {
    color: var(--color-accent);
}

.confirm-prediction .prediction-detail {
    font-size: 0.65rem;
    color: var(--text-secondary);
    margin-top: var(--space-xs);
    line-height: 1.4;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}

.confirm-prediction .detail-item {
    color: var(--text-secondary);
}

.confirm-prediction .detail-sep {
    color: var(--text-muted);
    opacity: 0.5;
}

.confirm-actions {
    display: flex;
    gap: var(--space-md);
}

.confirm-actions .btn {
    flex: 1;
}

/* Battle Log Entry Styles */
.log-entry {
    padding: var(--space-xs) 0;
    font-size: 0.75rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--bg-card);
}

.log-entry:last-child {
    border-bottom: none;
}

.log-entry .turn-badge {
    font-size: 0.625rem;
    padding: 2px 4px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    margin-right: var(--space-xs);
}

/* Battle Result */
.battle-result {
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.battle-result.hidden {
    display: none;
}

.result-content {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    text-align: center;
    max-width: 320px;
    width: 90%;
}

.result-title {
    font-size: 2rem;
    margin-bottom: var(--space-lg);
}

.result-title.win {
    color: var(--color-success);
}

.result-title.lose {
    color: var(--color-danger);
}

.result-stats {
    margin-bottom: var(--space-lg);
}

/* =====================
   Online Battle UI
   ===================== */

/* Turn Timer */
.turn-timer {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-family: var(--font-tabular);
    color: var(--text-primary);
}

.turn-timer .timer-icon {
    font-size: 0.75rem;
}

.turn-timer.urgent {
    background: rgba(181, 74, 74, 0.5);
    animation: timer-pulse 0.5s ease-in-out infinite alternate;
}

@keyframes timer-pulse {
    from { opacity: 1; }
    to { opacity: 0.7; }
}

/* Connection Status */
.connection-status {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--radius-md);
    font-size: 0.75rem;
}

.connection-status.connected {
    background: rgba(74, 154, 106, 0.3);
    color: var(--color-success);
}

.connection-status.disconnected {
    background: rgba(181, 74, 74, 0.3);
    color: var(--color-danger);
    animation: disconnected-blink 1s ease-in-out infinite;
}

@keyframes disconnected-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.conn-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

.connection-status.connected .conn-dot {
    animation: conn-pulse 2s ease-in-out infinite;
}

@keyframes conn-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.7; }
}

/* Opponent Name Display */
.opponent-name-display {
    padding: 4px 12px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Forfeit Button */
.forfeit-btn {
    background: var(--color-danger) !important;
    color: white !important;
    font-size: 0.75rem !important;
    padding: 4px 10px !important;
}

.forfeit-btn:hover {
    background: #9a3a3a !important;
}

/* Online Battle Header Enhancement */
.battle-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--bg-card);
    position: sticky;
    top: 0;
    z-index: 100;
    flex-wrap: wrap;
    gap: 8px;
}

.battle-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.battle-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-btn {
    padding: 6px 12px;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.2s;
}

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

/* Exit Button */
.exit-btn {
    background: rgba(220, 38, 38, 0.3);
    border-color: rgba(220, 38, 38, 0.4);
    color: #ef4444;
    font-weight: bold;
    font-size: 1rem;
    padding: 8px 12px;
    min-width: 36px;
}

.exit-btn:hover {
    background: rgba(220, 38, 38, 0.5);
    border-color: rgba(220, 38, 38, 0.6);
}

/* Current Actor Indicator */
.current-actor {
    padding: 4px 12px;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
}

.current-actor.player {
    background: rgba(74, 154, 106, 0.3);
    color: var(--color-success);
}

.current-actor.opponent {
    background: rgba(181, 74, 74, 0.3);
    color: var(--color-danger);
}

/* =====================
   Action Queue Bar (Speed-based Turn Order)
   ===================== */
.action-queue-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    overflow-x: auto;
    scrollbar-width: none;
}

.action-queue-bar::-webkit-scrollbar {
    display: none;
}

.action-queue-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    min-width: 48px;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid transparent;
}

.action-queue-item.active {
    background: rgba(99, 102, 241, 0.4);
    border-color: var(--color-primary);
    transform: scale(1.1);
}

.action-queue-item.player {
    border-bottom: 2px solid var(--color-success);
}

.action-queue-item.opponent {
    border-bottom: 2px solid var(--color-danger);
}

.action-queue-item.acted {
    opacity: 0.4;
}

.action-queue-item .queue-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 50px;
}

.action-queue-item .queue-speed {
    font-size: 0.6rem;
    color: var(--text-secondary);
}

/* =====================
   Collection Screen
   ===================== */
.collection-stats {
    display: flex;
    justify-content: center;
    gap: var(--space-xl);
    padding: var(--space-lg);
    background: rgba(0, 0, 0, 0.1);
}

.stat-item {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    font-family: var(--font-tabular);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.collection-grid {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-md);
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: var(--space-md);
    align-content: start;
}

.collection-card {
    aspect-ratio: 3/4;
    background: var(--bg-card-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: pointer;
    position: relative;
    box-shadow: var(--shadow-card);
    transition: all 0.15s ease-out;
    transform: translateY(0);
}

.collection-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.collection-card:active {
    transform: translateY(0) scale(0.97);
    transition: all 0.05s ease-out;
}

.collection-card.unowned {
    filter: grayscale(1);
    opacity: 0.4;
    background: var(--bg-card);
}

.collection-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Integrate new card component into collection grid */
.collection-grid .mineral-card-small {
    max-width: 150px;
    width: 100%;
    height: auto;
}

/* Collection Filter Bar */
.collection-filter-bar {
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.collection-filter-bar .filter-row {
    display: flex;
    gap: var(--space-sm);
}

.collection-filter-bar .filter-input {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-card);
    border: 1px solid var(--bg-card-light);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.875rem;
}

.collection-filter-bar .filter-input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.collection-filter-bar .filter-input::placeholder {
    color: var(--text-muted);
}

.collection-filter-bar .filter-select {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-card);
    border: 1px solid var(--bg-card-light);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.8rem;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

.collection-filter-bar .filter-select:focus {
    outline: none;
    border-color: var(--color-primary);
}

/* =====================
   Modal
   ===================== */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(26, 74, 90, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: var(--space-md);
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    max-width: 420px;
    width: 95%;
    max-height: 85vh;
    perspective: 1000px;
    overflow: visible;
    position: relative;
    box-shadow: var(--shadow-hover);
}

.modal-content.card-modal {
    overflow: visible;
    background: transparent;
}

.modal-buttons {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    display: flex;
    gap: 0.5rem;
    z-index: 10;
}

.modal-close,
.modal-flip-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid var(--color-accent);
    border-radius: var(--radius-full);
    color: var(--text-primary);
    font-size: 1.25rem;
    cursor: pointer;
    transition: all 0.15s ease-out;
    transform: scale(1);
}

.modal-close:hover,
.modal-flip-btn:hover {
    background: var(--color-accent);
    transform: scale(1.1);
}

.modal-close:active,
.modal-flip-btn:active {
    background: var(--color-primary);
    transform: scale(0.95);
    transition: all 0.05s ease-out;
}

/* Card Detail Modal - カード詳細表示用 */
.modal-content.card-detail-modal {
    background: transparent !important;
    max-width: none !important;
    width: fit-content !important;
    max-height: none !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-sm);
    overflow: visible !important;
    box-shadow: none;
}

/* ボタンをカードの上に配置（重ならないように） */
.card-detail-modal .modal-buttons {
    position: relative;
    top: auto;
    right: auto;
    z-index: 10;
    margin-bottom: var(--space-sm);
    align-self: flex-end;
}

.card-detail-modal #card-detail-content {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* card-detail-modal内のcard-flipperを調整 */
.card-detail-modal .card-flipper {
    min-height: auto !important;
    width: auto !important;
}

.card-detail-modal .card-face {
    padding: var(--space-sm);
    background: transparent;
}

.card-detail-modal .card-front {
    max-height: none !important;
    overflow: visible !important;
}

/* モーダル内のカードを画面に収まるサイズで表示 */
.card-detail-modal .card-detail-card-wrapper {
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.card-detail-modal .card-detail-card-wrapper .mineral-card {
    /* CSS変数を使用してサイズ制御 */
    width: var(--card-width) !important;
    height: var(--card-height) !important;
}

.card-detail-modal .mineral-card {
    --card-width: 300px;
    --card-height: 450px;
    transform-origin: center center;
}

/* 小さい画面では縮小して全体が見えるようにする */
@media (max-height: 600px) {
    .card-detail-modal .mineral-card {
        --card-width: 240px;
        --card-height: 360px;
    }
}

/* 中くらいの画面 */
@media (min-height: 700px) {
    .card-detail-modal .mineral-card {
        --card-width: 300px;
        --card-height: 450px;
    }
}

/* 大きい画面では少し大きく表示 */
@media (min-height: 800px) {
    .card-detail-modal .mineral-card {
        --card-width: 340px;
        --card-height: 510px;
    }
}

@media (min-height: 950px) {
    .card-detail-modal .mineral-card {
        --card-width: 380px;
        --card-height: 570px;
    }
}

/* カード表面のヘッダーを非表示 */
.card-detail-modal .card-front .card-face-header {
    display: none;
}

/* カード表面のパディングを最小化 */
.card-detail-modal .card-front {
    padding: 0;
    background: transparent;
}

/* パーティ編成モーダルのアクションボタン */
.card-detail-modal .modal-action-buttons {
    position: relative;
    margin-top: var(--space-md);
    display: flex;
    justify-content: center;
    gap: var(--space-sm);
}

.card-detail-modal .modal-action-buttons .btn {
    min-width: 160px;
    padding: var(--space-sm) var(--space-lg);
}

.card-detail-modal .modal-action-buttons .btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* カードレベル・凸数表示 */
.card-detail-modal .card-level-display {
    text-align: center;
    margin-top: var(--space-sm);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-md);
}

.card-detail-modal .level-text {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--primary);
    text-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
}

.card-detail-modal .duplicate-count {
    font-size: 0.95rem;
    font-weight: bold;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.card-detail-modal .duplicate-count.no-dupe {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
}

/* バトルステータスグリッド */
.battle-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-sm);
}

.battle-stats-grid .stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-sm);
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-sm);
}

.battle-stats-grid .stat-icon {
    font-size: 1.2rem;
    margin-bottom: 2px;
}

.battle-stats-grid .stat-name {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.battle-stats-grid .stat-value {
    font-size: 1rem;
    font-weight: bold;
    color: var(--text-primary);
}

/* スキル表示 */
.skills-list-compact .skill-row {
    padding: var(--space-sm);
    margin-bottom: var(--space-xs);
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--primary);
}

.skills-list-compact .skill-row.ultimate {
    border-left-color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
}

.skill-name-row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-xs);
}

.skill-name {
    font-weight: bold;
    font-size: 0.9rem;
}

.skill-unlock {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-left: auto;
}

.ultimate-badge {
    font-size: 0.6rem;
    padding: 2px 6px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    border-radius: var(--radius-sm);
    color: white;
    font-weight: bold;
}

.skill-info-row {
    display: flex;
    gap: var(--space-sm);
    font-size: 0.75rem;
    margin-bottom: var(--space-xs);
}

.skill-type {
    padding: 2px 6px;
    border-radius: var(--radius-xs);
    background: rgba(99, 102, 241, 0.2);
}

.skill-mp {
    color: #60a5fa;
}

.skill-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* 騎士団表示 */
.knight-order {
    font-weight: bold;
    color: var(--text-primary);
}

.card-detail {
    padding: var(--space-lg);
}

.card-detail-header {
    display: flex;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.card-detail-image {
    width: 120px;
    aspect-ratio: 3/4;
    border-radius: var(--radius-md);
    object-fit: cover;
}

.card-detail-info h3 {
    font-size: 1.25rem;
    margin-bottom: var(--space-xs);
}

.card-detail-info .name-en {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.card-detail-info .formula {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-tabular);
    word-break: break-all;
    line-height: 1.4;
    margin-bottom: var(--space-sm);
}

.card-detail-info .formula sub {
    font-size: 0.7em;
}

.card-detail-info .rarity-badge {
    margin-top: var(--space-xs);
}

/* カード表面の王国バッジ - コンパクトデザイン */
.card-kingdom-badge {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 4px 8px;
    background: rgba(45, 106, 106, 0.9);
    border: 1.5px solid;
    border-radius: var(--radius-sm);
    min-width: 0; /* flexアイテムの縮小を許可 */
}

.card-kingdom-badge .kingdom-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-kingdom-badge .kingdom-icon .icon {
    width: 20px;
    height: 20px;
}

.card-kingdom-badge .kingdom-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0; /* テキスト省略を有効に */
    overflow: hidden;
}

.card-kingdom-badge .kingdom-name {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-kingdom-badge .knight-info {
    font-size: 0.6rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 複数騎士団所属表示 - 縦並び・コンパクト */
.card-affiliations {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-bottom: var(--space-xs);
    max-height: 80px; /* 最大高さ制限 */
    overflow-y: auto;
}

/* 3つ以上の所属がある場合の横並びモード */
.card-affiliations.compact-mode {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px;
}

.card-affiliations.compact-mode .card-kingdom-badge {
    flex: 0 1 auto;
    padding: 3px 6px;
}

.card-affiliations.compact-mode .card-kingdom-badge .kingdom-info {
    flex-direction: row;
    gap: 4px;
    align-items: center;
}

.card-affiliations.compact-mode .card-kingdom-badge .kingdom-name {
    font-size: 0.6rem;
}

.card-affiliations.compact-mode .card-kingdom-badge .knight-info {
    font-size: 0.55rem;
}

.card-kingdom-badge.secondary {
    opacity: 0.85;
    padding: 3px 6px;
    background: rgba(45, 106, 106, 0.6);
}

.card-kingdom-badge.secondary .kingdom-icon .icon {
    width: 16px;
    height: 16px;
}

.card-kingdom-badge.secondary .kingdom-name {
    font-size: 0.6rem;
}

.card-kingdom-badge.secondary .knight-info {
    font-size: 0.55rem;
}

/* 図鑑での複数所属表示 */
.all-affiliations-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    margin-bottom: var(--space-sm);
}

.affiliation-badge {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    background: rgba(45, 106, 106, 0.6);
    border: 2px solid;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
}

.affiliation-badge.primary {
    background: rgba(45, 106, 106, 0.85);
}

.affiliation-badge.secondary {
    opacity: 0.75;
    border-style: dashed;
}

.affiliation-icon {
    width: 18px;
    height: 18px;
}

.affiliation-order {
    color: var(--text-primary);
    font-weight: 500;
}

.card-detail-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: var(--space-sm);
    background: var(--bg-card);
    border-radius: var(--radius-sm);
}

.stat-row .label {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.stat-row .value {
    font-weight: 500;
    font-family: var(--font-tabular);
}

.card-detail-description {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.card-detail-description p {
    margin: var(--space-xs) 0;
    font-size: 0.75rem;
}

.card-detail-description p strong {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* 晶系相性図 */
.crystal-affinity-chart {
    margin-top: 1rem;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.crystal-affinity-chart .affinity-title {
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.crystal-affinity-chart .affinity-circle {
    position: relative;
    width: 140px;
    height: 140px;
    margin: 0 auto;
}

.crystal-affinity-chart .crystal-node {
    position: absolute;
    width: 36px;
    height: 36px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    font-weight: 600;
    color: var(--text-secondary);
    /* 円形配置 */
    left: 50%;
    top: 50%;
    transform: rotate(var(--angle)) translateY(-52px) rotate(calc(-1 * var(--angle)));
    margin-left: -18px;
    margin-top: -18px;
    transition: all 0.2s ease;
}

.crystal-affinity-chart .crystal-node.current {
    background: var(--color-primary);
    border-color: var(--color-accent);
    color: var(--text-primary);
    box-shadow: 0 0 8px var(--color-accent);
    z-index: 2;
}

.crystal-affinity-chart .crystal-node.strong {
    background: rgba(34, 197, 94, 0.3);
    border-color: #22c55e;
    color: #22c55e;
}

.crystal-affinity-chart .crystal-node.weak {
    background: rgba(239, 68, 68, 0.3);
    border-color: #ef4444;
    color: #ef4444;
}

.crystal-affinity-chart .affinity-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.crystal-affinity-chart .center-current {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--color-accent);
}

.crystal-affinity-chart .affinity-legend {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 0.75rem;
    font-size: 0.7rem;
}

.crystal-affinity-chart .legend-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.crystal-affinity-chart .legend-item.strong {
    color: #22c55e;
}

.crystal-affinity-chart .legend-item.weak {
    color: #ef4444;
}

.crystal-affinity-chart .no-data {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.75rem;
    padding: 1rem;
}

/* =====================
   Card Flip Animation
   ===================== */
.card-flipper {
    position: relative;
    width: 100%;
    min-height: 500px;
    transition: transform 0.6s ease-in-out;
    transform-style: preserve-3d;
}

.card-flipper.flipped {
    transform: rotateY(180deg);
}

.card-face {
    width: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: var(--space-md);
}

.card-front {
    position: relative;
    overflow-y: auto;
    max-height: 75vh;
}

.card-back {
    position: absolute;
    top: 0;
    left: 0;
    transform: rotateY(180deg);
    overflow-y: auto;
    max-height: 75vh;
}

.card-face {
    cursor: pointer;
}

.card-face-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--bg-card);
    cursor: pointer;
}

.face-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Card Detail Modal - New Card Design */
.card-detail-card-wrapper {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: var(--space-sm) 0;
}

.card-detail-card-wrapper .mineral-card {
    /* CSS変数でサイズ制御（親のcard-detail-modalで設定） */
    width: var(--card-width, 300px);
    height: var(--card-height, 450px);
    margin: 0 auto;
    position: relative;
}

.card-detail-card-wrapper .mineral-card .card-frame {
    padding: 3px;
    position: absolute;
    inset: 0;
}

/* =====================
   Encyclopedia Styles - Adventure Theme
   ===================== */

/* 図鑑全体のスクロール枠 */
.encyclopedia-scroll {
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 50%, var(--bg-tertiary) 100%);
    border: 3px solid var(--color-accent);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    position: relative;
    box-shadow:
        inset 0 0 30px rgba(212, 165, 71, 0.1),
        0 0 20px rgba(212, 165, 71, 0.3);
}

.encyclopedia-scroll::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 8px;
    right: 8px;
    bottom: 8px;
    border: 1px solid rgba(212, 165, 71, 0.3);
    border-radius: var(--radius-md);
    pointer-events: none;
}

/* 鉱物タイトルヘッダー */
.mineral-title-header {
    text-align: center;
    padding-bottom: var(--space-md);
    margin-bottom: var(--space-md);
    border-bottom: 2px solid rgba(212, 165, 71, 0.5);
    position: relative;
}

.mineral-title-header::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 12px;
    background: var(--color-accent);
    clip-path: polygon(50% 100%, 0 0, 100% 0);
}

.mineral-name-main {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--color-accent);
    text-shadow: 0 0 10px rgba(212, 165, 71, 0.5);
    margin-bottom: var(--space-xs);
}

.mineral-name-sub {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-style: italic;
}

.chemical-formula-display {
    display: block;
    margin-top: var(--space-sm);
    padding: var(--space-xs) var(--space-sm);
    background: linear-gradient(90deg, transparent, rgba(74, 144, 144, 0.3), transparent);
    border-left: 3px solid var(--color-primary);
    border-right: 3px solid var(--color-primary);
    font-family: var(--font-tabular);
    font-size: 0.7rem;
    color: var(--text-secondary);
    letter-spacing: 0;
    word-break: break-all;
    line-height: 1.5;
    text-align: center;
    max-width: 100%;
    overflow-wrap: break-word;
}

.chemical-formula-display sub {
    font-size: 0.7em;
    vertical-align: baseline;
    position: relative;
    top: 0.3em;
}

/* セクションカード */
.info-card {
    background: rgba(45, 106, 106, 0.85);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.info-card-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: linear-gradient(90deg, rgba(74, 144, 144, 0.3), transparent);
    border-bottom: 1px solid rgba(74, 144, 144, 0.3);
}

.info-card-icon {
    font-size: 1.2rem;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(74, 144, 144, 0.2);
    border-radius: var(--radius-sm);
}

.info-card-icon .icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
    overflow: visible;
}

.info-card-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-card-body {
    padding: var(--space-md);
}

/* データグリッド */
.data-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm);
}

.data-item {
    display: flex;
    flex-direction: column;
    padding: var(--space-sm);
    background: rgba(45, 106, 106, 0.6);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--color-accent);
}

.data-item.full-width {
    grid-column: 1 / -1;
}

.data-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.data-value {
    font-size: 0.85rem;
    color: var(--text-primary);
    font-weight: 500;
}

.data-value.highlight {
    color: var(--color-accent);
}

/* 生成条件 - 特殊表示 */
.formation-display {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.formation-meter {
    position: relative;
    background: rgba(45, 106, 106, 0.8);
    border-radius: var(--radius-sm);
    padding: var(--space-sm);
    overflow: hidden;
}

.formation-meter::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--meter-color), transparent);
    width: var(--meter-width, 50%);
    opacity: 0.3;
}

.formation-meter.temp {
    --meter-color: var(--color-danger);
}

.formation-meter.pressure {
    --meter-color: var(--color-info);
}

.meter-content {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.meter-label {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* 小サイズアイコン */
.icon-sm {
    width: 14px;
    height: 14px;
    object-fit: contain;
    vertical-align: middle;
}

.meter-value {
    font-family: var(--font-tabular);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* スキル一覧 */
.skills-card {
    border-color: rgba(168, 85, 247, 0.4);
}

.skills-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.skill-item {
    background: rgba(30, 30, 50, 0.6);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    border-left: 3px solid var(--color-primary);
    transition: all 0.2s;
}

.skill-item:hover {
    background: rgba(40, 40, 60, 0.8);
    transform: translateX(2px);
}

.skill-item.ultimate {
    border-left-color: var(--color-warning);
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(30, 30, 50, 0.6));
}

.skill-item.ultimate::before {
    content: '★ ULTIMATE';
    display: block;
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--color-warning);
    letter-spacing: 1px;
    margin-bottom: var(--space-xs);
}

.skill-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-xs);
}

.skill-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.skill-unlock-level {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    background: rgba(99, 102, 241, 0.3);
    color: #a5b4fc;
}

.skill-meta {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}

.skill-type {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
}

.skill-type-attack {
    background: rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.skill-type-defense {
    background: rgba(59, 130, 246, 0.3);
    color: #3b82f6;
}

.skill-type-buff {
    background: rgba(34, 197, 94, 0.3);
    color: #22c55e;
}

.skill-type-debuff {
    background: rgba(168, 85, 247, 0.3);
    color: #a855f7;
}

.skill-type-heal {
    background: rgba(236, 72, 153, 0.3);
    color: #ec4899;
}

.skill-type-special {
    background: rgba(245, 158, 11, 0.3);
    color: #f59e0b;
}

.skill-cost {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    background: rgba(99, 102, 241, 0.3);
    color: #a5b4fc;
}

.skill-cost.free {
    background: rgba(34, 197, 94, 0.2);
    color: var(--color-success);
}

.skill-cooldown {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    background: rgba(100, 100, 100, 0.3);
    color: var(--text-muted);
}

.skill-description {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* 説明文エリア */
.lore-text {
    font-size: 0.85rem;
    line-height: 1.7;
    color: var(--text-secondary);
    padding: var(--space-sm);
    background: rgba(45, 106, 106, 0.5);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--color-accent);
    font-style: italic;
}

/* 鉱物標本写真 */
.specimen-card {
    background: rgba(45, 106, 106, 0.9);
    border: 2px solid rgba(212, 165, 71, 0.5);
}

.specimen-card .info-card-header {
    background: linear-gradient(90deg, rgba(212, 165, 71, 0.3), transparent);
    border-bottom-color: rgba(212, 165, 71, 0.3);
}

.specimen-photo-container {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: #000;
}

.specimen-photo {
    width: 100%;
    height: auto;
    max-height: 250px;
    object-fit: contain;
    display: block;
    border-radius: var(--radius-sm);
}

.photo-credit {
    position: absolute;
    bottom: 0;
    right: 0;
    font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.7);
    background: rgba(0, 0, 0, 0.6);
    padding: 2px 6px;
    border-top-left-radius: var(--radius-sm);
}

/* 王国カード */
.kingdom-card {
    border-width: 2px;
    border-style: solid;
}

.kingdom-badge-row {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
    flex-wrap: wrap;
}

.knight-order {
    font-size: 0.75rem;
    font-weight: 600;
    padding: var(--space-xs) var(--space-sm);
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    color: var(--color-accent);
}

.knight-rank {
    font-size: 0.75rem;
    font-weight: 600;
    padding: var(--space-xs) var(--space-sm);
    background: rgba(74, 144, 144, 0.2);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
}

.character-personality {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
    line-height: 1.5;
}

.character-backstory {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: var(--space-sm);
    padding: var(--space-sm);
    background: rgba(45, 106, 106, 0.5);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--color-primary);
}

.character-combat {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* 特殊能力カード */
.ability-card {
    border: 2px solid rgba(212, 165, 71, 0.5);
}

.ability-card .info-card-header {
    background: linear-gradient(90deg, rgba(212, 165, 71, 0.3), transparent);
    border-bottom-color: rgba(212, 165, 71, 0.3);
}

.ability-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-accent);
    margin-bottom: var(--space-sm);
    text-shadow: 0 0 10px rgba(212, 165, 71, 0.3);
}

.ability-details {
    display: flex;
    gap: var(--space-md);
    margin-bottom: var(--space-sm);
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.ability-flavor {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-style: italic;
    line-height: 1.6;
    margin-bottom: var(--space-sm);
    padding: var(--space-sm);
    background: rgba(212, 165, 71, 0.1);
    border-radius: var(--radius-sm);
}

.ability-effects-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    margin-top: var(--space-sm);
}

.effect-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
}

.effect-row.effect-buff {
    background: linear-gradient(90deg, rgba(92, 184, 92, 0.2), transparent);
    border-left: 3px solid var(--color-success);
}

.effect-row.effect-reduction {
    background: linear-gradient(90deg, rgba(91, 192, 222, 0.2), transparent);
    border-left: 3px solid var(--color-info);
}

.effect-row.effect-debuff {
    background: linear-gradient(90deg, rgba(217, 83, 79, 0.2), transparent);
    border-left: 3px solid var(--color-danger);
}

.effect-row.effect-heal {
    background: linear-gradient(90deg, rgba(92, 184, 92, 0.2), transparent);
    border-left: 3px solid var(--color-success);
}

.effect-row.effect-dot {
    background: linear-gradient(90deg, rgba(212, 165, 71, 0.2), transparent);
    border-left: 3px solid var(--color-warning);
}

.effect-row.effect-reflect {
    background: linear-gradient(90deg, rgba(155, 123, 184, 0.2), transparent);
    border-left: 3px solid var(--color-epic);
}

.effect-row.effect-aoe {
    background: linear-gradient(90deg, rgba(212, 165, 71, 0.2), transparent);
    border-left: 3px solid var(--color-accent);
}

.effect-row.effect-taunt {
    background: linear-gradient(90deg, rgba(100, 116, 139, 0.2), transparent);
    border-left: 3px solid var(--text-muted);
}

.effect-row.effect-cleanse {
    background: linear-gradient(90deg, rgba(91, 192, 222, 0.2), transparent);
    border-left: 3px solid var(--color-info);
}

.effect-row.effect-penetration {
    background: linear-gradient(90deg, rgba(155, 123, 184, 0.2), transparent);
    border-left: 3px solid var(--color-epic);
}

.effect-row.effect-resistance,
.effect-row.effect-adaptive {
    background: linear-gradient(90deg, rgba(74, 144, 144, 0.2), transparent);
    border-left: 3px solid var(--color-primary);
}

.effect-stat {
    color: var(--text-primary);
    font-weight: 500;
}

.effect-value {
    color: var(--color-accent);
    font-weight: 700;
    font-family: var(--font-tabular);
    text-shadow: 0 0 8px rgba(212, 165, 71, 0.3);
}

/* パラメータ計算セクション */
.param-calc-section {
    background: linear-gradient(135deg, rgba(74, 144, 144, 0.1), rgba(212, 165, 71, 0.1));
    border: 1px solid rgba(74, 144, 144, 0.3);
    border-radius: var(--radius-md);
    padding: var(--space-md);
}

.param-calc-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 1px dashed rgba(74, 144, 144, 0.3);
}

.param-calc-header .icon {
    width: 22px;
    height: 22px;
    object-fit: contain;
}

.param-calc-header .title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.param-row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm);
    margin-bottom: var(--space-xs);
    background: rgba(45, 106, 106, 0.5);
    border-radius: var(--radius-sm);
    transition: background 0.2s;
}

.param-row:hover {
    background: rgba(74, 144, 144, 0.3);
}

.param-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    background: rgba(74, 144, 144, 0.2);
    border-radius: var(--radius-sm);
}

.param-icon .icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.param-icon.atk { background: rgba(217, 83, 79, 0.2); }
.param-icon.def { background: rgba(91, 192, 222, 0.2); }
.param-icon.matk { background: rgba(155, 123, 184, 0.2); }
.param-icon.mdef { background: rgba(92, 184, 92, 0.2); }
.param-icon.hp { background: rgba(212, 165, 71, 0.2); }
.param-icon.crit { background: rgba(212, 165, 71, 0.2); }

.param-details {
    flex: 1;
    min-width: 0;
}

.param-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.param-formula {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-family: var(--font-tabular);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.param-result {
    font-family: var(--font-tabular);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-accent);
    text-shadow: 0 0 8px rgba(212, 165, 71, 0.5);
    min-width: 50px;
    text-align: right;
}

.rarity-bonus-note {
    margin-top: var(--space-sm);
    padding: var(--space-xs) var(--space-sm);
    background: rgba(212, 165, 71, 0.1);
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    color: var(--color-accent);
    text-align: center;
    border: 1px dashed rgba(212, 165, 71, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
}

/* =====================
   Utilities
   ===================== */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-muted);
}

.text-warning {
    color: #ffc107;
}

/* Loading */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-xl);
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--bg-card);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* =====================
   Responsive
   ===================== */
@media (min-width: 768px) {
    #app {
        max-width: 100%;
    }

    .card-list {
        grid-template-columns: repeat(3, 1fr);
    }

    .collection-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    }
}

/* =====================
   Story Mode
   ===================== */

/* Story Mode Screen Backgrounds */
#story-menu,
#story-menu-screen,
#story-home-kingdom,
#story-party-select,
#story-party-select-screen,
#story-kingdom-select,
#story-kingdom-select-screen,
#story-kingdom-detail,
#story-kingdom-detail-screen,
#story-party-manage,
#story-card-growth {
    background-image: linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.6)), url('/assets/backgrounds/menu/menu_story.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
}

/* Screen Title Styles */
.screen-title-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: var(--space-xs);
}

.screen-title-img {
    max-height: 70px;
    max-width: 280px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

.screen-title-jp {
    font-size: 0.8rem;
    color: var(--text-secondary);
    letter-spacing: 0.1em;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.story-header {
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.6), transparent);
    padding-bottom: var(--space-lg);
}

/* Story Menu */
.story-menu-content {
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

/* Story Menu Grid - 3つの等サイズボックス横並び */
.story-menu-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-sm);
    padding: var(--space-sm) 0;
}

.story-menu-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-sm);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.15));
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 100px;
}

.story-menu-box:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.story-menu-box:active {
    transform: translateY(0);
}

.menu-box-icon {
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
}

.menu-box-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.menu-box-icon .icon-fallback {
    font-size: 2.5rem;
}

.menu-box-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
    color: var(--text-primary);
    line-height: 1.3;
}

/* Story Illustration - メインイラスト */
.story-illustration {
    margin: var(--space-md) 0;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(99, 102, 241, 0.3);
}

.story-illustration img {
    width: 100%;
    height: auto;
    display: block;
}

/* 王国詳細画面のイラスト高さ縮小（スクロールなしで収まるように） */
#story-kingdom-detail-screen .story-illustration {
    max-height: 55vw;
}

#story-kingdom-detail-screen .story-illustration img {
    height: 55vw;
    object-fit: cover;
    object-position: center;
}

/* 小さいサイズのイラスト（パーティー編成等） */
.story-illustration-small {
    margin: var(--space-sm) 0;
    max-height: 200px;
    overflow: hidden;
}

.story-illustration-small img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    object-position: center;
}

/* 小さい画面では文字サイズを調整 */
@media (max-width: 360px) {
    .story-menu-grid {
        gap: var(--space-xs);
    }

    .story-menu-box {
        padding: var(--space-sm) var(--space-xs);
        min-height: 80px;
    }

    .menu-box-icon {
        font-size: 1.5rem;
    }

    .menu-box-label {
        font-size: 0.7rem;
    }
}

.story-prologue {
    background: linear-gradient(135deg, rgba(74, 144, 144, 0.2), rgba(212, 165, 71, 0.2));
    border: 1px solid rgba(74, 144, 144, 0.3);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
}

.story-prologue h3 {
    color: var(--color-accent);
    font-size: 0.9rem;
    margin-bottom: var(--space-sm);
}

.story-prologue p {
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

.story-menu-buttons {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.story-btn {
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent)) !important;
}

.story-progress-summary {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: var(--space-md);
}

.progress-kingdom-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.progress-kingdom-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm);
    background: var(--bg-card);
    border-radius: var(--radius-sm);
}

.progress-kingdom-name {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.progress-kingdom-icon {
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.progress-kingdom-icon .icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.progress-stages {
    display: flex;
    gap: 4px;
}

.progress-stage-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: 1px solid var(--text-muted);
}

.progress-stage-dot.cleared {
    background: var(--color-success);
    border-color: var(--color-success);
}

/* 進捗ステータステキスト */
.progress-status {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
}

.progress-status.not-started {
    color: var(--text-muted);
    background: rgba(100, 100, 100, 0.2);
}

.progress-status.in-progress {
    color: #60a5fa;
    background: rgba(59, 130, 246, 0.2);
}

.progress-status.conquered {
    color: #4ade80;
    background: rgba(34, 197, 94, 0.2);
}

.progress-kingdom-item {
    cursor: pointer;
    transition: background 0.2s;
}

.progress-kingdom-item:hover {
    background: var(--bg-secondary);
}

/* Story Party Select */
.story-party-content {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 60px);
    padding: var(--space-md);
}

.story-party-section {
    margin-bottom: var(--space-lg);
}

.party-slots-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-sm);
    padding: 0 var(--space-xs);
}

.party-slots-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.party-slots-hint {
    font-size: 0.7rem;
    color: var(--text-muted);
    background: var(--bg-secondary);
    padding: 4px 10px;
    border-radius: var(--radius-full);
}

.story-party-slots {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-xs);
    padding: var(--space-sm);
    padding-bottom: calc(var(--space-sm) + 20px); /* Extra space for "次のカード" indicator */
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
}

.story-party-slot {
    flex: 1;
    aspect-ratio: 3/4;
    background: var(--bg-secondary);
    border: 3px dashed var(--border-color);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: all 0.15s ease-out;
    position: relative;
    overflow: hidden;
    transform: translateY(0);
}

.story-party-slot:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
    border-color: var(--color-primary);
}

.story-party-slot:active {
    transform: translateY(0);
    transition: all 0.05s ease-out;
}

.story-party-slot.selected {
    border-color: var(--color-primary);
    border-style: solid;
    border-width: 3px;
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.6), inset 0 0 15px rgba(99, 102, 241, 0.15);
    transform: translateY(-4px) scale(1.02);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(99, 102, 241, 0.05));
}

.slot-next-indicator {
    position: absolute;
    bottom: -22px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.7rem;
    color: var(--color-primary);
    font-weight: 600;
    white-space: nowrap;
    animation: pulse-text 1.5s ease-in-out infinite;
    background: var(--bg-tertiary);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
}

@keyframes pulse-text {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.story-party-slot.filled {
    border-style: solid;
    border-color: var(--color-success);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), transparent);
}

.story-party-slot.filled.selected {
    border-color: var(--color-primary);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.6);
}

.story-party-slot .slot-label {
    position: absolute;
    top: 6px;
    left: 6px;
    width: 24px;
    height: 24px;
    background: var(--bg-card);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-secondary);
    border: 2px solid var(--border-color);
    z-index: 1;
}

.story-party-slot.selected .slot-label {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.5);
}

.story-party-slot.filled .slot-label {
    background: var(--color-success);
    color: white;
    border-color: var(--color-success);
    font-size: 0.7rem;
    font-weight: 700;
    z-index: 1;
}

.story-party-slot .slot-content {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.story-party-slot .slot-content.empty {
    padding: var(--space-sm);
}

/* Empty slot placeholder card */
.story-party-slot .mineral-card-mini.empty {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
}

.story-party-slot .mineral-card-mini.empty .empty-slot-icon {
    font-size: 2rem;
    color: var(--text-muted);
    opacity: 0.5;
    margin-bottom: var(--space-xs);
}

.story-party-slot.selected .mineral-card-mini.empty .empty-slot-icon {
    color: var(--color-primary);
    opacity: 1;
    font-size: 2.5rem;
    animation: bounce-icon 1s ease-in-out infinite;
}

@keyframes bounce-icon {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.story-party-slot .mineral-card-mini.empty .empty-slot-text {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.story-party-slot.selected .mineral-card-mini.empty .empty-slot-text {
    color: var(--color-primary);
    font-weight: 600;
}

.story-party-slot .slot-card-mini {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-xs);
}

.story-party-slot .slot-card-mini img {
    width: 100%;
    height: 60%;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

.story-party-slot .slot-card-mini .card-name {
    font-size: 0.65rem;
    text-align: center;
    margin-top: 4px;
    line-height: 1.2;
}

.story-party-slot .slot-card-mini .card-level {
    font-size: 0.6rem;
    color: var(--color-accent);
    margin-top: 2px;
}

.story-card-list-container {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.story-card-list {
    flex: 1;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-sm);
    padding: var(--space-sm);
}

/* Support for new card component in story card list */
.story-card-list .mineral-card-small {
    width: 100%;
    max-width: none;
    height: auto;
}

/* Legacy support for old card-mini class */
.story-card-list .card-mini {
    aspect-ratio: 3/4;
    padding: var(--space-xs);
}

.story-card-list .card-mini img {
    width: 100%;
    height: 70%;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

.story-card-list .card-mini-name {
    font-size: 0.6rem;
    line-height: 1.2;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Party Bonus Display */
.party-bonus-display {
    background: linear-gradient(135deg, rgba(100, 200, 100, 0.15), rgba(100, 200, 100, 0.05));
    border: 1px solid rgba(100, 200, 100, 0.4);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
    margin-bottom: var(--space-md);
    text-align: center;
    transition: all 0.3s ease;
}

.party-bonus-display.full-bonus {
    background: linear-gradient(135deg, rgba(201, 162, 39, 0.2), rgba(201, 162, 39, 0.1));
    border-color: var(--color-accent);
    animation: bonusGlow 2s ease-in-out infinite;
}

@keyframes bonusGlow {
    0%, 100% { box-shadow: 0 0 5px rgba(201, 162, 39, 0.3); }
    50% { box-shadow: 0 0 15px rgba(201, 162, 39, 0.5); }
}

.party-bonus-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
}

.bonus-icon {
    font-size: 1.2rem;
}

.bonus-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.bonus-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-success);
}

.party-bonus-display.full-bonus .bonus-value {
    color: var(--color-accent);
}

.bonus-description {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: var(--space-xs);
}

.story-party-actions {
    display: flex;
    gap: var(--space-sm);
    padding: var(--space-md);
    background: var(--bg-secondary);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
}

.story-party-actions .btn {
    flex: 1;
}

/* ストーリーパーティ選択画面のカードリストに下部の余白を追加 */
#story-party-select-screen .card-list-container {
    padding-bottom: 100px;
}

#story-party-select-screen .card-list {
    padding-bottom: var(--space-md);
}

/* Kingdom Select */
.kingdom-select-content {
    padding: var(--space-sm) var(--space-md);
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 60px);
    padding-top: 5vh;
}

.screen-title-image {
    display: flex;
    justify-content: center;
    margin-bottom: var(--space-xs);
}

.screen-title-image img {
    max-width: 240px;
    height: auto;
    object-fit: contain;
}

.kingdom-select-intro {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
    font-size: 0.85rem;
}

.kingdom-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
    padding: var(--space-sm);
}

.kingdom-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    cursor: pointer;
    transition: all 0.2s ease-out;
    border: none;
    position: relative;
    overflow: hidden;
    transform: translateY(0);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    text-align: center;
    min-height: 160px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* 巻物風背景画像 */
.kingdom-card[data-kingdom="flamecrest"] {
    background-image: url('/assets/backgrounds/scrolls/scroll_flamecrest.png');
}
.kingdom-card[data-kingdom="abyssal"] {
    background-image: url('/assets/backgrounds/scrolls/scroll_abyssal.png');
}
.kingdom-card[data-kingdom="crystalbloom"] {
    background-image: url('/assets/backgrounds/scrolls/scroll_crystalbloom.png');
}
.kingdom-card[data-kingdom="ironblood"] {
    background-image: url('/assets/backgrounds/scrolls/scroll_ironblood.png');
}
.kingdom-card[data-kingdom="sentinel"] {
    background-image: url('/assets/backgrounds/scrolls/scroll_sentinel.png');
}

/* 背景画像の上にオーバーレイ */
.kingdom-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        135deg,
        rgba(0, 0, 0, 0.1) 0%,
        rgba(0, 0, 0, 0.3) 100%
    );
    pointer-events: none;
    z-index: 0;
}

/* 子要素を前面に */
.kingdom-card > * {
    position: relative;
    z-index: 1;
}

.kingdom-card:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

.kingdom-card:active {
    transform: translateY(-2px) scale(1.01);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
    transition: all 0.05s ease-out;
}

.kingdom-card.conquered {
    border: 3px solid var(--color-success);
}

.kingdom-card.conquered::after {
    content: 'CONQUERED';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-15deg);
    font-size: 0.9rem;
    font-weight: 700;
    color: #fff;
    background: var(--color-success);
    padding: var(--space-xs) var(--space-md);
    border: 2px solid #fff;
    border-radius: var(--radius-sm);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    z-index: 10;
}

.kingdom-icon {
    font-size: 2rem;
    margin-bottom: var(--space-xs);
    display: flex;
    align-items: center;
    justify-content: center;
}

.kingdom-icon .icon {
    width: 72px;
    height: 72px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

.kingdom-name {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 4px;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8), 0 0 8px rgba(0, 0, 0, 0.5);
}

.kingdom-theme {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 4px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.kingdom-knight-order {
    font-size: 0.7rem;
    color: var(--kingdom-color, #fff);
    font-weight: 600;
    margin-bottom: 0;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.kingdom-progress-bar {
    height: 6px;
    background: var(--bg-card);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.kingdom-progress-fill {
    height: 100%;
    background: var(--kingdom-color, var(--color-primary));
    transition: width 0.3s;
}

/* 王国進捗テキスト表示 */
.kingdom-progress-text {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 6px 10px;
    border-radius: var(--radius-md);
    margin-top: 8px;
}

.kingdom-progress-text .progress-icon {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.kingdom-progress-text.not-started {
    background: rgba(100, 100, 100, 0.3);
    color: var(--text-secondary);
}

.kingdom-progress-text.in-progress {
    background: rgba(59, 130, 246, 0.3);
    color: #60a5fa;
}

.kingdom-progress-text.conquered {
    background: rgba(34, 197, 94, 0.3);
    color: #4ade80;
}

/* Kingdom Detail */
.kingdom-detail-content {
    padding: var(--space-md);
}

.kingdom-intro {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

.kingdom-cause {
    background: linear-gradient(135deg, rgba(212, 165, 71, 0.1), rgba(212, 165, 71, 0.05));
    border: 1px solid rgba(212, 165, 71, 0.3);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-bottom: var(--space-lg);
}

.kingdom-cause h4 {
    color: var(--color-accent);
    font-size: 0.9rem;
    margin-bottom: var(--space-sm);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.kingdom-cause h4 .icon {
    width: 24px;
    height: 24px;
}

.kingdom-cause p {
    font-size: 0.8rem;
    line-height: 1.5;
    color: var(--text-secondary);
}

.kingdom-mission {
    margin-top: var(--space-sm);
    padding-top: var(--space-sm);
    border-top: 1px solid rgba(212, 165, 71, 0.2);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.stage-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.stage-item {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    cursor: pointer;
    transition: all 0.15s ease-out;
    border: 2px solid transparent;
    transform: translateX(0);
    box-shadow: var(--shadow-card);
}

.stage-item:hover:not(.locked) {
    background: var(--bg-card);
    transform: translateX(6px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.stage-item:active:not(.locked) {
    transform: translateX(2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.05s ease-out;
}

.stage-item.cleared {
    border-color: var(--color-success);
    opacity: 0.8;
}

.stage-item.locked {
    opacity: 0.5;
    cursor: not-allowed;
}

.stage-item.over-leveled {
    border-color: var(--color-warning);
    background: rgba(255, 193, 7, 0.1);
}

.level-warning {
    color: var(--color-warning);
    font-size: 0.9rem;
    margin-left: 4px;
    animation: pulse-warning 1.5s ease-in-out infinite;
}

@keyframes pulse-warning {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.stage-number {
    width: 36px;
    height: 36px;
    background: var(--bg-card);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.stage-item.cleared .stage-number {
    background: var(--color-success);
}

.stage-info {
    flex: 1;
}

.stage-name {
    font-weight: 600;
    margin-bottom: 2px;
}

.stage-boss {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.stage-level-req {
    font-size: 0.7rem;
    color: var(--text-muted);
    background: var(--bg-card);
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

.stage-item.locked .stage-level-req {
    color: var(--color-danger);
}

/* Stage Enemy Icons */
.stage-enemies {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 70px;
}

.enemies-label {
    font-size: 0.6rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.enemy-icons {
    display: flex;
    gap: 2px;
}

.enemy-mini-icon {
    width: 20px;
    height: 20px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
}

.enemy-mini-icon.unknown {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    color: var(--text-muted);
}

/* Difficulty Badges */
.difficulty-badge {
    font-size: 0.55rem;
    padding: 1px 4px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    margin-left: 4px;
    vertical-align: middle;
}

.difficulty-badge.standard {
    background: var(--color-success);
    color: white;
}

.difficulty-badge.hard {
    background: var(--color-warning);
    color: #1a1a2e;
}

.difficulty-badge.extreme {
    background: linear-gradient(135deg, #e74c3c, #9b59b6);
    color: white;
    animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Difficulty-based Stage Styling */
.stage-item.hard {
    border-left: 3px solid var(--color-warning);
}

.stage-item.extreme {
    border-left: 3px solid #9b59b6;
    background: linear-gradient(90deg, rgba(155, 89, 182, 0.1), transparent);
}

.stage-item.extreme:hover:not(.locked) {
    background: linear-gradient(90deg, rgba(155, 89, 182, 0.2), var(--bg-card));
}

/* Story Dialogue Screen */
#story-dialogue-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    overflow: hidden;
}

.dialogue-background {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    /* デフォルト背景（JSで上書きされる） */
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%) center/cover no-repeat;
    transition: background 0.3s ease;
    z-index: 0;
}

.dialogue-container {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    padding: var(--space-lg);
    padding-bottom: env(safe-area-inset-bottom, var(--space-lg));
}

.dialogue-characters {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-xl);
    padding: var(--space-xl) 0;
}

.dialogue-character {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    transition: all 0.3s ease;
}

.dialogue-character.active {
    transform: scale(1.1);
}

.dialogue-character.inactive {
    opacity: 0.4;
    filter: grayscale(0.5);
}

.character-portrait {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-lg);
    object-fit: cover;
    border: 3px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.dialogue-character.left .character-portrait {
    border-color: var(--color-primary);
}

.dialogue-character.right .character-portrait {
    border-color: var(--color-danger);
}

.dialogue-character.active .character-portrait {
    box-shadow: 0 0 20px rgba(79, 70, 229, 0.5);
    animation: portrait-glow 2s infinite;
}

@keyframes portrait-glow {
    0%, 100% { box-shadow: 0 0 15px rgba(79, 70, 229, 0.4); }
    50% { box-shadow: 0 0 25px rgba(79, 70, 229, 0.6); }
}

.character-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.dialogue-vs {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--color-warning);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.dialogue-box {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    min-height: 120px;
    cursor: pointer;
}

.dialogue-speaker {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: var(--space-sm);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.dialogue-speaker.enemy {
    color: var(--color-danger);
}

.dialogue-text {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-primary);
    min-height: 48px;
}

.dialogue-indicator {
    position: absolute;
    bottom: var(--space-sm);
    right: var(--space-md);
    color: var(--text-muted);
    font-size: 0.8rem;
    animation: bounce-indicator 1s infinite;
}

@keyframes bounce-indicator {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(4px); }
}

.dialogue-progress {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.skip-dialogue-btn {
    position: absolute;
    top: var(--space-lg);
    right: var(--space-lg);
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-secondary);
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 10;
}

.skip-dialogue-btn:hover {
    background: rgba(0, 0, 0, 0.7);
    color: var(--text-primary);
}

/* Party Manage */
.party-manage-content {
    padding: var(--space-md);
}

.party-cards {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.party-card-item {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    display: flex;
    gap: var(--space-md);
    cursor: pointer;
    transition: all 0.2s;
}

.party-card-item:hover {
    background: var(--bg-card);
}

.party-card-image {
    width: 80px;
    height: 100px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    overflow: hidden;
    position: relative;
}

.party-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.party-card-image .dupe-badge {
    position: absolute;
    bottom: 4px;
    right: 4px;
    font-size: 0.7rem;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.party-card-info {
    flex: 1;
}

.party-card-name {
    font-weight: 700;
    margin-bottom: var(--space-xs);
}

.party-card-level {
    font-size: 0.85rem;
    color: var(--color-accent);
    margin-bottom: var(--space-sm);
}

.party-card-exp-bar {
    height: 8px;
    background: var(--bg-card);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: var(--space-xs);
}

.party-card-exp-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-info), var(--color-primary));
    transition: width 0.3s;
}

.party-card-exp-text {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.party-card-points {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    margin-top: var(--space-sm);
    font-size: 0.8rem;
}

.party-card-points .points-available {
    color: var(--color-success);
    font-weight: 600;
}

/* ========================
   Daily Bonus Banner
   ======================== */
.daily-bonus-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #7c3aed, #a855f7, #c084fc);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

.daily-bonus-banner.claimed {
    background: linear-gradient(135deg, #4b5563, #6b7280, #9ca3af);
    box-shadow: 0 4px 12px rgba(75, 85, 99, 0.2);
}

.daily-bonus-left {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.daily-bonus-icon {
    font-size: 1.8rem;
}

.daily-bonus-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.daily-bonus-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: #fff;
}

.special-points-display {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.9);
}

.special-points-display strong {
    color: #fde68a;
    font-size: 1rem;
}

.daily-quiz-btn {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-md);
    padding: 8px 16px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.daily-quiz-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.daily-quiz-btn.claimed {
    background: rgba(255, 255, 255, 0.1);
    cursor: default;
    opacity: 0.8;
}

/* Use Special Points Button */
.use-special-points-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: var(--space-md);
}

.use-special-points-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #d97706, #b45309);
    transform: translateY(-1px);
}

.use-special-points-btn:disabled {
    background: var(--bg-secondary);
    color: var(--text-muted);
    cursor: not-allowed;
}

/* ========================
   Party Manage Card Grid
   ======================== */
.party-manage-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

@media (max-width: 340px) {
    .party-manage-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.party-manage-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.party-manage-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.party-manage-card-image {
    width: 100%;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    background: var(--bg-card);
}

.party-manage-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.party-manage-card-info {
    padding: 6px 8px;
}

.party-manage-card-name {
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.party-manage-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2px;
}

.party-manage-card-level {
    font-size: 0.65rem;
    color: var(--color-accent);
    font-weight: 600;
}

.party-manage-card-points {
    font-size: 0.6rem;
    color: var(--color-success);
    font-weight: 700;
    background: rgba(34, 197, 94, 0.15);
    padding: 1px 5px;
    border-radius: var(--radius-sm);
}

/* ========================
   Quiz Modal
   ======================== */
.quiz-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-md);
}

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

.quiz-modal {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 400px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.quiz-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--bg-secondary);
}

.quiz-title {
    font-weight: 700;
    font-size: 1.1rem;
}

.quiz-close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px;
}

.quiz-progress-bar {
    height: 4px;
    background: var(--bg-secondary);
}

.quiz-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #7c3aed, #a855f7);
    transition: width 0.3s ease;
}

.quiz-body {
    padding: var(--space-lg);
}

.quiz-question-num {
    font-size: 0.8rem;
    color: var(--color-accent);
    font-weight: 600;
    margin-bottom: var(--space-xs);
}

.quiz-question-text {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: var(--space-lg);
    line-height: 1.5;
}

.quiz-choices {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.quiz-choice {
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    color: var(--text-primary);
}

.quiz-choice:hover:not(.correct):not(.wrong):not(:disabled) {
    border-color: var(--color-accent);
    background: var(--bg-card);
}

.quiz-choice.correct {
    border-color: #22c55e;
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
    font-weight: 600;
}

.quiz-choice.wrong {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.quiz-choice:disabled {
    cursor: default;
}

/* Quiz Result */
.quiz-result {
    text-align: center;
    padding: var(--space-lg) 0;
}

.quiz-result-icon {
    font-size: 3rem;
    margin-bottom: var(--space-md);
}

.quiz-result-count {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: var(--space-sm);
}

.quiz-result-points {
    font-size: 1.1rem;
    color: #f59e0b;
    font-weight: 600;
    margin-bottom: var(--space-lg);
}

.quiz-result-points.no-points {
    color: var(--text-muted);
}

.quiz-result-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.quiz-btn {
    padding: 12px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.quiz-btn.primary {
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    color: #fff;
}

.quiz-btn.primary:hover {
    transform: translateY(-1px);
}

.quiz-btn.secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.quiz-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========================
   Special Points Modal
   ======================== */
.special-points-modal {
    max-width: 440px;
}

.sp-card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: var(--space-md);
}

.sp-card-item {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.sp-card-item:hover {
    border-color: var(--color-accent);
}

.sp-card-item.selected {
    border-color: #f59e0b;
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.3);
}

.sp-card-item.max-reached {
    opacity: 0.5;
    cursor: not-allowed;
}

.sp-card-thumb {
    width: 100%;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    background: var(--bg-card);
}

.sp-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sp-card-name {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 4px 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sp-card-bonus {
    font-size: 0.6rem;
    color: var(--text-muted);
    padding: 0 6px 4px;
}

.points-input-section {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-top: var(--space-md);
}

.points-input-label {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: var(--space-sm);
}

.points-input-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
    margin-bottom: var(--space-sm);
}

.points-input-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--color-accent);
    background: transparent;
    color: var(--color-accent);
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.points-input-btn:hover:not(:disabled) {
    background: var(--color-accent);
    color: #fff;
}

.points-input-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.points-input-value {
    font-size: 1.5rem;
    font-weight: 700;
    min-width: 50px;
    text-align: center;
    color: #f59e0b;
}

.points-input-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.sp-assign-btn {
    width: 100%;
    margin-top: var(--space-md);
    padding: 12px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
}

.sp-assign-btn:hover:not(:disabled) {
    transform: translateY(-1px);
}

.sp-assign-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Card Growth */
.card-growth-content {
    padding: var(--space-md);
}

.growth-card-info {
    display: flex;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--bg-card);
}

.growth-card-portrait {
    width: 100px;
    height: 130px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.growth-card-portrait img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.growth-card-details {
    flex: 1;
}

.growth-card-name {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: var(--space-xs);
}

.growth-card-kingdom {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: var(--space-sm);
}

.growth-level-info {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-bottom: var(--space-lg);
}

.growth-level-display {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-sm);
}

.growth-level-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-accent);
}

.growth-level-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.growth-exp-bar {
    height: 12px;
    background: var(--bg-card);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: var(--space-xs);
}

.growth-exp-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
    transition: width 0.3s;
}

.growth-exp-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: right;
}

.growth-stats-section h3 {
    margin-bottom: var(--space-md);
    font-size: 1rem;
}

.growth-available-points {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, rgba(92, 184, 92, 0.2), rgba(92, 184, 92, 0.1));
    border: 1px solid rgba(92, 184, 92, 0.3);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
    margin-bottom: var(--space-md);
}

.growth-available-points .points-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--color-success);
}

.growth-stat-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.growth-stat-row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
}

.growth-stat-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.growth-stat-name {
    flex: 1;
    font-size: 0.85rem;
}

.growth-stat-value {
    min-width: 60px;
    text-align: right;
    font-weight: 600;
}

.growth-stat-base {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.growth-stat-bonus {
    font-size: 0.7rem;
    color: var(--color-success);
}

.growth-stat-controls {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.growth-stat-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease-out;
    transform: scale(1);
}

.growth-stat-btn:hover:not(:disabled) {
    background: var(--color-primary);
    transform: scale(1.1);
}

.growth-stat-btn:active:not(:disabled) {
    background: var(--color-primary-dark);
    transform: scale(0.95);
    transition: all 0.05s ease-out;
}

.growth-stat-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.growth-stat-pending {
    min-width: 30px;
    text-align: center;
    font-size: 0.85rem;
    color: var(--color-accent);
}

.growth-actions {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-lg);
}

.growth-actions .btn {
    flex: 1;
}

/* Story Battle Result */
.story-battle-result {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: var(--space-md);
}

.story-battle-result .result-content {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.story-battle-result .result-title {
    font-size: 2rem;
    margin-bottom: var(--space-lg);
}

.story-battle-result .result-title.victory {
    color: var(--color-accent);
    text-shadow: 0 0 20px rgba(212, 165, 71, 0.5);
}

.story-battle-result .result-title.defeat {
    color: var(--color-danger);
}

.exp-gained {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
}

.exp-gained h4 {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: var(--space-sm);
}

.exp-card-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.exp-card-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
}

.exp-card-item .exp-value {
    color: var(--color-info);
    font-weight: 600;
}

.level-up-info {
    background: linear-gradient(135deg, rgba(212, 165, 71, 0.2), rgba(212, 165, 71, 0.1));
    border: 1px solid rgba(212, 165, 71, 0.3);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-bottom: var(--space-lg);
}

.level-up-title {
    color: var(--color-accent);
    font-weight: 700;
    margin-bottom: var(--space-sm);
}

.level-up-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    font-size: 0.85rem;
}

.level-up-item {
    display: flex;
    justify-content: space-between;
}

.level-up-item .new-level {
    color: var(--color-accent);
    font-weight: 600;
}

.level-up-item .points-gained {
    color: var(--color-success);
    font-size: 0.75rem;
}

.result-actions {
    display: flex;
    gap: var(--space-sm);
}

.result-actions .btn {
    flex: 1;
}

/* =====================
   Help Screen Styles
   ===================== */
.help-content {
    padding: var(--space-md);
    padding-bottom: 100px;
    overflow-y: auto;
    height: calc(100vh - 60px);
}

.help-tabs {
    display: flex;
    gap: var(--space-xs);
    margin-bottom: var(--space-lg);
    overflow-x: auto;
    padding-bottom: var(--space-xs);
    -webkit-overflow-scrolling: touch;
}

.help-tab {
    flex-shrink: 0;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.help-tab:hover {
    background: var(--bg-hover);
    border-color: var(--color-accent);
}

.help-tab.active {
    background: var(--color-accent);
    color: var(--bg-dark);
    border-color: var(--color-accent);
    font-weight: 600;
}

.help-section {
    display: none;
}

.help-section.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.help-section h3 {
    color: var(--text-primary);
    font-size: 1.25rem;
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 2px solid var(--color-accent);
}

.help-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
    border: 1px solid var(--border-subtle);
}

.help-card h4 {
    color: var(--color-accent);
    font-size: 1rem;
    margin-bottom: var(--space-sm);
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.help-card p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: var(--space-sm);
}

.help-card p:last-child {
    margin-bottom: 0;
}

.help-card ul, .help-card ol {
    color: var(--text-secondary);
    margin-left: var(--space-md);
    line-height: 1.8;
}

.help-card li {
    margin-bottom: var(--space-xs);
}

.help-card strong {
    color: var(--text-primary);
}

/* Help Table */
.help-table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--space-md) 0;
    font-size: 0.9rem;
}

.help-table th,
.help-table td {
    padding: var(--space-sm);
    border: 1px solid var(--border-color);
    text-align: left;
}

.help-table th {
    background: var(--bg-secondary);
    font-weight: 600;
    color: var(--text-primary);
}

.help-table td {
    background: var(--bg-primary);
    color: var(--text-secondary);
}

.help-table tr:nth-child(even) td {
    background: var(--bg-tertiary);
}

.help-table td[rowspan] {
    vertical-align: top;
    font-weight: 500;
}

/* Kingdom Badges in Help */
.kingdom-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    color: white;
}

.kingdom-badge.flamecrest {
    background: linear-gradient(135deg, #d44a1a, #ff6b35);
}

.kingdom-badge.abyssal {
    background: linear-gradient(135deg, #1a4ad4, #4a7aff);
}

.kingdom-badge.crystalbloom {
    background: linear-gradient(135deg, #2a9a4a, #5acc7a);
}

.kingdom-badge.ironblood {
    background: linear-gradient(135deg, #6a5a4a, #9a8a7a);
}

/* Stats Explanation */
.stats-explain {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.stats-explain .stat-row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-xs) 0;
    border-bottom: 1px solid var(--border-subtle);
}

.stats-explain .stat-row:last-child {
    border-bottom: none;
}

.stats-explain .stat-name {
    min-width: 50px;
    color: var(--color-accent);
    font-weight: 600;
    font-size: 0.9rem;
}

.stats-explain .stat-desc {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Skill Types in Help */
.skill-type {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    color: white;
}

.skill-type.attack {
    background: var(--color-danger);
}

.skill-type.heal {
    background: var(--color-success);
}

.skill-type.buff {
    background: var(--color-info);
}

.skill-type.debuff {
    background: var(--color-epic);
}

.skill-type.special {
    background: var(--color-legendary);
}

/* Element Grid */
.element-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-sm);
    margin-top: var(--space-sm);
}

.element-item {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-sm);
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.element-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 700;
    color: white;
}

.element-icon.fire { background: linear-gradient(135deg, #d44a1a, #ff6b35); }
.element-icon.water { background: linear-gradient(135deg, #1a6ad4, #4a9aff); }
.element-icon.earth { background: linear-gradient(135deg, #8a6a4a, #ba9a6a); }
.element-icon.light { background: linear-gradient(135deg, #d4aa1a, #ffd44a); }
.element-icon.dark { background: linear-gradient(135deg, #4a3a6a, #7a5a9a); }
.element-icon.nature { background: linear-gradient(135deg, #2a8a4a, #4aba6a); }

/* Rarity Badges */
.rarity-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    color: white;
}

.rarity-badge.common { background: var(--color-common); }
.rarity-badge.uncommon { background: var(--color-uncommon); }
.rarity-badge.rare { background: var(--color-rare); }
.rarity-badge.epic { background: var(--color-epic); }
.rarity-badge.legendary { background: var(--color-legendary); }

/* Help Button Style */
.menu-btn.help-btn {
    background: linear-gradient(145deg, rgba(30, 42, 56, 0.85), rgba(201, 162, 39, 0.2));
    border: 1px solid rgba(201, 162, 39, 0.5);
}

/* ==============================================
   Battle Screen Responsive Adjustments
   ============================================== */

/* 小さい画面 */
@media (max-height: 600px) {
    .battle-field {
        padding-bottom: 150px;
        gap: var(--space-xs);
    }

    .action-dock {
        max-height: 40vh;
    }

    .action-list {
        max-height: calc(40vh - 50px);
    }

    .party-member {
        width: 65px;
    }

    .stats-panel-content {
        padding: var(--space-xs);
        min-width: 220px;
    }
}

/* 大きい画面 */
@media (min-height: 800px) {
    .battle-field {
        padding: var(--space-md);
        padding-bottom: 220px;
        gap: var(--space-md);
    }

    .party-member {
        width: 100px;
        padding: var(--space-sm);
    }

    .party-member .portrait {
        border-radius: var(--radius-md);
    }

    .party-member .name {
        font-size: 0.7rem;
        margin-top: 4px;
    }

    .action-dock {
        max-height: 45vh;
    }

    .action-list {
        max-height: calc(45vh - 60px);
        gap: 6px;
    }

    .action-chip {
        padding: 8px 10px;
    }
}

/* 非常に大きい画面 */
@media (min-height: 900px) {
    .battle-field {
        padding-bottom: 250px;
    }

    .party-member {
        width: 110px;
    }

    .action-list {
        gap: 8px;
    }
}

/* =====================
   鉱物図鑑画面
   ===================== */
#mineral-guide-screen {
    background-image: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.7)), url('/assets/backgrounds/menu/menu_collection.jpg');
    background-attachment: fixed;
    background-size: cover;
    background-position: center;
}

#mineral-guide-screen .screen-header {
    position: relative;
    background: rgba(0, 0, 0, 0.6);
}

#mineral-guide-detail {
    background-image: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.7)), url('/assets/backgrounds/menu/menu_collection.jpg');
}

.guide-topics-list {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.guide-topic-card {
    background: var(--bg-panel);
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.guide-topic-card:active {
    transform: scale(0.98);
}

.guide-topic-card .topic-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.guide-topic-card .topic-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.guide-topic-card .topic-image .placeholder {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.guide-topic-card .topic-info {
    padding: var(--space-md);
}

.guide-topic-card .topic-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-accent);
    margin: 0 0 var(--space-xs) 0;
}

.guide-topic-card .topic-subtitle {
    font-size: 0.9rem;
    color: var(--text-primary);
    margin: 0 0 var(--space-sm) 0;
}

.guide-topic-card .topic-description {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
}

/* 鉱物図鑑詳細画面 */
.guide-detail-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.guide-detail-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.guide-detail-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.guide-detail-image .placeholder {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.guide-detail-text {
    background: var(--bg-panel);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    line-height: 1.8;
    font-size: 0.95rem;
    color: var(--text-primary);
    white-space: pre-wrap;
}

.guide-detail-text sub {
    font-size: 0.75em;
    vertical-align: sub;
}

.guide-detail-text sup {
    font-size: 0.75em;
    vertical-align: super;
}

.guide-detail-text .placeholder {
    color: var(--text-muted);
    font-style: italic;
}

.guide-empty-message {
    text-align: center;
    color: var(--text-muted);
    padding: var(--space-xl);
    font-size: 0.9rem;
}

/* =====================
   鉱物図鑑（鉱物一覧）
   ===================== */
#mineral-guide-screen.active {
    height: 100vh;
    height: 100dvh;
    min-height: unset;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.guide-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.guide-search-bar {
    display: flex;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    flex-shrink: 0;
}

.guide-search-bar input {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.guide-search-bar input:focus {
    outline: none;
    border-color: var(--color-accent);
}

.filter-categories {
    display: flex;
    gap: var(--space-xs);
    padding: 0 var(--space-md);
    flex-shrink: 0;
}

/* 検索セクション（下部固定） */
.mineral-search-section {
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    flex-shrink: 0;
    order: 2; /* 下部に配置 */
    border-top: 1px solid var(--border-subtle);
}

.mineral-search-section .search-row {
    display: flex;
    gap: var(--space-sm);
}

.mineral-search-section .search-input {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.mineral-search-section .search-input:focus {
    outline: none;
    border-color: var(--color-accent);
}

/* カテゴリ選択式フィルター */
.category-filter-section {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.category-buttons {
    display: flex;
    gap: var(--space-xs);
}

.category-btn {
    flex: 1;
    padding: var(--space-xs) var(--space-sm);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.category-btn:active {
    transform: scale(0.97);
}

.category-btn.active {
    background: var(--color-accent);
    color: #fff;
    border-color: var(--color-accent);
}

.category-values {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    min-height: 36px;
    padding: var(--space-xs);
    margin: 0 var(--space-md);
    flex-shrink: 0;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    align-items: center;
}

.category-hint {
    color: var(--text-muted);
    font-size: 0.75rem;
    width: 100%;
    text-align: center;
}

.value-btn {
    padding: 4px 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.value-btn:active {
    transform: scale(0.95);
}

.value-btn.selected {
    background: var(--color-accent);
    color: #fff;
    border-color: var(--color-accent);
}

/* アクティブフィルター表示 */
.active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    min-height: 24px;
    flex-shrink: 0;
    padding: 0 var(--space-md);
}

.active-filters:empty {
    display: none;
}

.filter-tag {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: var(--color-accent);
    color: #fff;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
}

.filter-tag-remove {
    cursor: pointer;
    font-weight: bold;
    opacity: 0.8;
}

.filter-tag-remove:hover {
    opacity: 1;
}

.btn.small {
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.8rem;
    white-space: nowrap;
}

/* 初期状態メッセージ */
.mineral-initial-message {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: var(--space-xl);
    color: var(--text-muted);
}

.mineral-initial-message p {
    font-size: 0.9rem;
    line-height: 1.6;
}

.mineral-encyclopedia-list {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: var(--space-md);
    min-height: 0;
}

.mineral-encyclopedia-list .mineral-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: var(--space-md);
    align-content: start;
}

/* 鉱物図鑑カード */
.mineral-card-entry {
    aspect-ratio: 3 / 4;
    background: var(--bg-card-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    position: relative;
}

.mineral-card-entry:active {
    transform: scale(0.97);
}

.mineral-card-image {
    flex: 1;
    background: var(--bg-secondary);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mineral-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mineral-card-image.no-image {
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-card));
}

.mineral-card-image.no-image::after {
    content: '画像なし';
    color: var(--text-muted);
    font-size: 0.7rem;
}

.mineral-card-info {
    padding: var(--space-xs);
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
    gap: 1px;
}

.mineral-card-name-ja {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.mineral-card-name-en {
    font-size: 0.6rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.no-image-placeholder {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* =====================
   鉱物詳細画面
   ===================== */
#mineral-detail-screen {
    background-image: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.7)), url('/assets/backgrounds/menu/menu_collection.jpg');
    background-attachment: fixed;
}

#mineral-detail-screen.active {
    height: 100vh;
    height: 100dvh;
    min-height: unset;
    overflow: hidden;
}

.mineral-detail-wrapper {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

.mineral-detail-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    padding-bottom: 100px;
}

.mineral-detail-image {
    width: 100%;
    margin: 0 0 var(--space-md);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.mineral-detail-image img {
    width: 100%;
    height: auto;
    display: block;
}

.mineral-detail-image.no-image {
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-card));
}

.mineral-detail-image .no-image-placeholder {
    color: var(--text-muted);
    font-size: 1rem;
}

.mineral-detail-section {
    background: var(--bg-panel);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
}

.mineral-detail-section h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--color-accent);
    margin: 0;
}

.mineral-detail-section h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 var(--space-sm) 0;
}

.mineral-formula {
    font-size: 1rem;
    color: var(--text-secondary);
    margin: var(--space-xs) 0 0 0;
    font-family: var(--font-mono);
}

.mineral-formula sub {
    font-size: 0.75em;
    vertical-align: sub;
}

.mineral-header-section {
    text-align: center;
}

.mineral-header-section h3 {
    margin-bottom: var(--space-xs);
}

.mineral-properties {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm);
}

.property-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.property-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.property-value {
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 500;
}

.mineral-description,
.mineral-ability {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin: 0;
}

/* =====================
   チャットプロンプト
   ===================== */
.mineral-chat-prompt {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, var(--bg-primary) 80%, transparent);
    padding: var(--space-lg) var(--space-md);
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
}

.mineral-chat-prompt > .chat-character-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--color-accent);
    flex-shrink: 0;
}

.mineral-chat-prompt > span {
    font-size: 0.9rem;
    color: var(--text-primary);
}

.chat-character-bubble {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.chat-character-bubble .chat-character-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--color-accent);
}

.chat-bubble {
    background: var(--bg-panel);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-lg);
    font-size: 0.85rem;
    color: var(--text-primary);
    position: relative;
}

.chat-bubble::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-right-color: var(--bg-panel);
}

.chat-open-btn {
    width: 100%;
    max-width: 300px;
}

/* =====================
   チャットコンテナ
   ===================== */
.mineral-chat-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60vh;
    background: var(--bg-primary);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    display: flex;
    flex-direction: column;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
    z-index: 200;
}

.mineral-chat-container.hidden {
    display: none;
}

.mineral-chat-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md);
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-secondary);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.mineral-chat-header .chat-header-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--color-accent);
}

.mineral-chat-header .chat-character-name {
    flex: 1;
    font-weight: 600;
    color: var(--text-primary);
}

.mineral-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    min-height: 0;
}

.mineral-chat-input-area {
    display: flex;
    gap: var(--space-sm);
    padding: var(--space-md);
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.mineral-chat-input {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.mineral-chat-input:focus {
    outline: none;
    border-color: var(--color-accent);
}

.mineral-chat-send {
    padding: var(--space-sm) var(--space-md);
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    cursor: pointer;
}

.mineral-chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chat-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md);
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-secondary);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.chat-header .chat-character-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--color-accent);
}

.chat-header span {
    flex: 1;
    font-weight: 600;
    color: var(--text-primary);
}

.chat-close-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: var(--space-xs);
    line-height: 1;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.chat-message {
    max-width: 85%;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-lg);
    font-size: 0.9rem;
    line-height: 1.5;
}

.chat-message p {
    margin: 0;
}

.chat-message.user-message {
    align-self: flex-end;
    background: var(--color-primary);
    color: white;
    border-bottom-right-radius: var(--radius-sm);
}

.chat-message.ai-message {
    align-self: flex-start;
    background: var(--bg-panel);
    color: var(--text-primary);
    border-bottom-left-radius: var(--radius-sm);
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
}

.chat-message-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.chat-message.ai-message.loading {
    color: var(--text-muted);
    font-style: italic;
}

.chat-message.ai-message.error {
    background: rgba(220, 53, 69, 0.2);
    color: #ff6b6b;
}

.chat-input-area {
    display: flex;
    gap: var(--space-sm);
    padding: var(--space-md);
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-secondary);
}

.chat-input-area input {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.chat-input-area input:focus {
    outline: none;
    border-color: var(--color-accent);
}

.chat-input-area button {
    padding: var(--space-sm) var(--space-md);
}

/* =====================
   PWA Install Dialog
   ===================== */
.pwa-install-dialog {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.pwa-install-dialog.show {
    opacity: 1;
    visibility: visible;
}

.pwa-install-content {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    text-align: center;
    max-width: 320px;
    margin: var(--space-md);
    transform: translateY(20px);
    transition: transform 0.3s;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-subtle);
}

.pwa-install-dialog.show .pwa-install-content {
    transform: translateY(0);
}

.pwa-install-icon {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.pwa-install-content h3 {
    color: var(--text-primary);
    margin: 0 0 var(--space-sm) 0;
    font-size: 1.25rem;
}

.pwa-install-content p {
    color: var(--text-secondary);
    margin: 0 0 var(--space-lg) 0;
    font-size: 0.9rem;
    line-height: 1.5;
}

.pwa-install-buttons {
    display: flex;
    gap: var(--space-sm);
    justify-content: center;
}

.pwa-install-buttons .btn {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    font-size: 0.9rem;
}

/* iOS PWA Instructions */
.pwa-ios-instructions {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-bottom: var(--space-lg);
    text-align: left;
}

.pwa-ios-instructions p {
    margin: 0;
    padding: var(--space-xs) 0;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.pwa-ios-instructions .ios-share-icon {
    display: inline-block;
    background: var(--color-primary);
    color: white;
    width: 24px;
    height: 24px;
    line-height: 24px;
    text-align: center;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    vertical-align: middle;
    margin: 0 4px;
}

/* =====================
   Story Result Screen
   ===================== */
#story-result-screen {
    align-items: center;
    justify-content: center;
}

#story-result-screen .result-content {
    width: 100%;
    max-width: none;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: var(--space-lg);
    position: relative;
    overflow: hidden;
    background: transparent;
}

.result-victory,
.result-defeat {
    width: 100%;
    max-width: 400px;
    text-align: center;
    position: relative;
    z-index: 1;
}

.result-bg {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -1;
}

.result-illustration {
    width: 100%;
    max-width: 400px;
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
    opacity: 0.85;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.victory-bg {
    background: linear-gradient(180deg,
        rgba(201, 162, 39, 0.3) 0%,
        rgba(29, 98, 98, 0.8) 50%,
        rgba(21, 74, 74, 0.95) 100%);
}

.defeat-bg {
    background: linear-gradient(180deg,
        rgba(100, 50, 50, 0.4) 0%,
        rgba(50, 50, 60, 0.8) 50%,
        rgba(30, 30, 40, 0.95) 100%);
}

.result-header {
    margin-bottom: var(--space-xl);
}

.result-icon {
    font-size: 4rem;
    margin-bottom: var(--space-md);
    animation: resultIconPulse 2s ease-in-out infinite;
}

.victory-icon {
    color: var(--color-accent);
    text-shadow: 0 0 30px rgba(201, 162, 39, 0.6);
}

.defeat-icon {
    color: var(--color-danger);
    text-shadow: 0 0 20px rgba(181, 74, 74, 0.5);
}

@keyframes resultIconPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.result-title {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    margin: 0;
    text-transform: uppercase;
}

.result-title.victory {
    color: var(--color-accent);
    text-shadow: 0 2px 10px rgba(201, 162, 39, 0.5);
}

.result-title.defeat {
    color: var(--color-danger);
    text-shadow: 0 2px 10px rgba(181, 74, 74, 0.4);
}

.result-subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin: var(--space-xs) 0 0;
}

.result-info {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
}

.result-kingdom {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.kingdom-icon-result {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.result-stage {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 var(--space-xs);
}

.result-turns {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin: 0;
}

.result-rewards {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-bottom: var(--space-lg);
}

.result-rewards h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0 0 var(--space-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.reward-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    color: var(--color-accent);
    font-weight: 500;
}

.reward-icon {
    font-size: 1.2rem;
}

.result-message {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-bottom: var(--space-lg);
}

.result-message p {
    margin: 0;
    color: var(--text-secondary);
}

.result-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.result-actions .btn-primary,
.result-actions .btn-secondary {
    width: 100%;
    padding: var(--space-md);
    font-size: 1rem;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.result-actions .btn-primary {
    background: var(--color-accent);
    color: var(--bg-primary);
    font-weight: 600;
}

.result-actions .btn-primary:hover {
    background: var(--color-accent-light);
    transform: translateY(-2px);
}

.result-actions .btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.result-actions .btn-secondary:hover {
    background: var(--bg-secondary);
}

/* Experience Display */
.result-exp {
    margin-bottom: var(--space-md);
}

.result-exp h4 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0 0 var(--space-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.exp-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.exp-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-xs) var(--space-sm);
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
}

.exp-value {
    color: var(--color-accent);
    font-weight: 600;
}

/* Level Up Display */
.result-levelup {
    background: linear-gradient(135deg, rgba(201, 162, 39, 0.2), rgba(201, 162, 39, 0.1));
    border: 1px solid var(--color-accent);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-top: var(--space-md);
    animation: levelUpGlow 2s ease-in-out infinite;
}

@keyframes levelUpGlow {
    0%, 100% { box-shadow: 0 0 10px rgba(201, 162, 39, 0.3); }
    50% { box-shadow: 0 0 20px rgba(201, 162, 39, 0.6); }
}

.levelup-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--color-accent);
    text-align: center;
    margin-bottom: var(--space-sm);
    letter-spacing: 0.1em;
    text-shadow: 0 0 10px rgba(201, 162, 39, 0.5);
}

.levelup-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.levelup-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-xs) var(--space-sm);
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
}

.levelup-name {
    flex: 1;
}

.levelup-level {
    color: var(--color-accent);
    font-weight: 700;
    margin-right: var(--space-sm);
}

.levelup-points {
    color: var(--color-success);
    font-weight: 600;
    font-size: 0.9rem;
}

/* =====================
   Stats Calculation Card
   ===================== */
.stats-calc-card {
    border: 2px solid rgba(99, 102, 241, 0.5);
}

.stats-calc-card .info-card-header {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.3), transparent);
    border-bottom-color: rgba(99, 102, 241, 0.3);
}

.calc-section {
    margin-bottom: var(--space-lg);
}

.calc-section:last-child {
    margin-bottom: 0;
}

.calc-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-primary);
    margin-bottom: var(--space-sm);
    padding-bottom: var(--space-xs);
    border-bottom: 1px solid rgba(99, 102, 241, 0.3);
}

.calc-data-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm);
}

.calc-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.calc-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.calc-value {
    font-size: 0.85rem;
    color: var(--text-primary);
    font-weight: 500;
}

.calc-formula-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.calc-formula-item {
    background: rgba(99, 102, 241, 0.1);
    border-radius: var(--radius-sm);
    padding: var(--space-sm);
    border-left: 3px solid var(--color-primary);
}

.formula-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.formula-equation {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: 'Monaco', 'Consolas', monospace;
    margin-bottom: 4px;
}

.formula-result {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.formula-result strong {
    color: var(--color-accent);
    font-size: 1rem;
}

.formation-bars {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.formation-bar-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.formation-bar-item .bar-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    width: 40px;
    flex-shrink: 0;
}

.formation-bar-item .bar-track {
    flex: 1;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}

.formation-bar-item .bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.formation-bar-item .bar-fill.temp-bar {
    background: linear-gradient(90deg, #f59e0b, #ef4444);
}

.formation-bar-item .bar-fill.press-bar {
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
}

.formation-bar-item .bar-value {
    font-size: 0.75rem;
    color: var(--text-secondary);
    width: 80px;
    text-align: right;
    flex-shrink: 0;
}

/* =====================
   Compact Skills List
   ===================== */
.skills-list-compact {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.skill-row {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
    border-left: 3px solid var(--color-primary);
}

.skill-row.ultimate {
    border-left-color: var(--color-legendary);
    background: linear-gradient(90deg, rgba(249, 115, 22, 0.1), transparent);
}

.skill-name-row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
    padding-bottom: var(--space-xs);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.skill-name-row .skill-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.ultimate-badge {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--bg-primary);
    background: linear-gradient(135deg, var(--color-legendary), #fbbf24);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.skill-data-row {
    display: grid;
    grid-template-columns: auto auto auto 1fr;
    gap: var(--space-sm);
    align-items: start;
}

.skill-data-cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.skill-data-cell .skill-data-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.skill-data-cell .skill-data-value {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.skill-data-cell .skill-data-value.skill-type-attack {
    color: var(--color-fire);
}

.skill-data-cell .skill-data-value.skill-type-defense {
    color: var(--color-water);
}

.skill-data-cell .skill-data-value.skill-type-support {
    color: var(--color-earth);
}

.skill-data-cell .skill-data-value.skill-type-special {
    color: var(--color-legendary);
}

.skill-data-cell.skill-desc-cell {
    min-width: 0;
}

.skill-data-cell .skill-desc {
    font-size: 0.75rem;
    line-height: 1.4;
    color: var(--text-muted);
    white-space: normal;
    word-break: break-word;
}

/* Mobile responsive for skill data */
@media (max-width: 480px) {
    .skill-data-row {
        grid-template-columns: repeat(3, 1fr);
    }

    .skill-data-cell.skill-desc-cell {
        grid-column: 1 / -1;
        margin-top: var(--space-xs);
        padding-top: var(--space-xs);
        border-top: 1px dashed rgba(255, 255, 255, 0.1);
    }
}

/* Skill Effects Row */
.skill-effects-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-xs);
    margin-top: var(--space-xs);
    padding-top: var(--space-xs);
    border-top: 1px dashed rgba(255, 255, 255, 0.1);
}

.skill-effects-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.skill-effects-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.skill-effect-tag {
    display: inline-block;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
}

.skill-effect-tag.effect-damage {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.3), rgba(220, 38, 38, 0.2));
    border: 1px solid rgba(239, 68, 68, 0.5);
    color: #fca5a5;
}

.skill-effect-tag.effect-debuff {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.3), rgba(139, 92, 246, 0.2));
    border: 1px solid rgba(168, 85, 247, 0.5);
    color: #d8b4fe;
}

.skill-effect-tag.effect-buff {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.3), rgba(22, 163, 74, 0.2));
    border: 1px solid rgba(34, 197, 94, 0.5);
    color: #86efac;
}

.skill-effect-tag.effect-heal {
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.3), rgba(219, 39, 119, 0.2));
    border: 1px solid rgba(236, 72, 153, 0.5);
    color: #f9a8d4;
}

.skill-effect-tag.effect-neutral {
    background: linear-gradient(135deg, rgba(148, 163, 184, 0.3), rgba(100, 116, 139, 0.2));
    border: 1px solid rgba(148, 163, 184, 0.5);
    color: #cbd5e1;
}

/* Skill Meta Row (Lv, Type, Cost, Target, CT) */
.skill-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm) var(--space-md);
    margin-bottom: var(--space-xs);
}

.skill-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.skill-meta-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Skill Description Text */
.skill-desc-text {
    font-size: 0.78rem;
    line-height: 1.4;
    color: var(--text-muted);
    margin-bottom: var(--space-xs);
    padding-bottom: var(--space-xs);
    border-bottom: 1px dashed rgba(255, 255, 255, 0.08);
}

/* Skill Calculation Row */
.skill-calc-row {
    display: flex;
    align-items: baseline;
    gap: var(--space-xs);
    margin-top: var(--space-xs);
    padding-top: var(--space-xs);
    border-top: 1px dashed rgba(255, 255, 255, 0.08);
}

.skill-calc-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    flex-shrink: 0;
    opacity: 0.7;
}

.skill-calc-formula {
    font-size: 0.65rem;
    font-family: 'Courier New', monospace;
    color: rgba(251, 191, 36, 0.8);
    word-break: break-all;
    line-height: 1.4;
    white-space: pre-line;
}

/* =====================
   No Select Mode (Battle/Game)
   テキスト選択・ブラウザポップアップ無効
   ===================== */
.no-select,
.no-select * {
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
    -webkit-touch-callout: none !important;
    -webkit-tap-highlight-color: transparent !important;
}

/* バトル画面全体に適用 */
#battle-screen {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

#battle-screen * {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

/* =====================
 * Card Collection - Unowned Cards
 * ===================== */
.collection-card-wrapper {
    position: relative;
}

.collection-card-wrapper.unowned {
    filter: grayscale(1);
    opacity: 0.4;
    /* クリックして詳細を見ることは可能 */
}

.unowned-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.75);
    color: #aaa;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: bold;
    white-space: nowrap;
    pointer-events: none;
    z-index: 5;
}

/* =====================
 * Card Drop Notification
 * ===================== */
/* =====================
 * Card Drop - Luxurious Effect
 * ===================== */
.card-drop-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    animation: dropOverlayFadeIn 0.5s ease-out;
}

@keyframes dropOverlayFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.card-drop-particles {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    overflow: hidden;
}

.card-drop-particle {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: particleFall 3s linear infinite;
}

@keyframes particleFall {
    0% { transform: translateY(-100vh) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

.card-drop-light-burst {
    position: absolute;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.4) 0%, transparent 70%);
    animation: lightBurst 2s ease-out infinite;
}

@keyframes lightBurst {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.3); opacity: 0.8; }
}

.card-drop-title {
    font-size: 2rem;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.8), 0 0 40px rgba(255, 215, 0, 0.5);
    letter-spacing: 8px;
    margin-bottom: 20px;
    animation: titlePulse 1s ease-out, titleGlow 2s ease-in-out infinite;
    z-index: 10;
}

@keyframes titlePulse {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes titleGlow {
    0%, 100% { text-shadow: 0 0 20px rgba(255, 215, 0, 0.8), 0 0 40px rgba(255, 215, 0, 0.5); }
    50% { text-shadow: 0 0 30px rgba(255, 215, 0, 1), 0 0 60px rgba(255, 215, 0, 0.8), 0 0 80px rgba(255, 215, 0, 0.5); }
}

.card-drop-card-container {
    position: relative;
    perspective: 1000px;
    z-index: 10;
}

.card-drop-card {
    animation: cardReveal 1.2s ease-out forwards;
    transform-style: preserve-3d;
}

@keyframes cardReveal {
    0% { transform: rotateY(180deg) scale(0.5); opacity: 0; }
    40% { transform: rotateY(180deg) scale(1.1); opacity: 1; }
    60% { transform: rotateY(90deg) scale(1.1); }
    80% { transform: rotateY(0deg) scale(1.05); }
    100% { transform: rotateY(0deg) scale(1); }
}

.card-drop-shine {
    position: absolute;
    top: -20%;
    left: -20%;
    width: 140%;
    height: 140%;
    background: linear-gradient(
        45deg,
        transparent 30%,
        rgba(255, 255, 255, 0.3) 50%,
        transparent 70%
    );
    animation: cardShine 2s ease-in-out infinite;
    pointer-events: none;
}

@keyframes cardShine {
    0% { transform: translateX(-100%) rotate(45deg); }
    100% { transform: translateX(100%) rotate(45deg); }
}

.card-drop-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
    z-index: 10;
    animation: infoFadeIn 0.5s ease-out 1s forwards;
    opacity: 0;
}

@keyframes infoFadeIn {
    to { opacity: 1; }
}

.card-drop-name {
    font-size: 1.4rem;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
}

.card-drop-rarity {
    font-size: 0.9rem;
    padding: 4px 16px;
    border-radius: 20px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.card-drop-rarity.rarity-common {
    background: linear-gradient(135deg, #6b7280, #4b5563);
    color: #fff;
    box-shadow: 0 0 15px rgba(107, 114, 128, 0.5);
}
.card-drop-rarity.rarity-uncommon {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.5);
}
.card-drop-rarity.rarity-rare {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.7);
}
.card-drop-rarity.rarity-epic {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: #fff;
    box-shadow: 0 0 25px rgba(139, 92, 246, 0.8);
    animation: epicGlow 1.5s ease-in-out infinite;
}
.card-drop-rarity.rarity-legendary {
    background: linear-gradient(135deg, #fbbf24, #f59e0b, #d97706);
    color: #1a1a2e;
    box-shadow: 0 0 30px rgba(251, 191, 36, 0.9);
    animation: legendaryGlow 1s ease-in-out infinite;
}

@keyframes epicGlow {
    0%, 100% { box-shadow: 0 0 25px rgba(139, 92, 246, 0.8); }
    50% { box-shadow: 0 0 40px rgba(139, 92, 246, 1), 0 0 60px rgba(139, 92, 246, 0.5); }
}

@keyframes legendaryGlow {
    0%, 100% { box-shadow: 0 0 30px rgba(251, 191, 36, 0.9); }
    50% { box-shadow: 0 0 50px rgba(251, 191, 36, 1), 0 0 80px rgba(251, 191, 36, 0.6); }
}

.card-drop-tap-hint {
    position: absolute;
    bottom: 40px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
    animation: hintBlink 2s ease-in-out infinite;
}

@keyframes hintBlink {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

/* Rarity-specific particle colors */
.card-drop-overlay.rarity-common .card-drop-particle { background: #9ca3af; }
.card-drop-overlay.rarity-uncommon .card-drop-particle { background: #34d399; }
.card-drop-overlay.rarity-rare .card-drop-particle { background: #60a5fa; }
.card-drop-overlay.rarity-epic .card-drop-particle { background: #a78bfa; }
.card-drop-overlay.rarity-legendary .card-drop-particle { background: #fcd34d; }

.card-drop-overlay.rarity-legendary .card-drop-light-burst {
    background: radial-gradient(circle, rgba(251, 191, 36, 0.5) 0%, transparent 70%);
}
.card-drop-overlay.rarity-epic .card-drop-light-burst {
    background: radial-gradient(circle, rgba(139, 92, 246, 0.4) 0%, transparent 70%);
}

/* Legacy support - simple drop notification */
.result-card-drop {
    margin-top: 16px;
    padding: 16px;
    border: 2px solid var(--accent-gold, #d4a017);
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(212, 160, 23, 0.15), rgba(212, 160, 23, 0.05));
    text-align: center;
    animation: cardDropAppear 0.6s ease-out;
}

@keyframes cardDropAppear {
    0% { transform: scale(0.8); opacity: 0; }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); opacity: 1; }
}

/* =====================
   New Character Overlay (NFC Scan)
   ===================== */
.new-character-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: newCharFadeIn 0.3s ease-out;
}

.new-character-overlay.closing {
    animation: newCharFadeIn 0.3s ease-out reverse;
}

@keyframes newCharFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.new-character-content {
    text-align: center;
    animation: newCharBounce 0.5s ease-out;
}

@keyframes newCharBounce {
    0% { transform: scale(0.5); opacity: 0; }
    60% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

.new-character-burst {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 300px;
    height: 300px;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(201, 162, 39, 0.3) 0%, transparent 70%);
    animation: burstPulse 2s ease-in-out infinite;
}

@keyframes burstPulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.5; }
    50% { transform: translate(-50%, -50%) scale(1.3); opacity: 0.8; }
}

.new-character-title {
    font-size: 28px;
    font-weight: bold;
    color: #fcd34d;
    text-shadow: 0 0 20px rgba(251, 191, 36, 0.8);
    margin-bottom: 20px;
    animation: titleGlow 1.5s ease-in-out infinite;
}

@keyframes titleGlow {
    0%, 100% { text-shadow: 0 0 20px rgba(251, 191, 36, 0.8); }
    50% { text-shadow: 0 0 40px rgba(251, 191, 36, 1), 0 0 60px rgba(251, 191, 36, 0.5); }
}

.new-character-card {
    margin: 20px auto;
    max-width: 200px;
    animation: cardFloat 3s ease-in-out infinite;
}

@keyframes cardFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.new-character-info {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.new-character-name {
    font-size: 20px;
    font-weight: bold;
    color: #fff;
}

.new-character-rarity {
    font-size: 14px;
    padding: 4px 12px;
    border-radius: 12px;
    display: inline-block;
    margin: 0 auto;
}

.new-character-rarity.rarity-common { background: #6b7280; color: #fff; }
.new-character-rarity.rarity-uncommon { background: #059669; color: #fff; }
.new-character-rarity.rarity-rare { background: #3b82f6; color: #fff; }
.new-character-rarity.rarity-epic { background: #8b5cf6; color: #fff; }
.new-character-rarity.rarity-legendary { background: linear-gradient(135deg, #f59e0b, #fcd34d); color: #000; }

.new-character-hint {
    margin-top: 24px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
}

/* Rarity-specific burst colors */
.new-character-overlay.rarity-legendary .new-character-burst {
    background: radial-gradient(circle, rgba(251, 191, 36, 0.5) 0%, transparent 70%);
}
.new-character-overlay.rarity-epic .new-character-burst {
    background: radial-gradient(circle, rgba(139, 92, 246, 0.4) 0%, transparent 70%);
}
.new-character-overlay.rarity-rare .new-character-burst {
    background: radial-gradient(circle, rgba(59, 130, 246, 0.4) 0%, transparent 70%);
}

/* Scan page specific styles */
.nfc-status .success.new-character {
    color: #fcd34d;
    font-weight: bold;
    animation: pulseGlow 1s ease-in-out infinite;
}

@keyframes pulseGlow {
    0%, 100% { text-shadow: 0 0 5px rgba(251, 191, 36, 0.5); }
    50% { text-shadow: 0 0 15px rgba(251, 191, 36, 0.8); }
}

/* =====================
   Changelog Modal
   ===================== */
.version-info.clickable {
    cursor: pointer;
    color: var(--color-accent);
    text-decoration: underline;
    transition: color 0.2s;
}

.version-info.clickable:hover {
    color: var(--color-primary);
}

.changelog-modal-content {
    max-width: 500px;
    max-height: 80vh;
}

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

.changelog-modal-content .modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.changelog-modal-content .close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.changelog-modal-content .close-btn:hover {
    color: var(--text-primary);
}

.changelog-body {
    padding: var(--space-md);
    overflow-y: auto;
    max-height: calc(80vh - 80px);
}

.changelog-entry {
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--border-color);
}

.changelog-entry:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.changelog-version {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--color-accent);
}

.changelog-date {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
}

.changelog-list {
    margin: 0;
    padding-left: var(--space-md);
    font-size: 0.9rem;
    color: var(--text-primary);
}

.changelog-list li {
    margin-bottom: var(--space-xs);
    line-height: 1.5;
}

/* =====================
   Tutorial Modal
   ===================== */
.tutorial-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

.tutorial-modal {
    background: var(--bg-card, #1a1a2e);
    border-radius: var(--radius-lg, 16px);
    width: 400px;
    max-width: 92vw;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: slideUp 0.3s ease;
    overflow: hidden;
}

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

.tutorial-progress {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 16px 16px 0;
}

.tutorial-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transition: background 0.3s, transform 0.3s;
}

.tutorial-dot.active {
    background: var(--color-accent, #6366f1);
    transform: scale(1.3);
}

.tutorial-dot.completed {
    background: rgba(99, 102, 241, 0.5);
}

.tutorial-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    text-align: center;
}

.tutorial-icon {
    font-size: 3rem;
    margin-bottom: 8px;
}

.tutorial-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary, #fff);
    margin-bottom: 12px;
    line-height: 1.4;
}

.tutorial-content {
    font-size: 0.95rem;
    color: var(--text-secondary, #ccc);
    line-height: 1.8;
    text-align: left;
}

.tutorial-steps-list {
    list-style: none;
    padding: 0;
    margin: 12px 0;
    counter-reset: tutorial-step;
    text-align: left;
}

.tutorial-steps-list li {
    counter-increment: tutorial-step;
    padding: 6px 0 6px 32px;
    position: relative;
    line-height: 1.6;
}

.tutorial-steps-list li::before {
    content: counter(tutorial-step);
    position: absolute;
    left: 0;
    top: 6px;
    width: 22px;
    height: 22px;
    background: var(--color-accent, #6366f1);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
}

.tutorial-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 12px 0;
    text-align: left;
}

.tutorial-stat-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    line-height: 1.4;
}

.tutorial-stat-item strong {
    color: var(--color-accent, #6366f1);
}

.tutorial-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px 12px;
    gap: 8px;
}

.tutorial-prev-btn {
    min-width: 70px;
}

.tutorial-skip-btn {
    opacity: 0.7;
    font-size: 0.85rem;
}

.tutorial-next-btn {
    min-width: 90px;
}

.tutorial-dismiss-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 24px 16px;
    font-size: 0.8rem;
    color: var(--text-secondary, #999);
    cursor: pointer;
}

.tutorial-dismiss-label input[type="checkbox"] {
    accent-color: var(--color-accent, #6366f1);
}

@media (max-width: 380px) {
    .tutorial-modal {
        width: 100vw;
        height: 100vh;
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 0;
    }

    .tutorial-body {
        flex: 1;
    }
}
