/* KEITO Cloud - Material 3 スタイルシート */

/* iOS Safari 自動ズーム防止（font-size 16px未満のinputフォーカス時） */
input, textarea, select {
    font-size: 16px !important;
}

/* スクロールバー非表示（スクロール機能は維持） */
* {
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE/Edge */
}

*::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari/Opera */
}

:root {
    /* Material 3 カラーパレット - Light (薄緑) */
    --md-sys-color-primary: #3B6930;
    --md-sys-color-on-primary: #FFFFFF;
    --md-sys-color-primary-container: #BCEFAA;
    --md-sys-color-on-primary-container: #002200;

    --md-sys-color-secondary: #54634D;
    --md-sys-color-on-secondary: #FFFFFF;
    --md-sys-color-secondary-container: #D7E8CD;
    --md-sys-color-on-secondary-container: #121F0E;

    --md-sys-color-tertiary: #386568;
    --md-sys-color-on-tertiary: #FFFFFF;
    --md-sys-color-tertiary-container: #BBEBEE;
    --md-sys-color-on-tertiary-container: #002022;

    --md-sys-color-error: #B3261E;
    --md-sys-color-on-error: #FFFFFF;
    --md-sys-color-error-container: #F9DEDC;
    --md-sys-color-on-error-container: #410E0B;

    --md-sys-color-background: #FCFDF6;
    --md-sys-color-on-background: #1A1C18;

    --md-sys-color-surface: #FCFDF6;
    --md-sys-color-surface-container-lowest: #FFFFFF;
    --md-sys-color-surface-container-low: #F1F4EA;
    --md-sys-color-surface-container: #EBF0E3;
    --md-sys-color-surface-container-high: #E5EADE;
    --md-sys-color-surface-container-highest: #E0E4D8;

    --md-sys-color-on-surface: #1A1C18;
    --md-sys-color-surface-variant: #DFE4D7;
    --md-sys-color-on-surface-variant: #43483E;

    --md-sys-color-outline: #74796D;
    --md-sys-color-outline-variant: #C3C8BB;

    --md-sys-color-inverse-surface: #2F312D;
    --md-sys-color-inverse-on-surface: #F1F1EB;
    --md-sys-color-inverse-primary: #A1D390;

    /* アプリケーション変数 */
    --page-background: var(--md-sys-color-surface-container-high);
    --card-background: var(--md-sys-color-surface);

    /* 影 - M3ではElevation Levelで管理 */
    --md-sys-elevation-0: none;
    --md-sys-elevation-1: 0 1px 2px rgba(0, 0, 0, 0.3), 0 1px 3px 1px rgba(0, 0, 0, 0.15);
    --md-sys-elevation-2: 0 1px 2px rgba(0, 0, 0, 0.3), 0 2px 6px 2px rgba(0, 0, 0, 0.15);
    --md-sys-elevation-3: 0 4px 8px 3px rgba(0, 0, 0, 0.15), 0 1px 3px rgba(0, 0, 0, 0.3);

    /* ステートレイヤー透過度 */
    --md-sys-state-hover-state-layer-opacity: 0.08;
    --md-sys-state-focus-state-layer-opacity: 0.12;
    --md-sys-state-pressed-state-layer-opacity: 0.12;
    --md-sys-state-dragged-state-layer-opacity: 0.16;

    /* アニメーション */
    --md-sys-motion-duration-short: 200ms;
    --md-sys-motion-duration-medium: 400ms;
    --md-sys-motion-duration-long: 600ms;
    --md-sys-motion-easing-standard: cubic-bezier(0.2, 0, 0, 1);
    --md-sys-motion-easing-emphasized: cubic-bezier(0.2, 0, 0, 1);
    --md-sys-motion-easing-decelerate: cubic-bezier(0, 0, 0, 1);
    --md-sys-motion-easing-accelerate: cubic-bezier(0.3, 0, 1, 1);
    --md-sys-motion-easing-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
    --md-sys-motion-easing-elastic: cubic-bezier(0.68, -0.55, 0.265, 1.55);

    /* Discord カラー */
    --discord-blurple: #5865F2;
}

/* ダークモード */
[data-theme="dark"] {
    --md-sys-color-primary: #A1D390;
    --md-sys-color-on-primary: #0E3904;
    --md-sys-color-primary-container: #24511A;
    --md-sys-color-on-primary-container: #BCEFAA;

    --md-sys-color-secondary: #BBCBB2;
    --md-sys-color-on-secondary: #273422;
    --md-sys-color-secondary-container: #3D4A37;
    --md-sys-color-on-secondary-container: #D7E8CD;

    --md-sys-color-tertiary: #A0CFD2;
    --md-sys-color-on-tertiary: #003739;
    --md-sys-color-tertiary-container: #1E4D50;
    --md-sys-color-on-tertiary-container: #BBEBEE;

    --md-sys-color-error: #F2B8B5;
    --md-sys-color-on-error: #601410;
    --md-sys-color-error-container: #8C1D18;
    --md-sys-color-on-error-container: #F9DEDC;

    --md-sys-color-background: #0a0c0a;
    --md-sys-color-on-background: #E2E3DD;

    --md-sys-color-surface: #0d100c;
    --md-sys-color-surface-container-lowest: #050705;
    --md-sys-color-surface-container-low: #121512;
    --md-sys-color-surface-container: #161a15;
    --md-sys-color-surface-container-high: #1a1f19;
    --md-sys-color-surface-container-highest: #202520;

    --md-sys-color-on-surface: #E2E3DD;
    --md-sys-color-surface-variant: #43483E;
    --md-sys-color-on-surface-variant: #C3C8BB;

    --md-sys-color-outline: #8D9286;
    --md-sys-color-outline-variant: #43483E;

    --md-sys-color-inverse-surface: #E2E3DD;
    --md-sys-color-inverse-on-surface: #2F312D;
    --md-sys-color-inverse-primary: #3B6930;

    --page-background: var(--md-sys-color-background);
    --card-background: var(--md-sys-color-surface-container);

    --md-sys-elevation-1: 0 1px 3px 1px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.6);
    --md-sys-elevation-2: 0 2px 6px 2px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.6);
    --md-sys-elevation-3: 0 4px 8px 3px rgba(0, 0, 0, 0.4), 0 1px 3px rgba(0, 0, 0, 0.6);
}

/* システム設定に従う */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --md-sys-color-primary: #A1D390;
        --md-sys-color-on-primary: #0E3904;
        --md-sys-color-primary-container: #24511A;
        --md-sys-color-on-primary-container: #BCEFAA;

        --md-sys-color-secondary: #BBCBB2;
        --md-sys-color-on-secondary: #273422;
        --md-sys-color-secondary-container: #3D4A37;
        --md-sys-color-on-secondary-container: #D7E8CD;

        --md-sys-color-tertiary: #A0CFD2;
        --md-sys-color-on-tertiary: #003739;
        --md-sys-color-tertiary-container: #1E4D50;
        --md-sys-color-on-tertiary-container: #BBEBEE;

        --md-sys-color-error: #F2B8B5;
        --md-sys-color-on-error: #601410;
        --md-sys-color-error-container: #8C1D18;
        --md-sys-color-on-error-container: #F9DEDC;

        --md-sys-color-background: #0a0c0a;
        --md-sys-color-on-background: #E2E3DD;

        --md-sys-color-surface: #0d100c;
        --md-sys-color-surface-container-lowest: #050705;
        --md-sys-color-surface-container-low: #121512;
        --md-sys-color-surface-container: #161a15;
        --md-sys-color-surface-container-high: #1a1f19;
        --md-sys-color-surface-container-highest: #202520;

        --md-sys-color-on-surface: #E2E3DD;
        --md-sys-color-surface-variant: #43483E;
        --md-sys-color-on-surface-variant: #C3C8BB;

        --md-sys-color-outline: #8D9286;
        --md-sys-color-outline-variant: #43483E;

        --md-sys-color-inverse-surface: #E2E3DD;
        --md-sys-color-inverse-on-surface: #2F312D;
        --md-sys-color-inverse-primary: #3B6930;

        --page-background: var(--md-sys-color-background);
        --card-background: var(--md-sys-color-surface-container);

        --md-sys-elevation-1: 0 1px 3px 1px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.6);
        --md-sys-elevation-2: 0 2px 6px 2px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.6);
        --md-sys-elevation-3: 0 4px 8px 3px rgba(0, 0, 0, 0.4), 0 1px 3px rgba(0, 0, 0, 0.6);
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', 'Noto Sans JP', sans-serif;
    background: var(--page-background);
    color: var(--md-sys-color-on-background);
    line-height: 1.5;
    min-height: 100vh;
}

/* English mode: Ubuntu font */
:lang(en) body,
:lang(en) input,
:lang(en) select,
:lang(en) textarea,
:lang(en) button {
    font-family: 'Ubuntu', sans-serif;
}

html {
    background: var(--page-background);
    height: 100%;
}


/* ========== 共通コンポーネント ========== */

/* リップルエフェクト - Android 12+ Material You スタイル */
.ripple {
    position: relative;
    overflow: hidden;
    transform: translate3d(0, 0, 0);
}

.ripple::after {
    content: "";
    display: block;
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    background: radial-gradient(circle at var(--ripple-x, 50%) var(--ripple-y, 50%), rgba(0, 0, 0, 0.08) 0%, transparent 65%);
    opacity: 0;
    transition: opacity 350ms var(--md-sys-motion-easing-decelerate);
}

.ripple:active::after {
    opacity: 1;
}

[data-theme="dark"] .ripple::after {
    background: radial-gradient(circle at var(--ripple-x, 50%) var(--ripple-y, 50%), rgba(255, 255, 255, 0.10) 0%, transparent 65%);
}


.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 24px;
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    border: none;
    border-radius: 100px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 300ms var(--md-sys-motion-easing-bounce);
    box-shadow: var(--md-sys-elevation-0);
    transform: scale(1);
}

.btn-primary:hover {
    box-shadow: var(--md-sys-elevation-1);
    background: linear-gradient(0deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.08)), var(--md-sys-color-primary);
    transform: scale(1.02) translateY(-1px);
}

.btn-primary:active {
    box-shadow: none;
    background: linear-gradient(0deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.12)), var(--md-sys-color-primary);
    transform: scale(0.98);
    transition: all 100ms var(--md-sys-motion-easing-standard);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 24px;
    background: transparent;
    color: var(--md-sys-color-primary);
    border: 1px solid var(--md-sys-color-outline);
    border-radius: 100px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 300ms var(--md-sys-motion-easing-bounce);
    transform: scale(1);
}

.btn-secondary:hover {
    background: rgba(103, 80, 164, 0.08);
    /* primary with opacity */
    border-color: var(--md-sys-color-primary);
    transform: scale(1.02) translateY(-1px);
}

.btn-secondary:active {
    transform: scale(0.98);
    transition: all 100ms var(--md-sys-motion-easing-standard);
}

[data-theme="dark"] .btn-secondary:hover {
    background: rgba(208, 188, 255, 0.08);
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: var(--md-sys-color-on-surface-variant);
    transition: all 300ms var(--md-sys-motion-easing-bounce);
    transform: scale(1);
}

