/* ===================================
   Seed Chat - スタイルシート
   ダークモード・グラスモーフィズムデザイン
   =================================== */

/* CSS変数 */
:root {
    /* カラーパレット */
    --color-bg-primary: #0a0a0f;
    --color-bg-secondary: #12121a;
    --color-bg-tertiary: #1a1a25;
    --color-bg-glass: rgba(255, 255, 255, 0.03);
    --color-bg-glass-hover: rgba(255, 255, 255, 0.06);

    --color-text-primary: #ffffff;
    --color-text-secondary: #a0a0b0;
    --color-text-muted: #606070;

    --color-accent-primary: #6366f1;
    --color-accent-secondary: #8b5cf6;
    --color-accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);

    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-error: #ef4444;

    --color-border: rgba(255, 255, 255, 0.08);
    --color-border-hover: rgba(255, 255, 255, 0.15);

    /* シャドウ */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.3);

    /* ボーダー */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    /* トランジション */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s ease;

    /* フォント */
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

/* リセット */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-main);
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* 背景グラデーション */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(139, 92, 246, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(168, 85, 247, 0.05) 0%, transparent 70%);
    pointer-events: none;
    z-index: -1;
}

/* ===================================
   ローディング画面
   =================================== */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--color-bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity var(--transition-slow), visibility var(--transition-slow);
}

.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
}

.loading-content {
    text-align: center;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-content p {
    color: var(--color-text-secondary);
    font-size: 14px;
}

/* ===================================
   アプリコンテナ
   =================================== */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-container.hidden {
    display: none;
}

.screen {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.screen.hidden {
    display: none;
}

/* ===================================
   ホーム画面
   =================================== */
.home-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    max-width: 500px;
    margin: 0 auto;
    width: 100%;
}

.logo {
    text-align: center;
    margin-bottom: 16px;
}

.logo-icon {
    font-size: 64px;
    display: block;
    margin-bottom: 16px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.logo h1 {
    font-size: 42px;
    font-weight: 700;
    background: var(--color-accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    color: var(--color-text-secondary);
    font-size: 16px;
    margin-bottom: 40px;
    text-align: center;
}

/* シード入力 */
.seed-input-container {
    width: 100%;
    margin-bottom: 24px;
}

.input-wrapper {
    position: relative;
    margin-bottom: 16px;
}

.input-wrapper input {
    width: 100%;
    padding: 16px 50px 16px 20px;
    font-size: 16px;
    font-family: var(--font-mono);
    background: var(--color-bg-glass);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    color: var(--color-text-primary);
    transition: all var(--transition-normal);
    -webkit-text-security: disc;
}

.input-wrapper input.visible {
    -webkit-text-security: none;
}

.input-wrapper input:focus {
    outline: none;
    border-color: var(--color-accent-primary);
    box-shadow: var(--shadow-glow);
}

.input-wrapper input::placeholder {
    color: var(--color-text-muted);
}

.input-wrapper .icon-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
}

/* ボタングループ */
.button-group {
    display: flex;
    gap: 12px;
}

/* ボタン */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-normal);
    text-decoration: none;
}

.btn-primary {
    background: var(--color-accent-gradient);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--color-bg-glass);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
}

.btn-secondary:hover {
    background: var(--color-bg-glass-hover);
    border-color: var(--color-border-hover);
}

.btn-small {
    padding: 8px 16px;
    font-size: 13px;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition-fast);
    font-size: 18px;
}

.icon-btn:hover {
    background: var(--color-bg-glass-hover);
}

.icon-btn .hidden {
    display: none;
}

/* 生成されたシード表示 */
.generated-seed-container {
    width: 100%;
    padding: 20px;
    background: var(--color-bg-glass);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
}

.generated-seed-container.hidden {
    display: none;
}

.generated-seed-container .label {
    font-size: 13px;
    color: var(--color-text-secondary);
    margin-bottom: 8px;
}

.seed-display {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--color-bg-secondary);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
}

.seed-display code {
    flex: 1;
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--color-accent-primary);
    word-break: break-all;
}

.generated-seed-container .hint {
    font-size: 12px;
    color: var(--color-warning);
}

/* 機能一覧 */
.features {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    justify-content: center;
}

.feature {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--color-text-secondary);
}

.feature-icon {
    font-size: 18px;
}

/* フッター */
.home-footer {
    padding: 20px;
    text-align: center;
}

