:root {
    --accent: #ffd600;
    --accent-dark: #c7a500;
    --accent-light: #fff9c4;
    --lapis: #1a237e;
    --lapis-light: #3949ab;
    --bg: #fffde7;
    --card-bg: #ffd600;
    --header-bg: #1e1e1e;
    --text: #1e1e1e;
    --text-muted: #5d4037;
    --text-on-dark: #f5f5f5;
    --border: #e6c200;
    --card-divider: rgba(0,0,0,0.1);
}

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

body {
    font-family: -apple-system, 'SF Pro Display', 'Segoe UI', Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

a { color: var(--lapis); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header / Nav */
.site-header {
    background: var(--header-bg);
    border-bottom: 3px solid var(--accent);
    padding: 10px 16px;
    padding-top: calc(10px + env(safe-area-inset-top, 0px));
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.site-header h1 { font-size: 1.3em; }
.site-header h1 a { color: var(--accent); }
.header-links { display: flex; gap: 16px; align-items: center; }
.header-links a {
    font-size: 0.9em;
    padding: 4px 0;
    color: var(--text-on-dark);
    opacity: 0.85;
}
.header-links a:hover { opacity: 1; text-decoration: none; }

/* Search bar */
.search-form { display: flex; gap: 6px; }
.search-form input[type="text"] {
    flex: 1;
    min-width: 0;
    padding: 8px 12px;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 8px;
    font-size: 16px; /* prevent iOS zoom */
    background: rgba(255,255,255,0.1);
    color: var(--text-on-dark);
}
.search-form input[type="text"]::placeholder { color: rgba(255,255,255,0.4); }
.search-form input[type="text"]:focus {
    outline: none;
    border-color: var(--accent);
    background: rgba(255,255,255,0.15);
}
.search-form button {
    padding: 8px 16px;
    background: var(--accent);
    color: var(--text);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
    flex-shrink: 0;
}
.search-form button:hover { opacity: 0.9; }

/* Breadcrumbs */
.breadcrumbs {
    background: var(--header-bg);
    padding: 8px 16px;
    font-size: 0.85em;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.breadcrumbs a {
    color: var(--accent);
    text-decoration: none;
}
.breadcrumbs a:hover { text-decoration: underline; }
.breadcrumbs .sep {
    color: rgba(255,255,255,0.4);
    margin: 0 6px;
}
.breadcrumbs .current {
    color: var(--text-on-dark);
}

/* Main container */
.container { max-width: 1200px; margin: 0 auto; padding: 24px; }

/* Yahoo-style directory grid */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
    margin-top: 16px;
}
.category-card {
    background: var(--card-bg);
    border: none;
    border-radius: 10px;
    padding: 16px 18px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.category-card h2 {
    font-size: 1.1em;
    margin-bottom: 8px;
    border-bottom: 2px solid rgba(0,0,0,0.15);
    padding-bottom: 6px;
}
.category-card h2 a { color: var(--text); }
.category-card ul { list-style: none; padding: 0; }
.category-card li {
    padding: 4px 0;
    font-size: 0.9em;
    border-bottom: 1px solid var(--card-divider);
}
.category-card li:last-child { border-bottom: none; }
.category-card li a { color: var(--text); font-weight: 500; }
.category-card li a:hover { color: var(--lapis); }

.note-count { color: var(--text-muted); font-size: 0.8em; font-weight: normal; }
.weight-badge {
    display: inline-block;
    background: rgba(0,0,0,0.1);
    color: var(--text-muted);
    font-size: 0.7em;
    padding: 1px 6px;
    border-radius: 3px;
    margin-left: 6px;
    font-weight: normal;
}

/* Index stats */
.stats { color: var(--text-muted); font-size: 0.9em; margin-bottom: 8px; }

/* Note detail */
.note-container { max-width: 800px; margin: 0 auto; padding: 24px; }
.note-meta { color: var(--text-muted); font-size: 0.85em; margin-bottom: 16px; }
.note-meta span { margin-right: 12px; }
.note-content img { max-width: 100%; height: auto; }
.note-content audio { display: block; margin: 10px 0; }
.note-content table { border-collapse: collapse; margin: 10px 0; }
.note-content td, .note-content th { border: 1px solid #ddd; padding: 6px 10px; }
.note-content pre { background: rgba(0,0,0,0.05); padding: 12px; border-radius: 4px; overflow-x: auto; }
.note-content input[type="checkbox"] { margin-right: 6px; }

.tag-list { margin-top: 16px; display: flex; gap: 6px; flex-wrap: wrap; }
.tag {
    display: inline-block;
    background: var(--accent);
    padding: 2px 10px;
    border-radius: 3px;
    font-size: 0.8em;
    color: var(--text);
}
.tag.notebook {
    background: var(--text);
    color: var(--accent);
}

.category-list { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; }

.transcription {
    margin: 10px 0;
    background: rgba(0,0,0,0.04);
    padding: 12px;
    border-radius: 4px;
    font-size: 0.9em;
}

/* Category detail / search results */
.note-list { list-style: none; padding: 0; }
.note-list li {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.note-list .note-title { font-size: 1em; }
.note-list .note-snippet {
    font-size: 0.85em;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Pagination */
.pagination { margin-top: 20px; display: flex; gap: 8px; }
.pagination a, .pagination span {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
}
.pagination .current {
    background: var(--text);
    color: var(--accent);
    border-color: var(--text);
    font-weight: 600;
}

/* Audio badge */
.audio-badge { font-size: 0.8em; }

/* Schedule */
.schedule-tabs {
    display: flex;
    gap: 6px;
    margin: 16px 0;
    flex-wrap: wrap;
}
.schedule-tab {
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: 600;
    color: var(--text);
}
.schedule-tab:hover { text-decoration: none; background: var(--accent-light); }
.schedule-tab.active {
    background: var(--text);
    color: var(--accent);
    border-color: var(--text);
}
.schedule-list { margin-top: 8px; }
.schedule-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-left: 4px solid var(--border);
    margin-bottom: 4px;
    border-radius: 0 6px 6px 0;
    color: var(--text);
    background: #fff;
}
.schedule-item:hover { text-decoration: none; background: var(--accent-light); }
.schedule-item.kind-workshop { border-left-color: #1565c0; }
.schedule-item.kind-blocked  { border-left-color: #c62828; }
.schedule-item.kind-proposal { border-left-color: #f9a825; }
.schedule-item.kind-todo     { border-left-color: #2e7d32; }
.schedule-item.past { opacity: 0.5; }
.schedule-kind-badge {
    font-size: 0.7em;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 3px;
    background: rgba(0,0,0,0.08);
    color: var(--text-muted);
    flex-shrink: 0;
}
.schedule-title { font-weight: 600; }
.schedule-date { font-size: 0.85em; color: var(--text-muted); }
.schedule-venue { font-size: 0.8em; color: var(--lapis); }
.schedule-label {
    display: inline-block;
    font-size: 0.75em;
    padding: 1px 8px;
    border-radius: 3px;
    background: var(--accent);
    color: var(--text);
}
.schedule-section-heading {
    margin-top: 20px;
    margin-bottom: 4px;
    font-size: 0.95em;
    color: var(--text-muted);
}
.schedule-empty { color: var(--text-muted); margin-top: 16px; }
.schedule-detail-header {
    border-left: 4px solid var(--border);
    padding-left: 12px;
    margin-bottom: 12px;
}
.schedule-detail-header.kind-workshop { border-left-color: #1565c0; }
.schedule-detail-header.kind-blocked  { border-left-color: #c62828; }
.schedule-detail-header.kind-proposal { border-left-color: #f9a825; }
.schedule-detail-header.kind-todo     { border-left-color: #2e7d32; }
.schedule-detail-header h2 { margin-top: 4px; }
.schedule-description {
    margin-top: 16px;
    line-height: 1.7;
}
.schedule-notes {
    margin-top: 16px;
    background: rgba(0,0,0,0.04);
    padding: 12px;
    border-radius: 4px;
    font-size: 0.9em;
}

/* Mobile */
@media (max-width: 480px) {
    .container { padding: 16px; }
    .note-container { padding: 16px; }
    .category-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .note-meta span { display: block; margin-bottom: 2px; }
}

/* Standalone PWA — hide browser chrome padding */
@media (display-mode: standalone) {
    .site-header {
        padding-top: calc(12px + env(safe-area-inset-top, 0px));
    }
}