.btn-icon:hover {
    background: rgba(28, 27, 31, 0.08);
    /* on-surface with opacity */
    color: var(--md-sys-color-on-surface);
    transform: scale(1.1);
}

.btn-icon:active {
    transform: scale(0.9);
    transition: all 100ms var(--md-sys-motion-easing-standard);
}

[data-theme="dark"] .btn-icon:hover {
    background: rgba(230, 225, 229, 0.08);
}

.btn-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    border: none;
    border-radius: 16px;
    box-shadow: var(--md-sys-elevation-3);
    cursor: pointer;
    transition: all 300ms var(--md-sys-motion-easing-bounce);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: scale(1);
}

.btn-fab:hover {
    box-shadow: var(--md-sys-elevation-3);
    background: linear-gradient(0deg, rgba(29, 25, 43, 0.08), rgba(29, 25, 43, 0.08)), var(--md-sys-color-primary-container);
    transform: scale(1.05) rotate(5deg);
}

.btn-fab:active {
    transform: scale(0.95);
    transition: all 100ms var(--md-sys-motion-easing-standard);
}

.btn-fab .material-icons {
    font-size: 24px;
}

/* JS駆動リップルエフェクト - Android 12+ Material You スタイル */

/* メインのソフトグローレイヤー */
span.ripple-effect {
    position: absolute;
    border-radius: 50%;
    transform: scale(0);
    animation: materialYouRipple 800ms cubic-bezier(0.1, 0, 0, 1) forwards;
    background-color: var(--md-sys-color-on-surface);
    pointer-events: none;
    z-index: 0;
    filter: blur(2px);
}

.btn-primary .ripple-effect,
.btn-fab .ripple-effect {
    background-color: var(--md-sys-color-on-primary);
}

/* ステートレイヤー（タッチ時の全体ハイライト） */
span.ripple-state {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--md-sys-color-on-surface);
    opacity: 0;
    pointer-events: none;
    z-index: 0;
    animation: stateLayerFade 600ms cubic-bezier(0.1, 0, 0, 1) forwards;
}

.btn-primary .ripple-state,
.btn-fab .ripple-state {
    background-color: var(--md-sys-color-on-primary);
}

/* スパークルパーティクル */
span.ripple-sparkle {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--md-sys-color-on-surface);
    opacity: 0;
    pointer-events: none;
    z-index: 2;
    animation: sparkle 350ms cubic-bezier(0, 0, 0, 1) forwards;
}

.btn-primary .ripple-sparkle,
.btn-fab .ripple-sparkle {
    background: var(--md-sys-color-on-primary);
}

@keyframes materialYouRipple {
    0% {
        transform: scale(0);
        opacity: 0.15;
    }
    30% {
        transform: scale(1.5);
        opacity: 0.1;
    }
    100% {
        transform: scale(3);
        opacity: 0;
    }
}

@keyframes stateLayerFade {
    0% {
        opacity: 0;
    }
    20% {
        opacity: 0.08;
    }
    100% {
        opacity: 0;
    }
}

@keyframes sparkle {
    0% {
        transform: scale(0) translate(0, 0);
        opacity: 0.5;
    }
    40% {
        opacity: 0.35;
    }
    100% {
        transform: scale(1.5) translate(var(--sparkle-dx), var(--sparkle-dy));
        opacity: 0;
    }
}

/* カード - マジックランプエフェクト */
.card {
    background: var(--card-background);
    border-radius: 24px;
    /* M3 Elevated Card default: elevation 1 */
    box-shadow: var(--md-sys-elevation-1);
    overflow: hidden;
    transition: all 300ms var(--md-sys-motion-easing-bounce);
    transform: scale(1) translateY(0);
}

.card:hover {
    /* Hover state for elevated card: elevation 2 */
    box-shadow: var(--md-sys-elevation-2);
    transform: scale(1.01) translateY(-2px);
}

.card:active {
    transform: scale(0.99);
    transition: all 100ms var(--md-sys-motion-easing-standard);
}

.card-outlined {
    background: var(--md-sys-color-surface);
    border: 1px solid var(--md-sys-color-outline-variant);
    box-shadow: none;
}

.card-outlined:hover {
    box-shadow: var(--md-sys-elevation-1);
    /* Optional for interactive cards */
}

.card-filled {
    background: var(--md-sys-color-surface-container-highest);
    box-shadow: none;
    border: none;
}


/* スナックバー - マジックランプエフェクト */
.snackbar {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px) scale(0.8);
    background: var(--md-sys-color-inverse-surface);
    color: var(--md-sys-color-inverse-on-surface);
    padding: 14px 24px;
    border-radius: 16px;
    font-size: 14px;
    max-width: calc(100vw - 48px);
    box-sizing: border-box;
    word-break: break-word;
    box-shadow: var(--md-sys-elevation-3);
    opacity: 0;
    transition: all 500ms var(--md-sys-motion-easing-bounce);
    z-index: 9999;
    pointer-events: none;
}

.snackbar.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
    animation: snackbarPop 500ms var(--md-sys-motion-easing-bounce);
}

@keyframes snackbarPop {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(100px) scale(0.3);
    }

    50% {
        opacity: 1;
        transform: translateX(-50%) translateY(-10px) scale(1.05);
    }

    70% {
        transform: translateX(-50%) translateY(5px) scale(0.98);
    }

    100% {
        transform: translateX(-50%) translateY(0) scale(1);
    }
}

/* ========== ヒーローセクション ========== */

.hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    background: linear-gradient(135deg, var(--md-sys-color-primary-container) 0%, var(--md-sys-color-background) 100%);
    overflow: hidden;
}

.hero-content {
    text-align: center;
    max-width: 600px;
    margin-bottom: 48px;
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 16px;
    animation: logoContainerPop 0.8s var(--md-sys-motion-easing-bounce) forwards;
    opacity: 0;
    transform: scale(0.5);
}

@keyframes logoContainerPop {
    0% {
        opacity: 0;
        transform: scale(0.5) rotate(-10deg);
    }

    60% {
        transform: scale(1.1) rotate(5deg);
    }

    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(24px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.logo-icon {
    font-size: 48px;
    color: var(--md-sys-color-primary);
    animation: heroIconPulse 2s var(--md-sys-motion-easing-bounce) infinite;
}

@keyframes heroIconPulse {

    0%,
    100% {
        transform: scale(1) rotate(0deg);
    }

    50% {
        transform: scale(1.1) rotate(5deg);
    }
}

.logo-text {
    font-size: 48px;
    font-weight: 700;
    color: var(--md-sys-color-on-background);
}

.hero-subtitle {
    font-size: 24px;
    color: var(--md-sys-color-primary);
    margin-bottom: 16px;
    animation: fadeInUp 0.6s var(--md-sys-motion-easing-bounce) 0.2s forwards;
    opacity: 0;
}

.hero-description {
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: 32px;
    line-height: 1.8;
    animation: fadeInUp 0.6s var(--md-sys-motion-easing-bounce) 0.4s forwards;
    opacity: 0;
}

.btn-login {
    background: var(--discord-blurple);
    font-size: 16px;
    padding: 16px 32px;
    animation: loginBtnGenie 0.7s var(--md-sys-motion-easing-bounce) 0.6s forwards;
    opacity: 0;
    transform: scale(0.8) translateY(30px);
}

@keyframes loginBtnGenie {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(30px);
    }

    70% {
        transform: scale(1.05) translateY(-5px);
    }

    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.btn-login:hover {
    background: #4752c4;
    transform: scale(1.05) translateY(-2px);
}

.btn-login:active {
    transform: scale(0.98);
}

.discord-icon {
    width: 24px;
    height: 24px;
}

/* 機能カード - マジックランプエフェクト */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
    gap: 24px;
    max-width: 900px;
    width: 100%;
}

.feature-card {
    background: var(--md-sys-color-surface);
    padding: 24px;
    border-radius: 16px;
    text-align: center;
    box-shadow: var(--md-sys-elevation-1);
    transition: all 400ms var(--md-sys-motion-easing-bounce);
    animation: featureCardGenie 0.6s var(--md-sys-motion-easing-bounce) forwards;
    opacity: 0;
    transform: scale(0.7) translateY(50px);
}

.feature-card:nth-child(1) {
    animation-delay: 100ms;
}

.feature-card:nth-child(2) {
    animation-delay: 200ms;
}

.feature-card:nth-child(3) {
    animation-delay: 300ms;
}

.feature-card:nth-child(4) {
    animation-delay: 400ms;
}

@keyframes featureCardGenie {
    0% {
        opacity: 0;
        transform: scale(0.7) translateY(50px) rotateY(-20deg);
    }

    60% {
        transform: scale(1.05) translateY(-10px) rotateY(5deg);
    }

    100% {
        opacity: 1;
        transform: scale(1) translateY(0) rotateY(0deg);
    }
}

.feature-card:hover {
    transform: scale(1.05) translateY(-8px);
    box-shadow: var(--md-sys-elevation-3);
}

.feature-card:active {
    transform: scale(0.98);
    transition: all 100ms var(--md-sys-motion-easing-standard);
}

.feature-icon {
    font-size: 48px;
    color: var(--md-sys-color-primary);
    margin-bottom: 16px;
    transition: transform 400ms var(--md-sys-motion-easing-bounce);
}

.feature-card:hover .feature-icon {
    transform: scale(1.15) rotate(10deg);
}

.feature-card h3 {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 8px;
}

.feature-card p {
    font-size: 14px;
    color: var(--md-sys-color-on-surface-variant);
}

/* ========== ダッシュボード ========== */

.dashboard-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* トップバー - マジックエントランス */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 64px;
    background: var(--md-sys-color-surface);
    border-bottom: 1px solid var(--md-sys-color-surface-variant);
    position: sticky;
    top: 0;
    z-index: 100;
    animation: topBarSlide 0.5s var(--md-sys-motion-easing-bounce) forwards;
}

