/* ============================================================
   ポイっと - Design System v2
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;500;700;900&display=swap');

:root {
    --primary: #635bff;
    --primary-hover: #524ae0;
    --primary-light: #ededff;
    --accent: #ff6b8a;
    --accent-light: #fff0f3;
    --success: #36d399;
    --success-light: #ecfdf5;
    --warning: #fbbf24;
    --warning-light: #fffbeb;
    --error: #f43f5e;
    --text: #1a1a2e;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --bg: #faf9ff;
    --card: #ffffff;
    --border: #f0eeff;
    --shadow-sm: 0 1px 2px rgba(99,91,255,0.04);
    --shadow: 0 4px 24px rgba(99,91,255,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-lg: 0 12px 40px rgba(99,91,255,0.1), 0 2px 6px rgba(0,0,0,0.04);
    --shadow-btn: 0 4px 14px rgba(99,91,255,0.25);
    --radius: 24px;
    --radius-md: 16px;
    --radius-sm: 12px;
    --radius-xs: 8px;
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }

body {
    font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 48px 16px 64px;
    line-height: 1.8;
    position: relative;
    overflow-x: hidden;
}

/* 背景デコレーション */
body::before,
body::after {
    content: '';
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.35;
    pointer-events: none;
    z-index: -1;
}

body::before {
    width: 500px;
    height: 500px;
    background: var(--primary-light);
    top: -150px;
    right: -100px;
}

body::after {
    width: 400px;
    height: 400px;
    background: var(--accent-light);
    bottom: -100px;
    left: -100px;
}

.container {
    width: 100%;
    max-width: 480px;
    text-align: center;
}

/* ============================================================
   ロゴ
   ============================================================ */
.logo {
    font-size: 36px;
    font-weight: 900;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
    display: inline-block;
    margin-bottom: 4px;
    letter-spacing: -0.02em;
}

a.logo { transition: opacity 0.2s var(--ease); }
a.logo:hover { opacity: 0.7; }

.tagline {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 32px;
    font-weight: 400;
}

/* ============================================================
   カード
   ============================================================ */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 36px 28px;
    box-shadow: var(--shadow);
    animation: fadeInUp 0.5s var(--ease);
}

/* ============================================================
   ステップインジケーター
   ============================================================ */
.steps {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 28px;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.step-number {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    background: #eee;
    color: var(--text-muted);
    transition: all 0.3s var(--ease);
}

.step.active .step-number {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 3px 10px rgba(99,91,255,0.3);
}

.step.done .step-number {
    background: var(--success);
    color: #fff;
}

.step-label {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 500;
    transition: color 0.3s var(--ease);
    white-space: nowrap;
}

.step.active .step-label,
.step.done .step-label { color: var(--text); }

.step-line {
    width: 40px;
    height: 2px;
    background: #eee;
    margin: 0 10px;
    margin-bottom: 18px;
    border-radius: 1px;
    transition: background 0.3s var(--ease);
}

.step-line.active {
    background: var(--primary);
}

/* ============================================================
   ドロップゾーン
   ============================================================ */
.drop-zone {
    border: 2px dashed #d4d0ff;
    border-radius: var(--radius-md);
    padding: 48px 24px;
    transition: all 0.25s var(--ease);
    cursor: pointer;
    position: relative;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--primary);
    background: var(--primary-light);
    transform: translateY(-2px);
}

.drop-zone:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.drop-icon {
    color: var(--primary);
    opacity: 0.5;
    margin-bottom: 16px;
    animation: float 3s ease-in-out infinite;
}

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

.drop-text {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.drop-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.drop-info {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 20px;
}

/* ============================================================
   ボタン
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 24px;
    border: none;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s var(--ease);
    text-decoration: none;
    color: #fff;
    background: var(--primary);
    box-shadow: var(--shadow-btn);
}

.btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(99,91,255,0.35);
}

.btn:active { transform: translateY(0) scale(0.98); }

.btn-select {
    background: var(--primary-light);
    color: var(--primary);
    font-size: 13px;
    padding: 10px 20px;
    box-shadow: none;
}

.btn-select:hover {
    background: #ddd9ff;
    box-shadow: none;
    transform: none;
}

.btn-upload {
    width: 100%;
    padding: 16px;
    font-size: 15px;
    margin-top: 8px;
    background: linear-gradient(135deg, var(--primary), #7c6fff);
}

.btn-copy {
    padding: 12px 20px;
    font-size: 13px;
    flex-shrink: 0;
}

.btn-secondary {
    background: var(--primary-light);
    color: var(--primary);
    box-shadow: none;
}

.btn-secondary:hover {
    background: #ddd9ff;
    box-shadow: none;
}

.btn-download {
    background: var(--primary-light);
    color: var(--primary);
    width: 100%;
    box-shadow: none;
    border-radius: var(--radius-sm);
}

.btn-download:hover {
    background: #ddd9ff;
    box-shadow: none;
}

/* ============================================================
   ファイル選択済み
   ============================================================ */
.file-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--primary-light);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    margin-top: 16px;
    animation: fadeInUp 0.3s var(--ease);
}

.file-details {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    overflow: hidden;
}

.file-name {
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.file-size { font-size: 12px; color: var(--text-secondary); }

.btn-remove {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    flex-shrink: 0;
    border-radius: 50%;
    transition: all 0.2s var(--ease);
}

.btn-remove:hover { color: var(--error); background: var(--accent-light); }

/* ============================================================
   オプション
   ============================================================ */
.upload-options {
    margin-top: 20px;
    text-align: left;
    animation: fadeInUp 0.3s var(--ease);
}

.option-group { margin-bottom: 16px; }

.option-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.option-label svg { color: var(--primary); opacity: 0.6; }

.text-input {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-xs);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
    background: #fff;
}