.home-footer p {
    font-size: 12px;
    color: var(--color-text-muted);
}

/* ===================================
   チャット画面
   =================================== */
.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--color-bg-glass);
    border-bottom: 1px solid var(--color-border);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-info h2 {
    font-size: 16px;
    font-weight: 600;
}

.room-status {
    font-size: 12px;
    color: var(--color-text-secondary);
}

.room-status.connected {
    color: var(--color-success);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.countdown {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: var(--color-bg-secondary);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 14px;
}

.countdown-icon {
    font-size: 16px;
}

/* メッセージエリア */
.chat-main {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.messages-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--color-text-secondary);
}

.messages-empty p {
    margin-bottom: 8px;
}

.messages-empty.hidden {
    display: none;
}

.messages-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* メッセージ */
.message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: var(--radius-lg);
    animation: messageIn 0.3s ease;
}

@keyframes messageIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.own {
    align-self: flex-end;
    background: var(--color-accent-gradient);
    color: white;
    border-bottom-right-radius: 4px;
}

.message.other {
    align-self: flex-start;
    background: var(--color-bg-glass);
    border: 1px solid var(--color-border);
    border-bottom-left-radius: 4px;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 13px;
}

.message-sender {
    font-weight: 600;
}

.message.other .message-sender {
    color: var(--color-accent-primary);
}

.message-time {
    color: rgba(255, 255, 255, 0.6);
    font-size: 11px;
}

.message.other .message-time {
    color: var(--color-text-muted);
}

.message-content {
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

/* システムメッセージ */
.message.system {
    align-self: center;
    max-width: 100%;
    background: transparent;
    border: none;
    padding: 8px 16px;
    font-size: 13px;
    color: var(--color-text-muted);
    text-align: center;
}

/* チャットフッター */
.chat-footer {
    padding: 16px 20px;
    background: var(--color-bg-glass);
    border-top: 1px solid var(--color-border);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.name-input-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.name-input-wrapper label {
    font-size: 13px;
    color: var(--color-text-secondary);
    white-space: nowrap;
}

.name-input-wrapper input {
    flex: 1;
    max-width: 200px;
    padding: 8px 12px;
    font-size: 14px;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text-primary);
    transition: border-color var(--transition-fast);
}

.name-input-wrapper input:focus {
    outline: none;
    border-color: var(--color-accent-primary);
}

.message-input-wrapper {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.message-input-wrapper textarea {
    flex: 1;
    padding: 12px 16px;
    font-size: 15px;
    font-family: var(--font-main);
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    color: var(--color-text-primary);
    resize: none;
    min-height: 48px;
    max-height: 120px;
    line-height: 1.5;
    transition: border-color var(--transition-fast);
}

.message-input-wrapper textarea:focus {
    outline: none;
    border-color: var(--color-accent-primary);
}

.message-input-wrapper textarea::placeholder {
    color: var(--color-text-muted);
}

.btn-send {
    width: 48px;
    height: 48px;
    padding: 0;
    font-size: 20px;
}

/* ===================================
   トースト通知
   =================================== */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 12px 20px;
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast.success {
    border-left: 3px solid var(--color-success);
}

.toast.error {
    border-left: 3px solid var(--color-error);
}

.toast.info {
    border-left: 3px solid var(--color-accent-primary);
}

/* ===================================
   レスポンシブ
   =================================== */
@media (max-width: 768px) {
    .chat-header {
        flex-direction: column;
        gap: 12px;
        padding: 12px 16px;
    }

    .header-left,
    .header-right {
        width: 100%;
        justify-content: space-between;
    }

    .header-right {
        flex-wrap: wrap;
        gap: 8px;
    }

    .countdown {
        flex: 1;
    }

    .btn-small {
        flex: 1;
        justify-content: center;
    }

    .message {
        max-width: 90%;
    }

    .name-input-wrapper {
        flex-wrap: wrap;
    }

    .name-input-wrapper input {
        max-width: none;
    }
}

@media (max-width: 480px) {
    .logo h1 {
        font-size: 32px;
    }

    .button-group {
        flex-direction: column;
    }

    .features {
        flex-direction: column;
        align-items: center;
    }
}

/* ===================================
   スクロールバー
   =================================== */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-border-hover);
}

/* ===================================
   選択テキスト
   =================================== */
::selection {
    background: rgba(99, 102, 241, 0.3);
}