@keyframes topBarSlide {
    0% {
        opacity: 0;
        transform: translateY(-100%);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.top-bar-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.top-bar-title .logo-icon {
    font-size: 24px;
    color: var(--md-sys-color-primary);
    animation: logoSpin 0.8s var(--md-sys-motion-easing-bounce) 0.3s forwards;
    transform: scale(0) rotate(-180deg);
}

@keyframes logoSpin {
    0% {
        transform: scale(0) rotate(-180deg);
    }

    50% {
        transform: scale(1.2) rotate(20deg);
    }

    100% {
        transform: scale(1) rotate(0deg);
    }
}

.top-bar-title h1 {
    font-size: 22px;
    font-weight: 400;
    color: var(--md-sys-color-on-surface);
    animation: titleFade 0.5s var(--md-sys-motion-easing-decelerate) 0.4s forwards;
    opacity: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@keyframes titleFade {
    0% {
        opacity: 0;
        transform: translateX(-20px);
    }

    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

/* BETA バッジ */
.beta-badge {
    display: inline-block;
    background: linear-gradient(135deg, #FF6B35, #F7931E);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 6px;
    margin-left: 8px;
    letter-spacing: 1px;
    vertical-align: middle;
    animation: betaPulse 2s ease-in-out infinite;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

@keyframes betaPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

/* BETA 警告モーダル */
.beta-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    padding: 24px;
    box-sizing: border-box;
    animation: fadeIn 300ms ease;
}

.beta-modal {
    background: var(--md-sys-color-surface);
    border-radius: 28px;
    padding: 32px;
    max-width: 480px;
    width: calc(100% - 32px);
    box-shadow: var(--md-sys-elevation-3);
    text-align: center;
    animation: genieOpen 350ms cubic-bezier(0.2, 0.9, 0.3, 1) forwards;
}

.beta-modal .beta-icon {
    font-size: 64px;
    color: #FF6B35;
    margin-bottom: 16px;
}

.beta-modal h2 {
    font-size: 22px;
    font-weight: 600;
    color: var(--md-sys-color-on-surface);
    margin-bottom: 12px;
}

.beta-modal p {
    font-size: 14px;
    color: var(--md-sys-color-on-surface-variant);
    line-height: 1.7;
    margin-bottom: 24px;
}

.beta-modal .beta-accept-btn {
    background: linear-gradient(135deg, #FF6B35, #F7931E);
    color: #fff;
    border: none;
    padding: 12px 40px;
    border-radius: 100px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.beta-modal .beta-accept-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.4);
}

.top-bar-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    animation: actionsSlide 0.4s var(--md-sys-motion-easing-bounce) 0.5s forwards;
    opacity: 0;
    transform: translateX(30px);
    position: relative;
}

@keyframes actionsSlide {
    0% {
        opacity: 0;
        transform: translateX(30px);
    }

    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 300ms var(--md-sys-motion-easing-bounce);
    border: 1px solid var(--md-sys-color-outline-variant);
}

.user-avatar:hover {
    box-shadow: 0 0 0 4px rgba(103, 80, 164, 0.08);
    transform: scale(1.1);
}

.user-avatar:active {
    transform: scale(0.95);
}

/* ユーザーメニュー - スムーズなドロップダウン */
.user-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: var(--md-sys-color-surface-container-high);
    border-radius: 20px;
    box-shadow: var(--md-sys-elevation-2);
    min-width: min(280px, calc(100vw - 32px));
    max-width: calc(100vw - 32px);
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
    transform-origin: top right;
    pointer-events: none;
    transition: opacity 0.2s ease-out, transform 0.2s ease-out;
    z-index: 1000;
    overflow: hidden;
    padding: 8px 0;
}

.user-menu.show {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.user-menu-header {
    padding: 12px 24px;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    margin-bottom: 8px;
}

.user-menu-header h3 {
    font-size: 16px;
    font-weight: 500;
    color: var(--md-sys-color-on-surface);
}

.user-menu-header p {
    font-size: 14px;
    color: var(--md-sys-color-on-surface-variant);
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 24px;
    height: 48px;
    color: var(--md-sys-color-on-surface);
    text-decoration: none;
    transition: background var(--md-sys-motion-duration-short) var(--md-sys-motion-easing-standard);
    font-size: 14px;
    font-weight: 500;
}

.user-menu-item .material-icons {
    color: var(--md-sys-color-on-surface-variant);
}

.user-menu-item:hover {
    background: rgba(28, 27, 31, 0.08);
    /* on-surface variant opacity */
}

.user-menu-item.admin-link {
    color: var(--md-sys-color-error);
    border-top: 1px solid var(--md-sys-color-outline-variant);
    margin-top: 8px;
    padding-top: 0;
    margin-bottom: 8px;
}

.user-menu-item.admin-link .material-icons {
    color: var(--md-sys-color-error);
}

[data-theme="dark"] .user-menu-item.admin-link {
    color: var(--md-sys-color-error);
}

[data-theme="dark"] .user-menu-item.admin-link .material-icons {
    color: var(--md-sys-color-error);
}

/* 期限延長リンク */
.user-menu-item .expiry-remaining {
    margin-left: auto;
    font-size: 12px;
    color: var(--md-sys-color-primary);
    font-weight: 500;
}

/* 期限延長モーダル */
.expiry-modal-info {
    background: var(--md-sys-color-surface-container);
    border-radius: 20px;
    padding: 16px;
}

.expiry-current {
    display: flex;
    align-items: center;
    gap: 12px;
}

.expiry-current .material-icons {
    font-size: 32px;
    color: var(--md-sys-color-primary);
}

.expiry-label {
    font-size: 12px;
    color: var(--md-sys-color-on-surface-variant);
    margin: 0;
}

.expiry-value {
    font-size: 16px;
    font-weight: 500;
    color: var(--md-sys-color-on-surface);
    margin: 4px 0 0 0;
}

/* ストレージ表示 */
.storage-bar {
    margin: 8px 24px 16px;
}

.storage-bar-label {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: 8px;
}

.storage-bar-track {
    height: 8px;
    /* Thicker track for better visibility */
    background: var(--md-sys-color-surface-container-highest);
    border-radius: 10px;
    overflow: hidden;
}

.storage-bar-fill {
    height: 100%;
    background: var(--md-sys-color-primary);
    border-radius: 10px;
    transition: width var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-standard);
}

/* メインコンテンツ */
.main-content {
    flex: 1;
    padding: 24px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* タブ - M3 Navigation Bar/Tab Style with Sliding Indicator */
.tabs {
    display: flex;
    gap: 0;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--md-sys-color-surface-variant);
    padding-bottom: 0;
    position: relative;
    animation: tabsSlide 0.4s var(--md-sys-motion-easing-bounce) forwards;
}

/* M3 sliding indicator */
.tabs::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: var(--tab-indicator-left, 0px);
    width: var(--tab-indicator-width, 0px);
    height: 3px;
    background: var(--md-sys-color-primary);
    border-radius: 3px 3px 0 0;
    transition: left 300ms cubic-bezier(0.4, 0, 0.2, 1),
                width 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes tabsSlide {
    0% {
        opacity: 0;
        transform: translateY(-10px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.tab {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    background: transparent;
    color: var(--md-sys-color-on-surface-variant);
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: color 300ms var(--md-sys-motion-easing-bounce),
                background 300ms var(--md-sys-motion-easing-bounce);
    position: relative;
    flex: 0 1 auto;
}

.tab:hover {
    background: rgba(28, 27, 31, 0.04);
}

.tab:active {
    transition: all 100ms var(--md-sys-motion-easing-standard);
}

.tab.active {
    background: transparent;
    color: var(--md-sys-color-primary);
    border-bottom: 2px solid transparent;
}

.tab.active .material-icons {
    color: var(--md-sys-color-primary);
}

/* タブパネル - スライドのみのアニメーション */
.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

/* 右からスライドイン（右のタブへ移動時） */
.tab-panel.slide-from-right {
    animation: tabSlideFromRight 0.25s ease-out;
}

/* 左からスライドイン（左のタブへ移動時） */
.tab-panel.slide-from-left {
    animation: tabSlideFromLeft 0.25s ease-out;
}

@keyframes tabSlideFromRight {
    from {
        transform: translateX(50px);
    }

    to {
        transform: translateX(0);
    }
}

@keyframes tabSlideFromLeft {
    from {
        transform: translateX(-50px);
    }

    to {
        transform: translateX(0);
    }
}

/* ファイルリスト - M3 Lists Component */
.file-list {
    display: flex;
    flex-direction: column;
    background: var(--md-sys-color-surface-container);
    border-radius: 28px;
    overflow: hidden;
    animation: containerReveal 0.5s var(--md-sys-motion-easing-bounce) forwards;
    opacity: 0;
}

/* コンテナ出現アニメーション */
@keyframes containerReveal {
    0% {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.file-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: transparent;
    border-bottom: 1px solid var(--md-sys-color-surface-variant);
    border-radius: 0;
    cursor: pointer;
    transition: background 200ms var(--md-sys-motion-easing-standard);
    animation: itemSlideIn 0.4s var(--md-sys-motion-easing-bounce) forwards;
    opacity: 0;
}

.file-item:last-child {
    border-bottom: none;
}

.file-item:hover {
    background: var(--md-sys-color-surface-container-high);
}

.file-item:active {
    background: var(--md-sys-color-surface-container-highest);
    transition: all 100ms var(--md-sys-motion-easing-standard);
}

/* リストアイテムの段階的な出現アニメーション */
@keyframes itemSlideIn {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }

    60% {
        transform: translateY(-3px) scale(1.01);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 段階的なアニメーション遅延 */
.file-item:nth-child(1) {
    animation-delay: 0ms;
}

.file-item:nth-child(2) {
    animation-delay: 30ms;
}

.file-item:nth-child(3) {
    animation-delay: 60ms;
}

.file-item:nth-child(4) {
    animation-delay: 90ms;
}

.file-item:nth-child(5) {
    animation-delay: 120ms;
}

.file-item:nth-child(6) {
    animation-delay: 150ms;
}

.file-item:nth-child(7) {
    animation-delay: 180ms;
}

.file-item:nth-child(8) {
    animation-delay: 210ms;
}

.file-item:nth-child(9) {
    animation-delay: 240ms;
}

.file-item:nth-child(10) {
    animation-delay: 270ms;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.file-icon {
    width: 40px;
    height: 40px;
    background: var(--md-sys-color-primary-container);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 16px;
}

.file-icon .material-icons {
    color: var(--md-sys-color-on-primary-container);
    font-size: 24px;
}

.file-info {
    flex: 1;
    min-width: 0;
}

.file-name {
    font-size: 16px;
    font-weight: 400;
    color: var(--md-sys-color-on-surface);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-meta {
    font-size: 12px;
    color: var(--md-sys-color-on-surface-variant);
}

.file-actions {
    display: flex;
    gap: 0;
}


.file-actions .btn-icon {
    width: 40px;
    height: 40px;
}

.file-actions .material-icons {
    font-size: 20px;
    color: var(--md-sys-color-on-surface-variant);
}

/* プロセスリスト - M3 Lists Component */
#process-list {
    display: flex;
    flex-direction: column;
    background: var(--md-sys-color-surface-container);
    border-radius: 28px;
    overflow: hidden;
}

.process-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    margin-bottom: 0;
    border-bottom: 1px solid var(--md-sys-color-surface-variant);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: background 200ms var(--md-sys-motion-easing-standard);
}

.process-item:last-child {
    border-bottom: none;
}

.process-item:hover {
    background: var(--md-sys-color-surface-container-high);
}

.process-item:active {
    background: var(--md-sys-color-surface-container-highest);
    transition: all 100ms var(--md-sys-motion-easing-standard);
}

@keyframes processAppear {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.process-status {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 16px;
}

.process-status.running {
    background: #4CAF50;
    animation: pulse 1.5s infinite;
}

.process-status.completed {
    background: #2196F3;
}

.process-status.error,
.process-status.killed {
    background: var(--md-sys-color-error);
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.process-info {
    flex: 1;
}

.process-name {
    font-size: 14px;
    font-weight: 500;
}

.process-meta {
    font-size: 12px;
    color: var(--md-sys-color-on-surface-variant);
}

/* 空の状態 */
.empty-state {
    text-align: center;
    padding: 64px 24px;
    animation: fadeInUp 0.4s var(--md-sys-motion-easing-emphasized) forwards;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

.empty-state .material-icons {
    font-size: 64px;
    color: var(--md-sys-color-outline);
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 18px;
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: 24px;
}

.empty-state .btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
}

.empty-state .btn-primary .material-icons {
    font-size: 20px;
}

/* ========== モーダル - macOS/iOS Genie Effect ========== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: background 300ms ease, opacity 200ms ease;
    z-index: 10000;
    padding: 24px;
    box-sizing: border-box;
    /* Genie Effect用オフセット（クリック位置 - 画面中央） */
    --genie-x: 0px;
    --genie-y: 0px;
}

.modal-overlay.show,
.modal-overlay[style*="display: flex"] {
    opacity: 1;
    pointer-events: auto;
    background: rgba(0, 0, 0, 0.5);
}

.modal {
    background: var(--md-sys-color-surface);
    border-radius: 28px;
    padding: 24px;
    max-width: 560px;
    width: calc(100% - 32px);
    box-sizing: border-box;
    max-height: calc(100vh - 48px);
    margin: auto;
    position: relative;
    box-shadow: var(--md-sys-elevation-3);
    display: flex;
    flex-direction: column;
    /* デフォルトは非表示状態 */
    opacity: 0;
    transform: translate(var(--genie-x), var(--genie-y)) scale(0);
    visibility: hidden;
}

.modal-overlay.show .modal,
.modal-overlay[style*="display: flex"] .modal {
    visibility: visible;
    animation: genieOpen 350ms cubic-bezier(0.2, 0.9, 0.3, 1) forwards;
}

/* macOS/iOS Genie Effect - クリック位置から中央へ */
@keyframes genieOpen {
    0% {
        opacity: 0;
        transform: translate(var(--genie-x), var(--genie-y)) scale(0);
        visibility: visible;
    }

    100% {
        opacity: 1;
        transform: translate(0, 0) scale(1);
        visibility: visible;
    }
}

/* モーダル閉じる - Genie Effect（クリック位置へ吸い込まれる） */
.modal-overlay.closing {
    background: rgba(0, 0, 0, 0);
    transition: background 250ms ease;
}

.modal-overlay.closing .modal {
    animation: genieClose 250ms cubic-bezier(0.4, 0, 0.6, 1) forwards;
}

@keyframes genieClose {
    0% {
        opacity: 1;
        transform: translate(0, 0) scale(1);
        visibility: visible;
    }

    100% {
        opacity: 0;
        transform: translate(var(--genie-x), var(--genie-y)) scale(0);
        visibility: hidden;
    }
}

.modal-header {
    margin-bottom: 24px;
    flex-shrink: 0;
}

.modal-header h2 {
    font-size: 24px;
    font-weight: 400;
}

.modal-body {
    margin-bottom: 24px;
    overflow-y: auto;
    flex: 1 1 auto;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-shrink: 0;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

/* フォーム */
.form-field {
    margin-bottom: 16px;
}

.form-field label {
    display: block;
    font-size: 12px;
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: 8px;
}

.form-field input,
.form-field textarea {
    width: 100%;
    padding: 16px;
    background: var(--md-sys-color-surface-container-high);
    border: 1px solid var(--md-sys-color-outline);
    border-radius: 16px;
    font-size: 16px;
    font-family: inherit;
    color: var(--md-sys-color-on-surface);
    transition: all var(--md-sys-motion-duration-short) var(--md-sys-motion-easing-standard);
}

.form-field input:focus,
.form-field textarea:focus {
    outline: 2px solid var(--md-sys-color-primary);
    outline-offset: -2px;
    background: var(--md-sys-color-surface-container-highest);
}

.form-field textarea {
    min-height: 200px;
    resize: vertical;
    font-family: 'Consolas', 'Monaco', monospace;
}

/* ドラッグ&ドロップエリア */
.dropzone {
    border: 2px dashed var(--md-sys-color-outline);
    border-radius: 24px;
    padding: 48px;
    text-align: center;
    transition: all var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-standard);
    cursor: pointer;
}

.dropzone:hover,
.dropzone.dragover {
    border-color: var(--md-sys-color-primary);
    background: var(--md-sys-color-primary-container);
}

.dropzone .material-icons {
    font-size: 48px;
    color: var(--md-sys-color-primary);
    margin-bottom: 16px;
}

/* ========== エディタページ ========== */

.editor-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.editor-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: var(--md-sys-color-surface);
    box-shadow: var(--md-sys-elevation-1);
    flex-wrap: wrap;
    gap: 8px;
}

.editor-toolbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
    flex: 1;
}

.editor-filename {
    font-size: 16px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.editor-toolbar-right {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.editor-main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.editor-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--md-sys-color-outline-variant);
}

.editor-panel:last-child {
    border-right: none;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--md-sys-color-surface-variant);
    font-size: 14px;
    font-weight: 500;
}

.code-editor {
    flex: 1;
    padding: 16px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    background: var(--md-sys-color-surface);
    color: var(--md-sys-color-on-surface);
    border: none;
    resize: none;
    outline: none;
    tab-size: 4;
}

/* ログパネル */
.log-panel {
    flex: 1;
    background: var(--md-sys-color-inverse-surface);
    color: var(--md-sys-color-inverse-on-surface);
    overflow-y: auto;
    padding: 16px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
}

.log-entry {
    margin-bottom: 4px;
    animation: logAppear 0.2s var(--md-sys-motion-easing-standard);
}

@keyframes logAppear {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.log-entry.stdout {
    color: #a5d6a7;
}

.log-entry.stderr {
    color: #b0bec5;
}

.log-entry.error {
    color: #ef9a9a;
}

.log-entry.info {
    color: #90caf9;
}

.log-entry.warning {
    color: #ffcc80;
}

.log-timestamp {
    color: #757575;
    margin-right: 8px;
}

/* レスポンシブ */
@media (max-width: 768px) {
    .features-grid {
        grid-template-columns: 1fr;
    }

    .editor-main {
        flex-direction: column;
    }

    .editor-panel {
        border-right: none;
        border-bottom: 1px solid var(--md-sys-color-outline-variant);
    }

    .tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
    }
}

/* ローディング */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--md-sys-color-surface-variant);
    border-top-color: var(--md-sys-color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ページ遷移アニメーション */
.page-enter {
    animation: pageEnter 0.4s var(--md-sys-motion-easing-emphasized) forwards;
}

@keyframes pageEnter {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== テーマ切替ボタン ========== */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--md-sys-color-surface-variant);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: background var(--md-sys-motion-duration-short) var(--md-sys-motion-easing-standard);
}

.theme-toggle:hover {
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
}

.theme-toggle .material-icons {
    font-size: 24px;
    color: var(--md-sys-color-on-surface-variant);
}

/* ========== 言語切替ボタン ========== */
.lang-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--md-sys-color-surface-variant);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all var(--md-sys-motion-duration-short) var(--md-sys-motion-easing-standard);
    font-size: 14px;
    font-weight: 600;
    color: var(--md-sys-color-on-surface-variant);
}

.lang-toggle-btn:hover {
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
}

.lang-toggle-btn .lang-text {
    font-family: 'Noto Sans JP', sans-serif;
}

/* ========== 期限表示 ========== */
.expiry-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--md-sys-color-tertiary-container);
    color: var(--md-sys-color-on-tertiary-container);
    border-radius: 20px;
    margin-bottom: 16px;
    animation: slideIn 0.3s var(--md-sys-motion-easing-emphasized) forwards;
}

.expiry-banner.warning {
    background: var(--md-sys-color-error-container);
    color: var(--md-sys-color-on-error-container);
}

.expiry-banner.warning .material-icons {
    color: var(--md-sys-color-error);
}

.expiry-banner.expired {
    background: var(--md-sys-color-error);
    color: var(--md-sys-color-on-error);
}

.expiry-banner.expired .material-icons {
    color: var(--md-sys-color-on-error);
}

.expiry-banner.expired .btn-extend {
    background: var(--md-sys-color-on-error);
    color: var(--md-sys-color-error);
}

.expiry-banner-text {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.expiry-banner .material-icons {
    font-size: 20px;
}

.btn-extend {
    padding: 8px 16px;
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    border: none;
    border-radius: 100px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--md-sys-motion-duration-short) var(--md-sys-motion-easing-standard);
}

.btn-extend:hover {
    transform: scale(1.02);
    box-shadow: var(--md-sys-elevation-1);
}

/* ========== 削除確認モーダル ========== */
.delete-warning {
    padding: 16px;
    background: var(--md-sys-color-error-container);
    border-radius: 20px;
    margin-bottom: 16px;
}

.delete-warning p {
    color: var(--md-sys-color-error);
    font-size: 14px;
}

.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--md-sys-color-error) !important;
    color: #FFFFFF !important;
    border: none;
    border-radius: 100px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-standard);
    box-shadow: var(--md-sys-elevation-1);
}

