* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Meirio, sans-serif;
    background: radial-gradient(ellipse at bottom, #0d1b2a 0%, #1b263b 50%, #0f172a 100%);
    min-height: 100vh;
    padding: 20px;
    color: white;
}

/* ヘッダー */
.main-header {
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 12px 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    margin: -20px -20px 20px -20px;
}

.header-link {
    display: flex;
    align-items: center;
    gap: 15px;
    text-decoration: none;
    color: white;
    font-weight: 600;
    font-size: 18px;
    transition: color 0.3s ease;
}

.header-link:hover {
    color: #60a5fa;
}

.header-logo {
    height: 40px;
    width: auto;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(12px);
    border-radius: 24px;
    box-shadow: 
        0 0 0 1px rgba(255, 255, 255, 0.05),
        0 25px 50px -12px rgba(0, 0, 0, 0.25),
        0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(59, 130, 246, 0.2);
    overflow: hidden;
}

.header {
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
    color: white;
    padding: 30px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.header h1 {
    font-size: 28px;
    margin-bottom: 10px;
    background: linear-gradient(45deg, #fbbf24, #f59e0b, #fbbf24);
    background-size: 200% 200%;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: starGlow 2s ease-in-out infinite alternate;
}

@keyframes starGlow {
    0% { background-position: 0% 50%; }
    100% { background-position: 100% 50%; }
}

.header p {
    opacity: 0.9;
    font-size: 14px;
    color: rgba(241, 245, 249, 0.8);
}

.content {
    padding: 30px;
}

.section {
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(30, 41, 59, 0.5);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #f1f5f9;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title::before {
    content: '';
    width: 4px;
    height: 20px;
    background: #60a5fa;
    border-radius: 2px;
}

.drop-zone {
    border: 3px dashed #60a5fa;
    border-radius: 10px;
    padding: 60px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: rgba(30, 41, 59, 0.3);
}

.drop-zone:hover, .drop-zone.drag-over {
    background: rgba(96, 165, 250, 0.1);
    border-color: #fbbf24;
    transform: translateY(-2px);
}

.drop-zone-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.drop-zone-text {
    font-size: 16px;
    color: rgba(241, 245, 249, 0.8);
    margin-bottom: 10px;
}

.drop-zone-subtext {
    font-size: 13px;
    color: rgba(241, 245, 249, 0.6);
}

.video-info {
    display: none;
    background: rgba(30, 41, 59, 0.3);
    padding: 20px;
    border-radius: 10px;
    margin-top: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.video-info.active {
    display: block;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.info-item {
    padding: 10px;
    background: rgba(30, 41, 59, 0.5);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.info-label {
    font-size: 12px;
    color: rgba(241, 245, 249, 0.6);
    margin-bottom: 5px;
}

.info-value {
    font-size: 16px;
    font-weight: 600;
    color: #f1f5f9;
}

.settings-grid {
    display: grid;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 14px;
    font-weight: 500;
    color: #f1f5f9;
}

.form-group input,
.form-group select {
    padding: 10px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    background: rgba(30, 41, 59, 0.5);
    color: white;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #60a5fa;
}

.inline-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

/* トグルスイッチ */
.toggle-container {
    margin-bottom: 20px;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    padding: 15px;
    background: rgba(30, 41, 59, 0.3);
    border-radius: 12px;
    border: 2px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
}

.toggle-label:hover {
    background: rgba(30, 41, 59, 0.5);
    border-color: rgba(96, 165, 250, 0.3);
}

.toggle-input {
    display: none;
}

.toggle-switch {
    position: relative;
    width: 56px;
    height: 28px;
    background: rgba(30, 41, 59, 0.8);
    border-radius: 14px;
    transition: background 0.3s ease;
    border: 2px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.toggle-input:checked + .toggle-switch {
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
    border-color: #60a5fa;
}

.toggle-slider {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-input:checked + .toggle-switch .toggle-slider {
    transform: translateX(28px);
}

.toggle-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.toggle-title {
    font-size: 15px;
    font-weight: 600;
    color: #f1f5f9;
}

.toggle-description {
    font-size: 12px;
    color: rgba(241, 245, 249, 0.6);
    line-height: 1.4;
}

.preset-buttons {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

#personDetectionSettings {
    margin-top: 15px;
}

.preset-btn {
    flex: 1;
    padding: 10px;
    border: 2px solid #60a5fa;
    background: rgba(30, 41, 59, 0.5);
    color: #60a5fa;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
}

.preset-btn:hover {
    background: #60a5fa;
    color: white;
}

.preset-btn.active {
    background: #60a5fa;
    color: white;
}

.warning {
    background: rgba(251, 191, 36, 0.2);
    border-left: 4px solid #fbbf24;
    padding: 12px;
    border-radius: 8px;
    margin-top: 15px;
    font-size: 13px;
    color: #fbbf24;
    display: none;
}

.warning.show {
    display: block;
}

.btn {
    padding: 15px 30px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
}

.btn-primary {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: #0f172a;
    width: 100%;
    margin-top: 20px;
    font-weight: 700;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(251, 191, 36, 0.3);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    background: rgba(30, 41, 59, 0.8);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
    background: rgba(30, 41, 59, 1);
}

.progress-container {
    display: none;
    margin-top: 20px;
}

.progress-container.active {
    display: block;
}

.progress-bar-wrapper {
    width: 100%;
    height: 30px;
    background: rgba(30, 41, 59, 0.5);
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 15px;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #60a5fa 0%, #3b82f6 100%);
    transition: width 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: 600;
}

.progress-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 15px;
}

.progress-stat {
    padding: 10px;
    background: rgba(30, 41, 59, 0.5);
    border-radius: 8px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.progress-stat-label {
    font-size: 11px;
    color: rgba(241, 245, 249, 0.6);
    margin-bottom: 5px;
}

.progress-stat-value {
    font-size: 18px;
    font-weight: 600;
    color: #60a5fa;
}

.preview-canvas {
    max-width: 200px;
    border-radius: 8px;
    margin-top: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.result-container {
    display: none;
    margin-top: 20px;
}

.result-container.active {
    display: block;
}

.result-summary {
    background: rgba(30, 41, 59, 0.3);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.result-item {
    text-align: center;
    padding: 15px;
    background: rgba(30, 41, 59, 0.5);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.result-value {
    font-size: 32px;
    font-weight: 700;
    color: #fbbf24;
    margin-bottom: 5px;
    text-shadow: 0 0 10px rgba(251, 191, 36, 0.3);
}

.result-label {
    font-size: 13px;
    color: rgba(241, 245, 249, 0.6);
}

.thumbnail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    margin-top: 20px;
}

.thumbnail {
    aspect-ratio: 16/9;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    transition: transform 0.3s;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.thumbnail:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(96, 165, 250, 0.3);
}

.thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thumbnail-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(15, 23, 42, 0.9);
    color: white;
    padding: 5px;
    font-size: 10px;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.hidden {
    display: none;
}

.range-slider {
    margin-top: 10px;
}

.range-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 10px;
}

/* モーダルスタイル */
.modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.95);
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    margin: auto;
    display: block;
    max-width: 90%;
    max-height: 85vh;
    object-fit: contain;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: zoomIn 0.3s;
}

@keyframes zoomIn {
    from { transform: translate(-50%, -50%) scale(0.8); }
    to { transform: translate(-50%, -50%) scale(1); }
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
    z-index: 10000;
}

.modal-close:hover,
.modal-close:focus {
    color: #fbbf24;
    text-decoration: none;
    cursor: pointer;
}

.modal-caption {
    margin: auto;
    display: block;
    width: 80%;
    max-width: 700px;
    text-align: center;
    color: #ccc;
    padding: 10px 0;
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 16px;
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 20px;
    border-radius: 8px;
}

@media (max-width: 768px) {
    .content {
        padding: 15px;
    }

    .inline-group {
        grid-template-columns: 1fr;
    }

    .preset-buttons {
        flex-direction: column;
    }

    .modal-content {
        max-width: 95%;
        max-height: 80vh;
    }

    .modal-close {
        top: 10px;
        right: 20px;
        font-size: 30px;
    }

    .modal-caption {
        font-size: 14px;
        width: 90%;
    }
}