.text-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,91,255,0.08);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

/* ============================================================
   プログレスバー
   ============================================================ */
.progress-area {
    margin-top: 24px;
    animation: fadeInUp 0.3s var(--ease);
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--primary-light);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 3px;
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 12px;
}

/* ============================================================
   結果エリア
   ============================================================ */
.result-area {
    margin-top: 24px;
    animation: fadeInUp 0.4s var(--ease);
}

.result-icon {
    width: 56px;
    height: 56px;
    background: var(--success-light);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    color: var(--success);
}

.result-title {
    font-size: 22px;
    font-weight: 900;
    margin-bottom: 20px;
    color: var(--text);
}

.share-url-box {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.share-url {
    flex: 1;
    padding: 12px 16px;
    border: 1.5px solid var(--border);
    border-radius: 50px;
    font-size: 13px;
    font-family: inherit;
    background: #fff;
    color: var(--text);
    outline: none;
}

.share-url:focus { border-color: var(--primary); }

.expiry-info {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* 共有ボタン群 */
.share-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.share-actions .btn {
    flex: 1;
    font-size: 12px;
    padding: 10px 8px;
}

.btn-line {
    background: #06c755;
    box-shadow: 0 4px 14px rgba(6,199,85,0.25);
}

.btn-line:hover { background: #05b04c; }

.btn-x {
    background: #000;
    box-shadow: 0 4px 14px rgba(0,0,0,0.15);
}

.btn-x:hover { background: #333; }

.btn-qr {
    background: var(--text);
    box-shadow: 0 4px 14px rgba(0,0,0,0.1);
}

.btn-qr:hover { background: #374151; }

/* QRモーダル */
.qr-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    animation: fadeIn 0.2s var(--ease);
    padding: 24px;
}

.qr-modal {
    background: #fff;
    border-radius: var(--radius);
    padding: 32px;
    text-align: center;
    max-width: 320px;
    width: 100%;
    animation: fadeInUp 0.3s var(--ease);
}

.qr-modal canvas { border-radius: var(--radius-xs); }

.qr-modal p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 16px;
}

.qr-close {
    margin-top: 16px;
}

/* 履歴 */
.history-section {
    margin-top: 24px;
    text-align: left;
}

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

.history-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: var(--primary-light);
    padding: 10px 14px;
    border-radius: var(--radius-xs);
    font-size: 12px;
    animation: fadeInUp 0.2s var(--ease);
}

.history-item-name {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.history-item-copy {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 4px 10px;
    border-radius: 50px;
    font-size: 11px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s var(--ease);
}

.history-item-copy:hover { background: var(--primary-hover); }

/* エラー */
.error-area { margin-top: 20px; animation: fadeInUp 0.3s var(--ease); }

.error-text {
    color: var(--error);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 12px;
}

/* ============================================================
   トースト
   ============================================================ */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: var(--text);
    color: #fff;
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 700;
    font-family: 'Noto Sans JP', sans-serif;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    z-index: 1000;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
}

.toast.show { transform: translateX(-50%) translateY(0); }
.toast.toast-success { background: var(--primary); }

/* ============================================================
   再生ページ
   ============================================================ */
.view-page { padding-top: 32px; }
.view-page .logo { margin-bottom: 20px; }

.video-wrapper {
    border-radius: var(--radius-md);
    overflow: hidden;
    background: #000;
    line-height: 0;
    box-shadow: 0 8px 40px rgba(0,0,0,0.15);
}

.video-wrapper video {
    width: 100%;
    max-height: 70vh;
    display: block;
}

.video-info {
    padding: 20px 0 0;
    text-align: left;
}

.video-title {
    font-size: 16px;
    font-weight: 700;
    word-break: break-all;
    margin-bottom: 14px;
}

/* 残り時間バッジ */
.expiry-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--warning-light);
    border: 1px solid #fde68a;
    border-radius: var(--radius-xs);
    margin-bottom: 16px;
    width: 100%;
}

.expiry-ring {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
}

.expiry-ring-bg { fill: none; stroke: #fde68a; stroke-width: 3; }
.expiry-ring-fill {
    fill: none;
    stroke: var(--warning);
    stroke-width: 3;
    stroke-linecap: round;
}

.expiry-badge-text {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.expiry-badge-text strong {
    color: #b45309;
    font-weight: 700;
}

.expiry-badge-size {
    font-size: 11px;
    color: var(--text-muted);
}

/* パスワード/エラーカード */
.password-card,
.error-card { padding: 48px 24px; }

.lock-icon { color: var(--primary); opacity: 0.5; margin-bottom: 16px; }
.error-icon { color: var(--text-muted); margin-bottom: 16px; }

.password-card p { font-size: 14px; color: var(--text-secondary); margin-bottom: 16px; }

.password-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 260px;
    margin: 0 auto;
}

.password-form input[type="password"] {
    padding: 14px;
    border: 1.5px solid var(--border);
    border-radius: 50px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    text-align: center;
    transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.password-form input[type="password"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,91,255,0.08);
}

.error-card .error-message {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* ============================================================
   アニメーション
   ============================================================ */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* ============================================================
   レスポンシブ
   ============================================================ */
@media (max-width: 480px) {
    body { padding: 24px 12px 48px; }
    .logo { font-size: 30px; }
    .card { padding: 28px 20px; border-radius: 20px; }
    .drop-zone { padding: 36px 16px; }
    .step-line { width: 28px; }
    .share-url-box { flex-direction: column; }
    .btn-copy { width: 100%; }
    .share-actions { flex-wrap: wrap; }
    .share-actions .btn { min-width: calc(50% - 4px); }
}