.btn-danger:hover {
    box-shadow: var(--md-sys-elevation-2);
    transform: translateY(-1px);
    filter: brightness(1.1);
}

.btn-danger:active {
    transform: translateY(0);
}

/* ========== ステータスカード - マジックエフェクト ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--md-sys-color-surface);
    border-radius: 24px;
    padding: 20px;
    box-shadow: var(--md-sys-elevation-1);
    display: flex;
    flex-direction: column;
    gap: 12px;
    animation: statCardPop 0.5s var(--md-sys-motion-easing-bounce) forwards;
    opacity: 0;
    transform: scale(0.8) translateY(30px);
    transition: all 300ms var(--md-sys-motion-easing-bounce);
}

.stat-card:nth-child(1) {
    animation-delay: 0ms;
}

.stat-card:nth-child(2) {
    animation-delay: 100ms;
}

.stat-card:nth-child(3) {
    animation-delay: 200ms;
}

.stat-card:nth-child(4) {
    animation-delay: 300ms;
}

@keyframes statCardPop {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(30px);
    }

    70% {
        transform: scale(1.05) translateY(-5px);
    }

    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.stat-card:hover {
    box-shadow: var(--md-sys-elevation-2);
    transform: scale(1.02) translateY(-4px);
}

.stat-card:active {
    transform: scale(0.98);
    transition: all 100ms var(--md-sys-motion-easing-standard);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon.storage,
.stat-icon.ram,
.stat-icon.process {
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
}

[data-theme="dark"] .stat-icon.storage,
[data-theme="dark"] .stat-icon.ram,
[data-theme="dark"] .stat-icon.process {
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
}

.stat-icon .material-icons {
    font-size: 24px;
}

.stat-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-value {
    font-size: 24px;
    font-weight: 600;
    color: var(--md-sys-color-on-surface);
}

.stat-label {
    font-size: 13px;
    color: var(--md-sys-color-on-surface-variant);
}

.stat-detail {
    font-size: 11px;
    color: var(--md-sys-color-on-surface-variant);
    opacity: 0.7;
}

/* ========== M3 Wavy Progress Bar (Android 13 style) ========== */
.stat-bar {
    position: relative;
    height: 20px;
    width: 100%;
}

