* { box-sizing: border-box; margin: 0; padding: 0; }

body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; line-height: 1.6; background: #f5f5f5; min-height: 100vh; }

header { background: #1a1a2e; color: white; padding: 1rem 2rem; }
header nav { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; }
header .logo { color: white; text-decoration: none; font-size: 1.2rem; font-weight: bold; }
header .nav-right { display: flex; gap: 1rem; align-items: center; }
header .nav-right a { color: #7dd3fc; text-decoration: none; }
header .nav-right a:hover { text-decoration: underline; }
header button { background: transparent; border: 1px solid white; color: white; padding: 0.3rem 0.8rem; cursor: pointer; border-radius: 4px; }

/* Breadcrumb */
.breadcrumb { display: flex; gap: 0.5rem; font-size: 0.9rem; color: #e0e0e0; }
.breadcrumb a { color: #7dd3fc; text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

main { padding: 2rem; max-width: 1200px; margin: 0 auto; }

footer { text-align: center; padding: 1rem; color: #666; margin-top: 2rem; }

/* Landing */
.landing { text-align: center; padding: 4rem 2rem; }
.landing h1 { font-size: 2.5rem; margin-bottom: 1rem; }
.session-form { display: flex; gap: 1rem; justify-content: center; margin-top: 2rem; flex-wrap: wrap; }
.session-form input { padding: 0.8rem 1rem; font-size: 1rem; border: 2px solid #ddd; border-radius: 8px; width: 300px; }
.session-form button { padding: 0.8rem 2rem; background: #4361ee; color: white; border: none; border-radius: 8px; cursor: pointer; font-size: 1rem; }

/* Workshop List */
.workshop-list { margin-top: 3rem; }
.workshop-list h3 { margin-bottom: 1rem; color: #333; }
.workshop-items { display: flex; flex-direction: column; gap: 0.5rem; max-width: 500px; margin: 0 auto; }
.workshop-card { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.5rem; background: white; border-radius: 8px; text-decoration: none; color: #333; box-shadow: 0 2px 4px rgba(0,0,0,0.1); transition: transform 0.2s, box-shadow 0.2s; }
.workshop-card:hover { transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,0,0,0.15); }
.workshop-name { font-weight: 600; }
.workshop-code { color: #666; font-size: 0.9rem; font-family: monospace; }
.workshop-items .loading, .workshop-items .empty { text-align: center; color: #666; padding: 2rem; }

/* Dashboard */
.dashboard { background: white; border-radius: 12px; padding: 2rem; box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.workshop-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 2rem; gap: 1rem; flex-wrap: wrap; }
.share-url { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.share-url input { padding: 0.5rem; border: 1px solid #ddd; border-radius: 4px; font-size: 0.85rem; width: 300px; background: #f8f9fa; }
.btn-copy { padding: 0.5rem 1rem; font-size: 0.85rem; }
.search-box { margin-bottom: 1rem; }
.search-box input { width: 100%; max-width: 300px; padding: 0.6rem 1rem; border: 2px solid #ddd; border-radius: 8px; font-size: 1rem; }
.rankings-table { overflow-x: auto; }
.rankings-table table { width: 100%; border-collapse: collapse; min-width: 600px; }
.rankings-table th, .rankings-table td { padding: 1rem; text-align: left; border-bottom: 1px solid #eee; }
.rankings-table tr { cursor: pointer; transition: background 0.2s; }
.rankings-table tr:hover { background: #f8f9fa; }
.rank { font-size: 1.5rem; width: 60px; }
.team-name { font-weight: 600; }

/* Progress Bar */
.progress-bar { background: #e9ecef; border-radius: 20px; height: 24px; position: relative; overflow: hidden; min-width: 150px; }
.progress-fill { background: linear-gradient(90deg, #4361ee, #3f37c9); height: 100%; border-radius: 20px; transition: width 0.3s; }
.progress-bar span { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 0.8rem; font-weight: 700; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,0.6), 0 0 2px rgba(0,0,0,0.4); }

/* Stage Dots */
.stages { vertical-align: middle; }
.stage-dot { width: 12px; height: 12px; border-radius: 50%; background: #ddd; display: inline-block; }
.stage-dot.completed { background: currentColor; }
.stage-dot.inception { color: #4361ee; }
.stage-dot.construction { color: #2ec4b6; }
.stage-dot.operations { color: #ff9f1c; }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.5rem; font-weight: 500; }
.form-group input, .form-group select { width: 100%; padding: 0.8rem; border: 2px solid #ddd; border-radius: 8px; font-size: 1rem; }
button { padding: 0.8rem 1.5rem; background: #4361ee; color: white; border: none; border-radius: 8px; cursor: pointer; font-size: 1rem; }
button:hover { background: #3f37c9; }
button:disabled { background: #aaa; cursor: not-allowed; }
.btn-danger { background: #dc3545; }
.btn-danger:hover { background: #c82333; }
.btn-primary { background: #4361ee; color: white; text-decoration: none; padding: 0.8rem 1.5rem; border-radius: 8px; display: inline-block; }
.btn-small { padding: 0.3rem 0.8rem; font-size: 0.85rem; }

/* Error/Success */
.error { color: #dc3545; margin-top: 0.5rem; }
.success { color: #28a745; margin-top: 0.5rem; }
.warning { color: #856404; background: #fff3cd; padding: 0.5rem 1rem; border-radius: 4px; margin: 1rem 0; }

/* Register */
.register-page, .login-page { max-width: 500px; margin: 0 auto; background: white; padding: 2rem; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.register-page { max-width: min(900px, 92vw); }
@media (max-width: 640px) { .register-page { padding: 1.25rem; } }
.token-result { text-align: center; overflow: visible; }
.result-item { margin: 1.5rem 0; text-align: left; }
.result-item label { display: block; margin-bottom: 0.5rem; font-weight: 500; color: #333; }
.token-box { background: #f8f9fa; padding: 1rem; border-radius: 8px; display: flex; justify-content: space-between; gap: 1rem; align-items: center; }
.token-box code { font-size: 0.95rem; word-break: break-all; flex: 1; }
.result-actions { display: flex; gap: 1rem; justify-content: center; margin-top: 1.5rem; flex-wrap: wrap; }

/* Team Page */
.team-page { background: white; border-radius: 12px; padding: 2rem; box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.team-header { margin-bottom: 2rem; }
.team-header h1 { margin-bottom: 0.5rem; }
.token-auth { background: #f8f9fa; padding: 1rem; border-radius: 8px; margin-bottom: 1rem; display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.token-auth input { flex: 1; min-width: 200px; padding: 0.6rem; border: 2px solid #ddd; border-radius: 8px; }
.auth-success { background: #d4edda; padding: 0.8rem 1rem; border-radius: 8px; margin-bottom: 1rem; display: flex; justify-content: space-between; align-items: center; color: #155724; }
.progress-checklist h2 { margin: 1.5rem 0 1rem; padding-top: 1rem; border-top: 1px solid #eee; }
.progress-checklist h2:first-child { border-top: none; padding-top: 0; }
.stage-item { display: flex; align-items: center; gap: 1rem; padding: 0.5rem 0; }
.stage-item input[type="checkbox"] { width: 20px; height: 20px; }
.stage-item label { flex: 1; }
.construction-add { display: flex; gap: 0.5rem; padding: 0.5rem 0; }
.construction-add input { flex: 1; padding: 0.3rem 0.5rem; border: 1px solid #d1d5db; border-radius: 4px; }
.construction-add button { padding: 0.3rem 0.8rem; cursor: pointer; border-radius: 4px; background: #3b82f6; color: white; border: none; }
.unit-delete { background: none; border: none; color: #ef4444; cursor: pointer; font-size: 1.1rem; padding: 0 0.3rem; }
.completed-time { color: #666; font-size: 0.9rem; }

/* Admin */
.admin-dashboard, .admin-workshop, .admin-logs, .admin-settings, .admin-admins { background: white; border-radius: 12px; padding: 2rem; box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.disk-usage { background: #f8f9fa; padding: 1rem; border-radius: 8px; margin-bottom: 2rem; }
.admin-nav { display: flex; gap: 1rem; margin-top: 2rem; padding-top: 2rem; border-top: 1px solid #eee; flex-wrap: wrap; }
.admin-nav a { padding: 0.8rem 1.5rem; background: #f8f9fa; border-radius: 8px; text-decoration: none; color: #333; }
.status { padding: 0.2rem 0.5rem; border-radius: 4px; font-size: 0.8rem; }
.status.active { background: #d4edda; color: #155724; }
.status.inactive { background: #f8d7da; color: #721c24; }
.danger-zone { margin-top: 2rem; padding-top: 2rem; border-top: 2px solid #dc3545; }
.log-filters { display: flex; gap: 1rem; margin-bottom: 1rem; }
.log-error { background: #fff5f5; }
.log-warning { background: #fffbeb; }

/* Modal */
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); justify-content: center; align-items: center; z-index: 1000; }
.modal-content { background: white; padding: 2rem; border-radius: 12px; max-width: 500px; width: 90%; }

/* Table */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.8rem; text-align: left; border-bottom: 1px solid #eee; }
th { background: #f8f9fa; font-weight: 600; }

/* Error Page */
.error-page { text-align: center; padding: 4rem 2rem; }
.error-page h1 { font-size: 3rem; margin-bottom: 1rem; }
.error-page a { color: #4361ee; }

/* Responsive */
@media (max-width: 768px) {
    header nav { flex-direction: column; align-items: flex-start; }
    .breadcrumb { order: 2; width: 100%; }
    .nav-right { order: 1; }
    main { padding: 1rem; }
    .workshop-header { flex-direction: column; }
    .share-url { flex-direction: column; }
    .share-url input { width: 100%; }
}

.guide-box {
    background: #f0f7ff;
    border-left: 4px solid #3b82f6;
    border-radius: 6px;
    padding: 1rem 1.25rem;
    margin: 1rem 0 1.5rem;
    font-size: 0.92rem;
    color: #1f2937;
}
.guide-box h3 { margin: 0 0 .5rem; font-size: 1rem; }
.guide-box p { margin: .25rem 0 .5rem; line-height: 1.6; }
.guide-box h4 { display: block; margin: .75rem 0 .25rem; font-size: .95rem; }
.guide-box ul { margin: .25rem 0 .5rem 1.2rem; padding: 0; }
.guide-box li { margin: .25rem 0; line-height: 1.6; }
.guide-box code { background: #e5edff; padding: 1px 4px; border-radius: 3px; font-size: .88em; }

.sync-msg { margin-left: .5rem; font-size: .9rem; color: #374151; }

.guide-box .guide-details { margin: .75rem 0 .5rem; padding: 0; margin-left: 1.2rem; }
.guide-box .guide-details > summary {
    cursor: pointer;
    font-weight: 600;
    font-size: .95rem;
    margin: 0 0 .25rem;
    padding: 0;
    display: list-item;
    list-style: none;
}
.guide-box .guide-details > summary::-webkit-details-marker { display: none; }
.guide-box .guide-details > summary::before {
    content: '▶';
    display: inline-block;
    width: 1em;
    margin-right: .35rem;
    font-size: .7em;
    transform: translateY(-1px);
    transition: transform .15s ease;
}
.guide-box .guide-details[open] > summary::before { transform: rotate(90deg) translateX(-1px); }
.guide-box .guide-details > ul { margin: .25rem 0 .5rem 1.2rem; padding: 0; }

.stage-item.skipped { opacity: .85; }
.stage-item.skipped label { color: #6b7280; }
.skip-tag {
    display: inline-block;
    margin-left: .35rem;
    padding: 0 .35rem;
    font-size: .72rem;
    font-weight: 600;
    color: #6b7280;
    background: #e5e7eb;
    border-radius: 4px;
    vertical-align: 1px;
}
.stage-dot.skipped {
    background: repeating-linear-gradient(45deg, #cbd5e1, #cbd5e1 2px, #e5e7eb 2px, #e5e7eb 4px);
    opacity: .9;
}
.stage-item.skipped input,
.stage-item.skipped label { pointer-events: none; cursor: not-allowed; }
.operations-form { padding: .5rem 0 1rem; }
.operations-form .form-help { margin: .25rem 0 .5rem; color: #4b5563; font-size: .92rem; }
.operations-form .operations-row { display: flex; gap: .5rem; align-items: center; }
.operations-form input[type="url"] { flex: 1; padding: .45rem .6rem; border: 1px solid #cbd5e1; border-radius: 6px; }
.operations-form .operations-current { margin-top: .5rem; font-size: .9rem; }
.operations-form .operations-current .completed-time { margin-left: .5rem; color: #6b7280; font-size: .85rem; }
.latest-stage { font-size: .92rem; color: #374151; white-space: nowrap; }

.admin-link-float { position: fixed; bottom: 1.5rem; right: 1.5rem; background: #374151; color: #e5e7eb; padding: 0.5rem 1rem; border-radius: 8px; text-decoration: none; font-size: 0.85rem; opacity: 0.7; transition: opacity 0.2s; z-index: 100; }
.admin-link-float:hover { opacity: 1; }