.stat-bar canvas.wavy-bar {
    display: block;
    width: 100%;
    height: 100%;
}

/* ========== 改善されたログパネル ========== */
.log-panel {
    flex: 1;
    background: #0D1117;
    color: #C9D1D9;
    overflow-y: auto;
    padding: 16px;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    line-height: 1.7;
}

.log-entry {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 8px 12px;
    margin-bottom: 4px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.03);
    animation: logAppear 0.2s var(--md-sys-motion-easing-standard);
    overflow: hidden;
    min-width: 0;
    contain: content;
}

/* 初回読み込み時はアニメーション無効 */
.no-animate .log-entry {
    animation: none;
}

.log-entry:hover {
    background: rgba(255, 255, 255, 0.06);
}

.log-entry.stdout {
    border-left: 3px solid #3FB950;
}

.log-entry.stdout .log-content {
    color: #7EE787;
}

.log-entry.stderr {
    border-left: 3px solid #8B949E;
    background: rgba(139, 148, 158, 0.05);
}

.log-entry.error {
    border-left: 3px solid #F85149;
    background: rgba(248, 81, 73, 0.1);
}

.log-entry.stderr .log-content {
    color: #C9D1D9;
}

.log-entry.error .log-content {
    color: #FF7B72;
}

.log-entry.info {
    border-left: 3px solid #58A6FF;
}

.log-entry.info .log-content {
    color: #79C0FF;
}

.log-entry.warning {
    border-left: 3px solid #D29922;
    background: rgba(210, 153, 34, 0.1);
}

.log-entry.warning .log-content {
    color: #E3B341;
}

.log-timestamp {
    color: #6E7681;
    font-size: 11px;
    white-space: nowrap;
    flex-shrink: 0;
    font-family: inherit;
}

.log-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.log-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #6E7681;
    gap: 8px;
}

.log-empty .material-icons {
    font-size: 48px;
    opacity: 0.5;
}

.log-type-badge {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    font-weight: 600;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 4px;
}

.log-type-badge .material-icons {
    font-size: 12px;
}

.log-entry.stdout .log-type-badge {
    background: rgba(63, 185, 80, 0.2);
    color: #3FB950;
}

.log-entry.info .log-type-badge {
    background: rgba(88, 166, 255, 0.2);
    color: #58A6FF;
}

.log-entry.error .log-type-badge {
    background: rgba(248, 81, 73, 0.2);
    color: #F85149;
}

.log-entry.stderr .log-type-badge {
    background: rgba(139, 148, 158, 0.2);
    color: #8B949E;
}

.log-entry.warning .log-type-badge {
    background: rgba(210, 153, 34, 0.2);
    color: #D29922;
}

.log-entry.system .log-type-badge {
    background: rgba(139, 148, 158, 0.2);
    color: #8B949E;
}

.log-entry.system {
    border-left: 3px solid #8B949E;
}

.log-entry.system .log-content {
    color: #8B949E;
    font-style: italic;
}

.log-content {
    flex: 1;
    min-width: 0;
    word-break: normal;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    overflow-x: auto;
    max-width: 100%;
}

.log-content-text {
    word-break: normal;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* ===== Legacy Log Mode (Ubuntu GNOME Terminal) ===== */

/* 通常モードではプロンプト・タイトルバー非表示 */
.legacy-prompt {
    display: none;
}

.log-panel.legacy-mode {
    background: #2D2D2D;
    padding: 10px 14px;
    font-family: 'Ubuntu Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 13px;
    line-height: 1.45;
    border-radius: 8px !important;
}

.log-panel.legacy-mode .log-entry {
    display: block;
    padding: 0;
    margin-bottom: 0;
    border-radius: 0;
    background: none;
    border-left: none !important;
    animation: none;
}

.log-panel.legacy-mode .log-entry:hover {
    background: rgba(255, 255, 255, 0.03);
}

.log-panel.legacy-mode .log-header {
    display: none;
}

.log-panel.legacy-mode .log-content {
    font-size: 13px;
    line-height: 1.45;
    color: #EEEEEC;
}

.log-panel.legacy-mode .log-entry.stdout .log-content {
    color: #D3D7CF;
}

.log-panel.legacy-mode .log-entry.stderr .log-content {
    color: #FCAF3E;
}

.log-panel.legacy-mode .log-entry.error .log-content {
    color: #EF2929;
}

.log-panel.legacy-mode .log-entry.info .log-content {
    color: #729FCF;
}

.log-panel.legacy-mode .log-entry.warning .log-content {
    color: #FCE94F;
}

.log-panel.legacy-mode .log-entry.system .log-content {
    color: #8AE234;
    font-style: italic;
}

.log-panel.legacy-mode .log-truncated-notice {
    color: #888A85;
    padding: 2px 0;
    font-size: 12px;
}

.log-panel.legacy-mode .module-install-suggestion,
.log-panel.legacy-mode .login-failure-tip {
    border-radius: 4px;
    margin: 4px 0;
}

.log-panel.legacy-mode .log-empty {
    color: #888A85;
}

#legacy-log-toggle.active,
#ws-legacy-toggle.active {
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    border-color: var(--md-sys-color-primary);
}

/* ===== ファイルマネージャ ===== */
.filemanager-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--md-sys-color-surface-variant);
    border-radius: 20px;
    margin-bottom: 16px;
    gap: 16px;
}

.filemanager-breadcrumb {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    flex: 1;
}

.breadcrumb-item {
    padding: 4px 8px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
    color: var(--md-sys-color-on-surface);
    transition: all 0.2s;
}

.breadcrumb-item:hover {
    background: var(--md-sys-color-outline-variant);
}

.breadcrumb-item.drag-target {
    background: var(--md-sys-color-tertiary-container);
    color: var(--md-sys-color-on-tertiary-container);
    transform: scale(1.1);
    box-shadow: var(--md-sys-elevation-2);
}

.breadcrumb-separator {
    color: var(--md-sys-color-outline);
    font-size: 18px;
}

.filemanager-actions {
    display: flex;
    gap: 8px;
}

.btn-icon {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-icon .material-icons {
    font-size: 20px;
}

.btn-icon:hover {
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
}

.fm-file-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    padding: 8px;
    min-height: 200px;
    border: 2px dashed transparent;
    border-radius: 20px;
    transition: all 0.2s;
}

.fm-file-list.drag-over {
    border-color: var(--md-sys-color-primary);
    background: var(--md-sys-color-primary-container);
}

.fm-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 8px;
    border-radius: 20px;
    background: var(--card-background);
    border: 1px solid var(--md-sys-color-outline-variant);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
    /* リップル用 */
    user-select: none;
}

.fm-item:hover {
    background: var(--md-sys-color-surface-variant);
    transform: translateY(-2px);
    box-shadow: var(--md-sys-elevation-2);
}

.fm-item.selected {
    border-color: var(--md-sys-color-primary);
    background: var(--md-sys-color-primary-container);
}

.fm-item.dragging {
    opacity: 0.5;
}

.fm-item.drag-target {
    border-color: var(--md-sys-color-tertiary);
    background: var(--md-sys-color-tertiary-container);
    transform: scale(1.05);
    box-shadow: var(--md-sys-elevation-3);
}

.fm-action-btn.rename:hover {
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-secondary);
}

.fm-item-icon {
    font-size: 48px;
    margin-bottom: 8px;
}

.fm-item-icon.folder {
    color: #FFB74D;
}

.fm-item-icon.python {
    color: #3776AB;
}

.fm-item-icon.file {
    color: var(--md-sys-color-outline);
}

.fm-item-name {
    font-size: 12px;
    text-align: center;
    word-break: break-all;
    max-width: 100%;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.fm-item-size {
    font-size: 10px;
    color: var(--md-sys-color-on-surface-variant);
    margin-top: 4px;
}

.fm-item-actions {
    position: absolute;
    top: 4px;
    right: 4px;
    display: none;
    gap: 2px;
}

.fm-item:hover .fm-item-actions {
    display: flex;
}

.fm-action-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: var(--md-sys-color-surface);
    color: var(--md-sys-color-on-surface);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    box-shadow: var(--md-sys-elevation-1);
}

.fm-action-btn:hover {
    background: var(--md-sys-color-error-container);
    color: var(--md-sys-color-error);
}

.fm-action-btn.download:hover {
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-primary);
}

.fm-action-btn.move:hover {
    background: var(--md-sys-color-tertiary-container);
    color: var(--md-sys-color-tertiary);
}

.fm-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--md-sys-color-on-surface-variant);
}

.fm-empty .material-icons {
    font-size: 64px;
    opacity: 0.5;
    margin-bottom: 16px;
}

/* ファイルマネージャモーダル */
.fm-modal-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--md-sys-color-outline);
    border-radius: 16px;
    font-size: 16px;
    background: var(--md-sys-color-surface);
    color: var(--md-sys-color-on-surface);
    margin-bottom: 16px;
}

.fm-modal-input:focus {
    outline: none;
    border-color: var(--md-sys-color-primary);
}

.fm-folder-select {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 16px;
    margin-bottom: 16px;
}

.fm-folder-option {
    padding: 12px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
}

.fm-folder-option:hover {
    background: var(--md-sys-color-surface-variant);
}

.fm-folder-option.selected {
    background: var(--md-sys-color-primary-container);
}

.fm-folder-option .material-icons {
    color: #FFB74D;
}

/* ========== メンテナンス画面 ========== */
.maintenance-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--page-background, var(--md-sys-color-surface));
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.maintenance-content {
    text-align: center;
    padding: 48px;
    max-width: 400px;
}

.maintenance-icon {
    font-size: 80px;
    color: var(--md-sys-color-primary);
    margin-bottom: 24px;
}

.maintenance-content h1 {
    font-size: 28px;
    font-weight: 500;
    color: var(--md-sys-color-on-surface);
    margin: 0 0 16px 0;
}

.maintenance-content p {
    font-size: 16px;
    color: var(--md-sys-color-on-surface-variant);
    margin: 0 0 32px 0;
    line-height: 1.6;
}

/* ========== アップロードプログレス ========== */
.upload-progress-container {
    padding: 20px 0;
}

.upload-progress-bar {
    height: 8px;
    background: var(--md-sys-color-surface-container-highest);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.upload-progress-fill {
    height: 100%;
    background: var(--md-sys-color-primary);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.upload-progress-text {
    font-size: 14px;
    color: var(--md-sys-color-on-surface-variant);
    text-align: center;
    word-break: break-all;
}

/* ドラッグ&ドロップエリアのスタイル改善 */
.fm-file-list.drag-over {
    background: var(--md-sys-color-primary-container);
    border: 2px dashed var(--md-sys-color-primary);
    border-radius: 12px;
}

.fm-file-list.drag-over::before {
    content: 'ここにファイルをドロップ';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 18px;
    font-weight: 500;
    color: var(--md-sys-color-primary);
    pointer-events: none;
    z-index: 10;
}

/* ========== ファイルタイプセレクター ========== */
.file-type-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.file-type-btn {
    flex: 0 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 14px;
    background: var(--md-sys-color-surface-container);
    border: 2px solid var(--md-sys-color-outline-variant);
    border-radius: 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--md-sys-color-on-surface);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.file-type-btn:hover {
    background: var(--md-sys-color-surface-container-high);
    border-color: var(--md-sys-color-outline);
}

.file-type-btn.active {
    background: var(--md-sys-color-primary-container);
    border-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary-container);
}

.file-type-btn .material-icons {
    font-size: 20px;
}

/* Python アイコンカラー */
.file-type-btn[data-type="python"].active .material-icons {
    color: #3776AB;
}

/* Node.js アイコンカラー */
.file-type-btn[data-type="nodejs"].active .material-icons {
    color: #339933;
}

/* TypeScript アイコンカラー */
.file-type-btn[data-type="typescript"].active .material-icons {
    color: #3178C6;
}

/* Bun アイコンカラー */
.file-type-btn[data-type="bun"].active .material-icons {
    color: #fbf0df;
}

/* ========================================
   利用規約モーダル
======================================== */

.tos-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.tos-modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.tos-modal {
    background: var(--md-sys-color-surface);
    border-radius: 28px;
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--md-sys-elevation-3);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s var(--md-sys-motion-easing-emphasized);
    overflow: hidden;
}

.tos-modal-overlay.show .tos-modal {
    transform: scale(1) translateY(0);
}

.tos-modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 24px 16px;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.tos-modal-header .material-icons {
    font-size: 32px;
    color: var(--md-sys-color-primary);
}

.tos-modal-header h2 {
    font-size: 24px;
    font-weight: 500;
    color: var(--md-sys-color-on-surface);
    margin: 0;
    flex: 1;
}

.tos-close-btn {
    background: none;
    border: none;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--md-sys-color-on-surface-variant);
    transition: background 0.2s, color 0.2s;
    flex-shrink: 0;
}

.tos-close-btn:hover {
    background: var(--md-sys-color-surface-variant);
    color: var(--md-sys-color-on-surface);
}

.tos-modal-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
}

.tos-intro {
    font-size: 14px;
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.tos-section {
    margin-bottom: 20px;
    padding: 16px;
    background: var(--md-sys-color-surface-container);
    border-radius: 16px;
}

.tos-section h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 500;
    color: var(--md-sys-color-on-surface);
    margin: 0 0 8px 0;
}

.tos-section h3 .material-icons {
    font-size: 20px;
    color: var(--md-sys-color-primary);
}

.tos-section p {
    font-size: 14px;
    line-height: 1.6;
    color: var(--md-sys-color-on-surface-variant);
    margin: 0;
}

.tos-section a {
    color: var(--md-sys-color-primary);
    text-decoration: none;
}

.tos-section a:hover {
    text-decoration: underline;
}

.tos-section small {
    color: var(--md-sys-color-on-surface-variant);
    opacity: 0.8;
}

.tos-agreement {
    background: var(--md-sys-color-primary-container);
    border-radius: 16px;
    padding: 16px;
    margin: 20px 0;
}

.tos-agreement p {
    font-size: 14px;
    color: var(--md-sys-color-on-primary-container);
    margin: 0;
    text-align: center;
}

.tos-note {
    font-size: 12px;
    color: var(--md-sys-color-on-surface-variant);
    text-align: center;
    opacity: 0.8;
    margin: 0;
}

.tos-modal-footer {
    padding: 16px 24px 24px;
    display: flex;
    justify-content: center;
}

.tos-agree-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 32px;
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    border: none;
    border-radius: 100px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--md-sys-elevation-1);
}

.tos-agree-btn:hover {
    background: var(--md-sys-color-primary);
    filter: brightness(1.1);
    box-shadow: var(--md-sys-elevation-2);
}

.tos-agree-btn .material-icons {
    font-size: 20px;
}

/* モバイル対応 */
@media (max-width: 600px) {
    .tos-modal {
        width: 95%;
        max-height: 90vh;
        border-radius: 24px;
    }

    .tos-modal-header {
        padding: 20px 20px 12px;
    }

    .tos-modal-header h2 {
        font-size: 20px;
    }

    .tos-modal-content {
        padding: 16px 20px;
    }

    .tos-section {
        padding: 12px;
    }

    .tos-modal-footer {
        padding: 12px 20px 20px;
    }
}

/* ========================================
   外観パネル
======================================== */

.appearance-panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.appearance-panel-overlay.show {
    opacity: 1;
    visibility: visible;
}

.appearance-panel {
    background: var(--md-sys-color-surface);
    border-radius: 28px;
    width: 90%;
    max-width: 480px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--md-sys-elevation-3);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s var(--md-sys-motion-easing-emphasized);
    overflow: hidden;
}

.appearance-panel-overlay.show .appearance-panel {
    transform: scale(1) translateY(0);
}

.appearance-panel-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 24px 16px;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.appearance-panel-header .material-icons {
    font-size: 28px;
    color: var(--md-sys-color-primary);
}

.appearance-panel-header h2 {
    font-size: 22px;
    font-weight: 500;
    color: var(--md-sys-color-on-surface);
    margin: 0;
    flex: 1;
}

.appearance-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px 24px;
}

.appearance-section {
    margin-bottom: 24px;
}

.appearance-section:last-child {
    margin-bottom: 0;
}

.appearance-section h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 500;
    color: var(--md-sys-color-on-surface);
    margin-bottom: 14px;
}

.appearance-section h3 .material-icons {
    font-size: 22px;
    color: var(--md-sys-color-primary);
}

/* 背景プレビュー */
.appearance-bg-preview {
    width: 100%;
    height: 140px;
    border-radius: 16px;
    background: var(--md-sys-color-surface-container);
    border: 2px dashed var(--md-sys-color-outline-variant);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-bottom: 12px;
    position: relative;
}

.appearance-bg-preview.has-image {
    border-style: solid;
    border-color: var(--md-sys-color-primary);
}

.appearance-bg-preview #appearance-bg-placeholder {
    font-size: 48px;
    color: var(--md-sys-color-outline);
}

.appearance-bg-preview #appearance-bg-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.appearance-bg-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.appearance-bg-actions .btn-secondary {
    font-size: 13px;
}

/* オーバーレイ不透明度 */
.appearance-bg-opacity {
    margin-top: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.appearance-bg-opacity label {
    font-size: 13px;
    color: var(--md-sys-color-on-surface-variant);
    white-space: nowrap;
}

.appearance-bg-opacity input[type="range"] {
    flex: 1;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--md-sys-color-surface-variant);
    border-radius: 2px;
    outline: none;
}

.appearance-bg-opacity input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--md-sys-color-primary);
    cursor: pointer;
    box-shadow: var(--md-sys-elevation-1);
}

.appearance-bg-opacity input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--md-sys-color-primary);
    cursor: pointer;
    border: none;
    box-shadow: var(--md-sys-elevation-1);
}

.appearance-bg-opacity span {
    font-size: 13px;
    font-weight: 500;
    color: var(--md-sys-color-on-surface);
    min-width: 36px;
    text-align: right;
}

/* カラーグリッド */
.appearance-color-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
    gap: 10px;
}

.appearance-color-swatch {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 16px;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.2s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.appearance-color-swatch:hover {
    transform: scale(1.1);
    box-shadow: var(--md-sys-elevation-2);
}

.appearance-color-swatch:active {
    transform: scale(0.95);
}

.appearance-color-swatch.selected {
    border-color: var(--md-sys-color-on-surface);
    box-shadow: var(--md-sys-elevation-2);
}

.appearance-color-swatch.selected::after {
    content: 'check';
    font-family: 'Material Icons';
    font-size: 22px;
    color: white;
    text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

/* 背景画像オーバーレイ */
body.has-custom-bg {
    background: transparent;
}

body.has-custom-bg .custom-bg-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: var(--custom-bg-image);
    background-size: cover;
    background-position: center;
    z-index: -2;
    pointer-events: none;
}

body.has-custom-bg .custom-bg-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--md-sys-color-background);
    opacity: var(--custom-bg-overlay, 0.5);
    z-index: -1;
    pointer-events: none;
}

body.has-custom-bg .dashboard-container {
    background: transparent;
}

body.has-custom-bg .top-bar {
    background: color-mix(in srgb, var(--md-sys-color-surface) 92%, transparent);
}

body.has-custom-bg .main-content {
    background: transparent;
}

body.has-custom-bg .stat-card {
    background: color-mix(in srgb, var(--md-sys-color-surface) 70%, transparent);
}

body.has-custom-bg .tabs {
    background: color-mix(in srgb, var(--md-sys-color-surface) 65%, transparent);
    border-radius: 12px;
}

body.has-custom-bg .tab-panel {
    background: transparent;
}

body.has-custom-bg .api-keys-section {
    background: color-mix(in srgb, var(--md-sys-color-surface) 70%, transparent);
    border-radius: 28px;
}

body.has-custom-bg .fm-item,
body.has-custom-bg .file-item,
body.has-custom-bg .process-item,
body.has-custom-bg .workspace-card {
    background: color-mix(in srgb, var(--md-sys-color-surface) 65%, transparent);
}

body.has-custom-bg .fm-file-list {
    background: transparent;
}

body.has-custom-bg .filemanager-toolbar {
    background: color-mix(in srgb, var(--md-sys-color-surface-variant) 55%, transparent);
    border-radius: 20px;
}

body.has-custom-bg .file-list {
    background: color-mix(in srgb, var(--md-sys-color-surface-container) 65%, transparent);
    border-radius: 28px;
}

body.has-custom-bg .workspaces-header {
    background: transparent;
}

body.has-custom-bg .workspace-list {
    background: transparent;
}

body.has-custom-bg #process-list {
    background: color-mix(in srgb, var(--md-sys-color-surface-container) 65%, transparent);
    border-radius: 28px;
}

body.has-custom-bg .modal {
    background: color-mix(in srgb, var(--md-sys-color-surface) 80%, transparent);
}

body.has-custom-bg .md3-dialog {
    background: color-mix(in srgb, var(--md-sys-color-surface-container-high) 80%, transparent);
}

/* ========================================
   What's New モーダル
======================================== */

.whatsnew-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.whatsnew-modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.whatsnew-modal {
    background: var(--md-sys-color-surface);
    border-radius: 28px;
    width: 90%;
    max-width: 560px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--md-sys-elevation-3);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s var(--md-sys-motion-easing-emphasized);
    overflow: hidden;
}

.whatsnew-modal-overlay.show .whatsnew-modal {
    transform: scale(1) translateY(0);
}

.whatsnew-modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 24px 16px;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.whatsnew-modal-header .material-icons {
    font-size: 28px;
    color: var(--md-sys-color-primary);
}

.whatsnew-modal-header h2 {
    font-size: 22px;
    font-weight: 500;
    color: var(--md-sys-color-on-surface);
    margin: 0;
    flex: 1;
}

.whatsnew-modal-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px 24px;
}

.whatsnew-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 24px 20px;
    border-top: 1px solid var(--md-sys-color-outline-variant);
}

/* お知らせカード */
.whatsnew-item {
    padding: 14px;
    border-radius: 16px;
    margin-bottom: 12px;
    background: var(--md-sys-color-surface-container-low);
    border: 1px solid var(--md-sys-color-outline-variant);
    transition: background 0.2s;
}

.whatsnew-item.unread {
    background: var(--md-sys-color-primary-container);
    border-color: var(--md-sys-color-primary);
}

.whatsnew-item.important {
    border-left: 4px solid #D32F2F;
}

.whatsnew-item.important.unread {
    background: #FFEBEE;
    border-color: #D32F2F;
    border-left: 4px solid #D32F2F;
}

[data-theme="dark"] .whatsnew-item.important.unread {
    background: #4A1A1A;
    border-color: #EF5350;
    border-left-color: #EF5350;
}

.whatsnew-item-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.whatsnew-category {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.whatsnew-category.important {
    background: #D32F2F22;
    color: #D32F2F;
}

[data-theme="dark"] .whatsnew-category.important {
    background: #EF535033;
    color: #EF5350;
}

.whatsnew-category.update {
    background: #388E3C22;
    color: #388E3C;
}

[data-theme="dark"] .whatsnew-category.update {
    background: #66BB6A33;
    color: #66BB6A;
}

.whatsnew-category.bugfix {
    background: #F57C0022;
    color: #F57C00;
}

[data-theme="dark"] .whatsnew-category.bugfix {
    background: #FFA72633;
    color: #FFA726;
}

.whatsnew-date {
    font-size: 12px;
    color: var(--md-sys-color-on-surface-variant);
}

.whatsnew-item h4 {
    margin: 0 0 4px;
    font-size: 15px;
    font-weight: 500;
    color: var(--md-sys-color-on-surface);
}

.whatsnew-item p {
    margin: 0;
    font-size: 13px;
    color: var(--md-sys-color-on-surface-variant);
    white-space: pre-wrap;
    line-height: 1.5;
}

.whatsnew-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: #D32F2F;
    color: white;
    font-size: 11px;
    font-weight: 600;
    margin-left: auto;
}

.whatsnew-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--md-sys-color-on-surface-variant);
}

.whatsnew-empty .material-icons {
    font-size: 48px;
    opacity: 0.4;
    margin-bottom: 8px;
    display: block;
}

@media (max-width: 600px) {
    .whatsnew-modal {
        width: 95%;
        max-height: 90vh;
        border-radius: 24px;
    }

    .whatsnew-modal-header {
        padding: 20px 16px 12px;
    }

    .whatsnew-modal-content {
        padding: 12px 16px;
    }
}

/* ===== ワークスペース ===== */

.workspaces-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1rem;
}

.workspace-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
    gap: 1rem;
}

.workspace-list .empty-state {
    grid-column: 1 / -1;
    text-align: center;
}

/* ワークスペースカード - マジックエフェクト */
.workspace-card {
    background: var(--md-sys-color-surface-container);
    border-radius: 16px;
    padding: 1.25rem;
    cursor: pointer;
    transition: all 300ms var(--md-sys-motion-easing-bounce);
    border: 1px solid var(--md-sys-color-outline-variant);
    animation: cardAppear 0.5s var(--md-sys-motion-easing-bounce) forwards;
    opacity: 0;
    transform: scale(1);
}

.workspace-card:nth-child(1) {
    animation-delay: 0ms;
}

.workspace-card:nth-child(2) {
    animation-delay: 80ms;
}

.workspace-card:nth-child(3) {
    animation-delay: 160ms;
}

.workspace-card:nth-child(4) {
    animation-delay: 240ms;
}

@keyframes cardAppear {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(40px) rotateX(10deg);
    }

    60% {
        transform: scale(1.02) translateY(-5px) rotateX(0deg);
    }

    100% {
        opacity: 1;
        transform: scale(1) translateY(0) rotateX(0deg);
    }
}

.workspace-card:hover {
    background: var(--md-sys-color-surface-container-high);
    box-shadow: var(--md-sys-elevation-2);
    transform: scale(1.02) translateY(-4px);
}

.workspace-card:active {
    transform: scale(0.98);
    transition: all 100ms var(--md-sys-motion-easing-standard);
}

.workspace-card-header {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.workspace-icon {
    background: linear-gradient(135deg, var(--md-sys-color-primary), var(--md-sys-color-tertiary));
    color: white;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.workspace-info h3 {
    margin: 0 0 0.25rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--md-sys-color-on-surface);
}

.workspace-role {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    color: var(--md-sys-color-on-surface-variant);
    background: var(--md-sys-color-surface-container-highest);
    padding: 0.25rem 0.5rem;
    border-radius: 8px;
}

.workspace-role .material-icons {
    font-size: 14px;
}

.workspace-card-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.813rem;
    color: var(--md-sys-color-on-surface-variant);
}

.workspace-card-stats span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.workspace-card-stats .material-icons {
    font-size: 16px;
}

/* ========== スマートフォン最適化 ========== */
@media (max-width: 640px) {

    /* タブをアイコンのみで表示 */
    .tabs {
        gap: 0;
        padding: 0;
    }

    .tab {
        flex: 1;
        padding: 12px 8px;
        font-size: 0;
        background: transparent;
        border: none;
        border-bottom: 3px solid transparent;
        color: var(--md-sys-color-on-surface-variant);
        transition: all 200ms var(--md-sys-motion-easing-standard);
        border-radius: 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .tab .material-icons {
        font-size: 24px;
        margin: 0;
    }

    .tab span:not(.material-icons) {
        display: none;
    }

    .tab.active {
        color: var(--md-sys-color-primary);
        border-bottom-color: var(--md-sys-color-primary);
        background: transparent;
    }

    /* ワークスペース情報パネルを小さく */
    .workspace-header {
        padding: 16px;
    }

    .workspace-info {
        flex: 1;
    }

    .workspace-info h2 {
        font-size: 18px;
        margin: 0 0 8px 0;
    }

    .workspace-role {
        font-size: 0.65rem;
        padding: 0.2rem 0.4rem;
    }

    .workspace-stats {
        gap: 8px;
    }

    .workspace-stat {
        font-size: 12px;
    }

    .workspace-stat .material-icons {
        font-size: 18px;
    }

    /* ファイルマネージャーツールバーをアイコンのみに */
    .filemanager-toolbar {
        padding: 8px;
    }

    .filemanager-breadcrumb {
        font-size: 12px;
    }

    .breadcrumb-item {
        padding: 4px 8px;
        font-size: 12px;
    }

    /* アクション ボタンサイズを小さく */
    .btn-icon {
        width: 40px;
        height: 40px;
        min-height: 40px;
    }

    .btn-icon .material-icons {
        font-size: 20px;
    }

    /* ファイルリストの密度を上げる */
    .file-list {
        gap: 4px;
        padding: 8px;
    }

    .file-item {
        padding: 8px;
        gap: 8px;
    }

    .file-item-info h4 {
        font-size: 14px;
    }

    .file-item-meta {
        font-size: 12px;
    }

    .file-item .material-icons {
        font-size: 28px;
    }

    /* ファイルマネージャーファイルリスト */
    .fm-file-list {
        padding: 8px;
        gap: 4px;
    }

    .fm-file-item {
        padding: 8px;
        gap: 8px;
    }

    .fm-file-name {
        font-size: 14px;
    }

    .fm-file-size {
        font-size: 12px;
    }

    /* プロセスリスト */
    .process-list {
        gap: 4px;
        padding: 8px;
    }

    .process-item {
        padding: 8px;
        gap: 8px;
    }

    .process-name {
        font-size: 14px;
    }

    .process-status {
        font-size: 12px;
    }

    /* モーダルサイズ調整 */
    .modal {
        width: 95%;
        max-height: 85vh;
        margin: 0 auto;
        border-radius: 20px;
    }

    .modal-header {
        padding: 16px;
        font-size: 18px;
    }

    .modal-content {
        padding: 16px;
    }

    .modal-footer {
        padding: 16px;
        gap: 8px;
    }

    /* ボタンサイズ */
    .btn {
        padding: 10px 16px;
        font-size: 14px;
        height: auto;
    }

    .btn-primary {
        padding: 10px 16px;
        font-size: 14px;
    }

    /* メンバーリスト */
    .members-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .member-card {
        padding: 8px;
        gap: 8px;
    }

    .member-avatar {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    .member-info h4 {
        font-size: 14px;
    }

    .member-info p {
        font-size: 12px;
    }
}

/* 極小画面対応 (< 480px) */
@media (max-width: 480px) {
    .workspace-header {
        padding: 12px;
    }

    .workspace-info h2 {
        font-size: 16px;
        margin: 0 0 4px 0;
    }

    .workspace-stats {
        gap: 4px;
        margin-bottom: 12px;
    }

    .workspace-stat {
        font-size: 11px;
        flex-direction: column;
        align-items: center;
        gap: 2px;
    }

    .workspace-stat .material-icons {
        font-size: 16px;
    }

    .tab {
        padding: 10px 4px;
    }

    .file-item-info {
        flex: 1;
        min-width: 0;
    }

    /* テキスト省略 */
    .file-item-info h4,
    .fm-file-name,
    .process-name {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 100%;
    }
}

/* ===== APIキー管理 ===== */
.api-keys-section {
    background: var(--md-sys-color-surface);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--md-sys-elevation-1);
}

.api-keys-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.api-keys-header h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 1.25rem;
    color: var(--md-sys-color-on-surface);
}

.api-keys-description {
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.875rem;
    margin-bottom: 20px;
}

.api-keys-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 32px;
}

.api-key-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--md-sys-color-surface-container);
    border-radius: 12px;
    transition: all 0.2s;
}

.api-key-item:hover {
    background: var(--md-sys-color-surface-container-high);
}

.api-key-info {
    flex: 1;
    min-width: 0;
}

.api-key-name {
    font-weight: 500;
    color: var(--md-sys-color-on-surface);
    margin-bottom: 4px;
}

.api-key-value {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.813rem;
    color: var(--md-sys-color-on-surface-variant);
    background: var(--md-sys-color-surface-variant);
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
}

.api-key-meta {
    font-size: 0.75rem;
    color: var(--md-sys-color-on-surface-variant);
    margin-top: 8px;
}

.api-key-actions {
    display: flex;
    gap: 8px;
}

.api-docs {
    background: var(--md-sys-color-surface-container-lowest);
    border-radius: 12px;
    padding: 20px;
    margin-top: 24px;
    overflow-x: auto;
    min-width: 0;
}

.api-docs h4 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 16px 0;
    font-size: 1rem;
    color: var(--md-sys-color-on-surface);
}

.api-endpoint {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    flex-wrap: wrap;
    min-width: 0;
}

.api-endpoint:last-of-type {
    border-bottom: none;
}

.api-endpoint code {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.813rem;
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    padding: 4px 8px;
    border-radius: 4px;
    min-width: 0;
    word-break: break-all;
}

.api-endpoint span {
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.875rem;
}

.api-endpoint-group {
    margin-left: 24px;
    padding-left: 16px;
    border-left: 2px solid var(--md-sys-color-outline-variant);
    overflow-x: auto;
    min-width: 0;
}

.api-endpoint-sub {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 0;
}

.api-endpoint-sub code {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.813rem;
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
    padding: 4px 12px;
    border-radius: 4px;
    min-width: 60px;
    text-align: center;
}

.api-endpoint-sub span {
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.875rem;
}

.api-usage-example {
    margin-top: 20px;
}

.api-usage-example h5 {
    margin: 0 0 12px 0;
    color: var(--md-sys-color-on-surface);
    font-size: 0.875rem;
}

.api-usage-example pre {
    background: var(--md-sys-color-surface-variant);
    border-radius: 8px;
    padding: 16px;
    overflow-x: auto;
    font-family: 'Roboto Mono', monospace;
    font-size: 0.813rem;
    color: var(--md-sys-color-on-surface);
    margin: 0;
    line-height: 1.5;
}

.api-keys-empty {
    text-align: center;
    padding: 32px;
    color: var(--md-sys-color-on-surface-variant);
}

.api-keys-empty .material-icons {
    font-size: 48px;
    opacity: 0.5;
    margin-bottom: 12px;
}

/* トークン表示エリア */
.api-token-section {
    margin-bottom: 24px;
}

.api-token-display {
    margin-bottom: 12px;
    word-break: break-all;
}

.api-token-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.api-token-actions .btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.813rem;
    padding: 8px 16px;
}

/* ===== Material 3 カスタムダイアログ ===== */

.md3-dialog-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0);
    opacity: 0;
    pointer-events: none;
    transition: background 200ms var(--md-sys-motion-easing-standard),
        opacity 200ms var(--md-sys-motion-easing-standard);
}

.md3-dialog-overlay.show {
    background: rgba(0, 0, 0, 0.32);
    opacity: 1;
    pointer-events: auto;
}

.md3-dialog-overlay.closing {
    background: rgba(0, 0, 0, 0);
    opacity: 0;
}

.md3-dialog {
    background: var(--md-sys-color-surface-container-high);
    border-radius: 28px;
    padding: 24px;
    min-width: min(280px, calc(100vw - 48px));
    max-width: 560px;
    width: calc(100vw - 48px);
    box-shadow: var(--md-sys-elevation-3);
    transform: scale(0.85) translateY(20px);
    opacity: 0;
    transition: transform 250ms var(--md-sys-motion-easing-emphasized),
        opacity 200ms var(--md-sys-motion-easing-standard);
}

.md3-dialog.show {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.md3-dialog.closing {
    transform: scale(0.9) translateY(10px);
    opacity: 0;
    transition-duration: 150ms;
}

.md3-dialog-icon {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}

.md3-dialog-icon .material-icons {
    font-size: 24px;
    color: var(--md-sys-color-secondary);
}

.md3-dialog-title {
    font-size: 24px;
    font-weight: 400;
    color: var(--md-sys-color-on-surface);
    text-align: center;
    margin: 0 0 16px 0;
    line-height: 1.3;
}

.md3-dialog-body {
    color: var(--md-sys-color-on-surface-variant);
    font-size: 14px;
    line-height: 1.6;
    text-align: center;
    margin-bottom: 24px;
}

.md3-dialog-body p {
    margin: 0 0 4px 0;
}

.md3-dialog-body p:last-child {
    margin-bottom: 0;
}

.md3-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.md3-dialog-btn {
    border: none;
    border-radius: 20px;
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.1px;
    cursor: pointer;
    transition: background 200ms var(--md-sys-motion-easing-standard),
        box-shadow 200ms var(--md-sys-motion-easing-standard),
        transform 100ms ease;
    min-width: 80px;
    position: relative;
    overflow: hidden;
}

.md3-dialog-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    opacity: 0;
    transition: opacity 200ms;
}

.md3-dialog-btn:hover::after {
    opacity: var(--md-sys-state-hover-state-layer-opacity);
}

.md3-dialog-btn:active {
    transform: scale(0.97);
}

.md3-dialog-btn:focus-visible {
    outline: 2px solid var(--md-sys-color-primary);
    outline-offset: 2px;
}

/* テキストボタン（キャンセル等） */
.md3-dialog-btn-text {
    background: transparent;
    color: var(--md-sys-color-primary);
}

.md3-dialog-btn-text::after {
    background: var(--md-sys-color-primary);
}

/* Filledボタン（OK等） */
.md3-dialog-btn-filled {
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
}

.md3-dialog-btn-filled::after {
    background: var(--md-sys-color-on-primary);
}

/* 危険アクション用ボタン */
.md3-dialog-btn-danger {
    background: var(--md-sys-color-error);
    color: var(--md-sys-color-on-error);
}

.md3-dialog-btn-danger::after {
    background: var(--md-sys-color-on-error);
}

/* Prompt入力フィールド */
.md3-dialog-input-wrap {
    margin-bottom: 24px;
    padding: 0 4px;
}

.md3-dialog-input {
    width: 100%;
    padding: 14px 16px;
    font-size: 14px;
    font-family: inherit;
    color: var(--md-sys-color-on-surface);
    background: transparent;
    border: 1px solid var(--md-sys-color-outline);
    border-radius: 12px;
    outline: none;
    box-sizing: border-box;
    transition: border-color 200ms var(--md-sys-motion-easing-standard),
        box-shadow 200ms var(--md-sys-motion-easing-standard);
    caret-color: var(--md-sys-color-primary);
}

.md3-dialog-input:hover {
    border-color: var(--md-sys-color-on-surface);
}

.md3-dialog-input:focus {
    border-color: var(--md-sys-color-primary);
    border-width: 2px;
    padding: 13px 15px;
    box-shadow: none;
}

/* 小さい画面 */
@media (max-width: 600px) {
    .md3-dialog {
        min-width: 0;
        padding: 20px;
        border-radius: 24px;
    }

    .md3-dialog-actions {
        flex-direction: column-reverse;
    }

    .md3-dialog-btn {
        width: 100%;
    }
}

/* ========== グローバルモバイル最適化 ========== */
@media (max-width: 640px) {

    /* ダッシュボード トップバー */
    .top-bar {
        padding: 0 12px;
        height: 56px;
    }

    .top-bar-title h1 {
        font-size: 18px;
    }

    .top-bar-actions {
        gap: 8px;
    }

    /* メインコンテンツパディング */
    .main-content {
        padding: 12px;
    }

    /* API ドキュメント */
    .api-docs {
        padding: 12px;
    }

    .api-endpoint {
        gap: 8px;
        padding: 6px 0;
        flex-direction: column;
        align-items: flex-start;
    }

    .api-endpoint code {
        font-size: 0.75rem;
        max-width: 100%;
        overflow-wrap: break-word;
    }

    .api-endpoint-group {
        margin-left: 8px;
        padding-left: 12px;
    }

    /* ストレージバー */
    .storage-bar {
        margin: 8px 16px 12px;
    }

    /* モーダル */
    .modal {
        padding: 16px;
        border-radius: 20px;
    }

    .modal-header h2 {
        font-size: 18px;
    }

    .modal-body {
        margin-bottom: 16px;
        overflow-y: auto;
        min-height: 0;
    }

    .form-field {
        margin-bottom: 12px;
    }

    .form-field input,
    .form-field textarea,
    .form-field select {
        padding: 10px 12px;
    }

    .form-field textarea {
        min-height: 100px;
    }

    .dropzone {
        padding: 24px;
    }

    .dropzone .material-icons {
        font-size: 32px;
        margin-bottom: 8px;
    }

    .file-type-selector {
        flex-wrap: wrap;
    }

    .file-type-btn {
        flex: 1 1 calc(50% - 6px);
        min-width: fit-content;
        padding: 8px 12px;
    }

    .log-entry {
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
    }

    /* スナックバー */
    .snackbar {
        bottom: 16px;
        font-size: 13px;
        padding: 12px 16px;
    }

    /* ワークスペースカード */
    .workspace-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .top-bar {
        padding: 0 8px;
        height: 48px;
    }

    .top-bar-title h1 {
        font-size: 16px;
    }

    .top-bar-title .logo-icon {
        font-size: 20px;
    }

    .top-bar-actions {
        gap: 8px;
    }

    .main-content {
        padding: 8px;
    }

    /* ステータスカード */
    .stat-card {
        padding: 12px;
    }

    .stat-value {
        font-size: 20px;
    }

    /* ユーザーメニュー */
    .user-menu {
        min-width: calc(100vw - 24px);
        right: -8px;
    }
}

/* ===== 一時BAN画面 ===== */
.ban-screen-overlay {
    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: 999999;
    padding: 24px;
    box-sizing: border-box;
    animation: fadeIn 300ms ease;
}

.ban-screen {
    background: var(--md-sys-color-surface);
    border-radius: 28px;
    padding: 40px 32px;
    max-width: 480px;
    width: calc(100% - 32px);
    box-shadow: var(--md-sys-elevation-3);
    text-align: center;
    animation: genieOpen 350ms cubic-bezier(0.2, 0.9, 0.3, 1) forwards;
    border: 2px solid #e74c3c;
}

.ban-screen .ban-icon {
    font-size: 64px;
    margin-bottom: 12px;
}

.ban-screen h2 {
    font-size: 22px;
    font-weight: 700;
    color: #e74c3c;
    margin-bottom: 16px;
}

.ban-screen .ban-reason {
    font-size: 15px;
    color: var(--md-sys-color-on-surface);
    background: var(--md-sys-color-surface-variant);
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 20px;
    line-height: 1.6;
}

.ban-screen .ban-expiry {
    font-size: 18px;
    font-weight: 600;
    color: var(--md-sys-color-on-surface);
    margin-bottom: 8px;
}

.ban-screen .ban-expiry-detail {
    font-size: 13px;
    font-weight: 400;
    color: var(--md-sys-color-on-surface-variant);
    margin-top: 4px;
}

.ban-screen .ban-note {
    font-size: 13px;
    color: var(--md-sys-color-on-surface-variant);
    margin-top: 20px;
    line-height: 1.6;
}

.ban-screen .ban-note a {
    color: var(--md-sys-color-primary);
    text-decoration: underline;
}

@media (max-width: 600px) {
    .ban-screen {
        padding: 28px 20px;
    }

    .ban-screen .ban-icon {
        font-size: 48px;
    }

    .ban-screen h2 {
        font-size: 18px;
    }
}

/* ブロードキャストバナー */
.broadcast-banner {
    padding: 12px 20px;
    border-radius: 12px;
    background: #e0f7fa;
    color: #006064;
    font-size: 14px;
    line-height: 1.5;
    border-left: 4px solid #00bcd4;
    margin-bottom: 16px;
    align-items: center;
    gap: 10px;
}

.broadcast-banner .material-icons {
    font-size: 20px;
    color: #00acc1;
    flex-shrink: 0;
}

[data-theme="dark"] .broadcast-banner {
    background: #0a2a2e;
    color: #b2ebf2;
    border-left-color: #00838f;
}

[data-theme="dark"] .broadcast-banner .material-icons {
    color: #4dd0e1;
}