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

:root {
    --accent: #2196F3;
    --accent-dark: #1976D2;
    --accent-soft: #e3f2fd;
    --header-from: #667eea;
    --header-to: #764ba2;
}

body.page-capture {
    --accent: #0d9488;
    --accent-dark: #0f766e;
    --accent-soft: #ccfbf1;
    --header-from: #0d9488;
    --header-to: #115e59;
}

body.page-organize {
    --accent: #d97706;
    --accent-dark: #b45309;
    --accent-soft: #fef3c7;
    --header-from: #d97706;
    --header-to: #92400e;
}

body.page-distill {
    --accent: #4f46e5;
    --accent-dark: #3730a3;
    --accent-soft: #e0e7ff;
    --header-from: #4f46e5;
    --header-to: #312e81;
}

body.page-express {
    --accent: #e11d48;
    --accent-dark: #be123c;
    --accent-soft: #ffe4e6;
    --header-from: #e11d48;
    --header-to: #9f1239;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.container {
    display: flex;
    min-height: 100vh;
    max-width: 1920px;
    margin: 0 auto;
    background: white;
}

.sidebar {
    width: 270px;
    flex-shrink: 0;
    border-right: 1px solid #ddd;
    overflow-y: auto;
    padding: 20px 0;
    background: #fafafa;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar h2 {
    padding: 0 20px 15px;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    color: #666;
    letter-spacing: 0.5px;
}

.sidebar-section {
    margin-bottom: 24px;
}

.sidebar-section h3 {
    padding: 0 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #999;
    margin: 8px 0 8px;
}

.stage-list {
    list-style: none;
}

.stage-list li {
    margin: 0;
}

.stage-list a {
    display: block;
    padding: 11px 20px;
    color: #333;
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: all 0.2s;
    font-size: 14px;
}

.stage-list a:hover {
    background: #e8e8e8;
    border-left-color: #4CAF50;
}

.stage-list a.active {
    background: var(--accent-soft);
    border-left-color: var(--accent);
    color: var(--accent-dark);
    font-weight: 600;
}

.stage-list a.active-parent {
    border-left-color: var(--accent);
    font-weight: 600;
}

.sub-list {
    list-style: none;
    margin: 0 0 8px;
}

.sub-list[hidden] {
    display: none;
}

.sub-list a {
    padding: 7px 16px 7px 36px;
    font-size: 13px;
    color: #555;
}

.sub-list .has-children .stage-row > a {
    padding: 7px 12px 7px 8px;
    font-size: 13px;
}

.sub-list .sub-list a {
    padding-left: 52px;
    font-size: 12px;
}

.sub-list .sub-list .sub-list a {
    padding-left: 68px;
}

.stage-row {
    display: flex;
    align-items: stretch;
}

.stage-toggle {
    flex: 0 0 32px;
    border: 0;
    background: transparent;
    color: #666;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0;
}

.stage-toggle:hover {
    background: #e8e8e8;
    color: #111;
}

.stage-row > a {
    flex: 1;
    min-width: 0;
    padding-left: 8px;
}

.has-children.is-open > .stage-row > a {
    font-weight: 600;
}

.legacy-section h3 {
    color: #c87f0a;
}

.legacy-section a {
    color: #d68910;
}

.legacy-section a.active {
    background: #fdebd0 !important;
    border-left-color: #f39c12 !important;
    color: #c87f0a !important;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.header {
    padding: 28px 32px;
    border-bottom: 1px solid #ddd;
    background: linear-gradient(135deg, var(--header-from) 0%, var(--header-to) 100%);
    color: white;
}

.header .kicker {
    font-size: 12px;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    opacity: 0.85;
    margin-bottom: 6px;
    font-weight: 600;
}

.header h1 {
    margin-bottom: 6px;
    font-size: 28px;
}

.header p {
    opacity: 0.92;
    font-size: 14px;
    max-width: 720px;
}

.page-body {
    flex: 1;
    overflow: auto;
    padding: 32px;
}

.diagram-info {
    margin-bottom: 24px;
}

.diagram-info h2 {
    font-size: 24px;
    margin-bottom: 6px;
}

.diagram-info p {
    color: #666;
    font-size: 15px;
    max-width: 760px;
}

.flow {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin: 8px 0 28px;
}

.flow-card {
    display: block;
    text-decoration: none;
    color: inherit;
    border: 1px solid #e5e5e5;
    border-radius: 10px;
    padding: 18px 16px;
    background: #fff;
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}

.flow-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
    border-color: #ccc;
}

.flow-card .step {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.flow-card h3 {
    font-size: 18px;
    margin-bottom: 6px;
}

.flow-card p {
    font-size: 13px;
    color: #666;
}

.flow-card.capture .step { color: #0d9488; }
.flow-card.organize .step { color: #d97706; }
.flow-card.distill .step { color: #4f46e5; }
.flow-card.express .step { color: #e11d48; }

.flow-5 {
    grid-template-columns: repeat(5, 1fr);
}

.flow-2 {
    grid-template-columns: repeat(2, 1fr);
}

.flow-3 {
    grid-template-columns: repeat(3, 1fr);
}

.panel-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 8px 0 28px;
}

.collapse-panel {
    border: 1px solid #e5e5e5;
    border-radius: 10px;
    background: #fff;
    overflow: hidden;
}

.collapse-panel > summary {
    cursor: pointer;
    padding: 14px 18px;
    font-weight: 700;
    font-size: 15px;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: #fafafa;
    border-bottom: 1px solid transparent;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex: 1;
    min-width: 0;
    padding-right: 4px;
}

.panel-id {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    background: var(--accent-soft);
    color: var(--accent-dark);
    padding: 3px 8px;
    border-radius: 999px;
    white-space: nowrap;
}

.panel-id-inline {
    font-size: 11px;
    vertical-align: middle;
}

.panel-id-copyable {
    cursor: pointer;
}

.panel-id-copyable:hover {
    filter: brightness(0.95);
}

.panel-id-copied {
    background: #d7f5df;
    color: #1c6b34;
}

.panel-id-copy-failed {
    background: #fbe3e3;
    color: #9c2f2f;
}

.collapse-panel[open] > summary {
    border-bottom-color: #eee;
}

.collapse-panel > summary::-webkit-details-marker {
    display: none;
}

.collapse-panel > summary::after {
    content: "▾";
    color: #888;
    font-size: 12px;
}

.collapse-panel:not([open]) > summary::after {
    content: "▸";
}

.collapse-body {
    padding: 16px 18px 20px;
}

.check-title {
    font-weight: 700;
    margin: 0 0 12px;
    color: #222;
}

.check-group {
    margin: 0 0 16px;
}

.check-group h3 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.45px;
    color: #888;
    margin: 0 0 8px;
}

.check-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 9px 12px;
    margin: 5px 0;
    background: #f8f9fa;
    border: 1px solid #eee;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.check-item:hover {
    border-color: var(--accent);
}

.check-item input {
    margin-top: 3px;
    flex-shrink: 0;
    accent-color: var(--accent);
    width: 16px;
    height: 16px;
}

.check-item.is-done {
    background: var(--accent-soft);
}

.check-item.is-done span {
    text-decoration: line-through;
    color: #666;
}

.check-gate {
    margin: 8px 0 16px;
    padding: 14px;
    border: 2px solid var(--accent);
    border-radius: 10px;
    background: var(--accent-soft);
}

.gate-q {
    font-weight: 700;
    font-size: 16px;
    color: var(--accent-dark);
}

.gate-hint {
    font-size: 13px;
    color: #555;
    margin: 4px 0 10px;
}

.check-item-gate {
    background: #fff;
}

.export-list {
    margin: 0 0 0 18px;
    font-size: 14px;
    color: #444;
}

.export-list li {
    margin: 4px 0;
}

.check-progress {
    font-size: 13px;
    color: #666;
    font-weight: 600;
}

.process-image-wrap {
    position: relative;
    display: block;
    width: 100%;
    padding: 0;
    border: none;
    background: none;
    cursor: zoom-in;
}

.process-image {
    width: 100%;
    height: auto;
    display: block;
    background: #fffef5;
    border: 1px solid #eee;
    border-radius: 8px;
}

.zoom-hint {
    position: absolute;
    right: 10px;
    bottom: 10px;
    background: rgba(31, 41, 55, 0.78);
    color: #fff;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
}

.mermaid-panel {
    margin: 16px 0 8px;
    padding: 12px 14px 14px;
    border: 1px solid #eee;
    border-radius: 10px;
    background: #fffef5;
}

.mermaid-panel p {
    font-size: 13px;
    color: #555;
    margin: 0 0 10px;
}

.mermaid-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.mermaid-panel .mermaid {
    background: #fff;
    border: 1px dashed #ddd;
    border-radius: 8px;
    padding: 8px;
    overflow-x: auto;
}

.mermaid-source-fold {
    margin-top: 10px;
}

.mermaid-source-fold summary {
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: #555;
}

.mermaid-source {
    margin: 10px 0 0;
    padding: 10px 12px;
    background: #111827;
    color: #e5e7eb;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.45;
    overflow-x: auto;
    white-space: pre-wrap;
}

.process-fields {
    display: grid;
    gap: 12px;
    margin-top: 16px;
}

.process-field {
    display: block;
    font-weight: 600;
    font-size: 14px;
    color: #333;
}

.process-field textarea {
    display: block;
    width: 100%;
    min-height: 88px;
    margin-top: 6px;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font: inherit;
    font-weight: 400;
    resize: vertical;
    background: #fff;
}

.process-field-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.image-modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-modal[hidden] {
    display: none;
}

.image-modal-backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    padding: 0;
    background: rgba(15, 23, 42, 0.72);
    cursor: zoom-out;
}

.image-modal-dialog {
    position: relative;
    z-index: 1;
    max-width: min(1100px, 94vw);
    max-height: 92vh;
    overflow: auto;
    background: #fffef5;
    border-radius: 12px;
    padding: 18px 18px 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.28);
}

.image-modal-dialog img {
    width: 100%;
    height: auto;
    display: block;
}

.image-modal-close {
    position: absolute;
    top: 8px;
    right: 10px;
    border: 0;
    background: #1f2937;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 16px;
    cursor: pointer;
    font-size: 16px;
}

.process-steps {
    margin: 14px 0 0 18px;
    color: #444;
}

.process-steps li {
    margin: 6px 0;
}

.tool-links {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

.tool-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid #eee;
    border-radius: 8px;
    text-decoration: none;
    color: var(--accent-dark);
    background: var(--accent-soft);
    font-weight: 600;
}

.tool-link:hover {
    border-color: var(--accent);
}

.tool-emoji {
    font-size: 18px;
}

.tool-label {
    flex: 1;
}

.tool-go {
    opacity: 0.55;
}

.excalidraw-panel {
    margin: 8px 0 28px;
}

.excalidraw-wrap {
    border: 1px solid #e5e5e5;
    border-radius: 10px;
    background: #fffef5;
    overflow: auto;
    min-height: 260px;
    margin-top: 12px;
}

.excalidraw-wrap svg {
    display: block;
    width: 100%;
    height: auto;
}

.excalidraw-editor {
    width: 100%;
    height: calc(100vh - 72px);
    border: 0;
    background: #fffef5;
}

.editor-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid #ddd;
    background: #fafafa;
}

.editor-bar h1 {
    font-size: 16px;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 20px 0;
}

.panel {
    background: #fafafa;
    border: 1px solid #eee;
    border-radius: 10px;
    padding: 18px 20px;
}

.panel h3 {
    font-size: 15px;
    margin-bottom: 10px;
}

.panel ul,
.checklist {
    margin-left: 18px;
}

.panel li,
.checklist li {
    margin: 6px 0;
    font-size: 14px;
    color: #444;
}

.panel a,
.page-body a.inline {
    color: var(--accent-dark);
}

.tools {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0 24px;
}

.tool {
    background: var(--accent-soft);
    color: var(--accent-dark);
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
}

.section-block {
    margin: 28px 0;
}

.section-block h2 {
    font-size: 20px;
    margin-bottom: 8px;
}

.section-block > p {
    color: #666;
    margin-bottom: 12px;
}

.map-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    margin: 12px 0 24px;
}

.map-table th,
.map-table td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
}

.map-table th {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #888;
    font-weight: 600;
}

.diagram-actions {
    display: flex;
    gap: 10px;
    margin: 20px 0 8px;
    flex-wrap: wrap;
}

.btn {
    padding: 10px 20px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    display: inline-block;
    transition: background 0.2s;
}

.btn:hover {
    background: var(--accent-dark);
}

.btn-secondary {
    background: #666;
}

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

.btn-upload {
    background: #0f766e;
}

.btn-upload:hover {
    background: #115e59;
}

.upload-status {
    font-size: 13px;
    min-height: 1.2em;
    margin: 4px 0 8px;
    color: #666;
}

.upload-status.ok {
    color: #0f766e;
}

.upload-status.warn {
    color: #b45309;
}

.upload-status.err {
    color: #be123c;
}

.status {
    padding: 16px 32px;
    background: #f0f9ff;
    border-top: 1px solid #ddd;
    font-size: 13px;
    color: #0066cc;
}

.site-footer {
    padding: 14px 32px 18px;
    border-top: 1px solid #ddd;
    background: #1f2937;
    color: #e5e7eb;
    font-size: 13px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.site-footer a {
    color: #93c5fd;
    text-decoration: none;
    font-weight: 600;
}

.site-footer a:hover {
    text-decoration: underline;
}

.footer-sep {
    opacity: 0.5;
}

.footer-live {
    overflow-wrap: anywhere;
}

.media-ref {
    margin: 0 0 24px;
    padding: 14px 16px;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    font-size: 14px;
    color: #444;
    max-width: 860px;
}

.media-ref code {
    font-size: 12px;
    background: #eef2ff;
    padding: 1px 6px;
    border-radius: 4px;
}

.clip-list {
    display: grid;
    gap: 20px;
    margin: 12px 0 36px;
}

.clip-card {
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    padding: 16px;
    background: #fff;
}

.clip-card h3 {
    font-size: 16px;
    margin-bottom: 6px;
}

.clip-card .clip-meta {
    font-size: 13px;
    color: #666;
    margin-bottom: 10px;
}

.clip-card video {
    display: block;
    width: 100%;
    max-width: 960px;
    border-radius: 8px;
    background: #111;
}

.clip-card .ref-path,
.shot-card .ref-path {
    display: block;
    margin: 0;
    font-size: 12px;
    color: #334155;
    word-break: break-all;
    flex: 1;
}

.copy-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}

.copy-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.copy-btn {
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: var(--accent-dark);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.copy-btn:hover {
    background: var(--accent-soft);
}

.copy-btn.is-copied {
    background: var(--accent-dark);
    color: white;
    border-color: var(--accent-dark);
}

.copy-btn.danger {
    color: #9f1239;
    border-color: #fecdd3;
    background: #fff1f2;
}

.copy-btn.danger:hover {
    background: #ffe4e6;
}

.clip-shots {
    margin-top: 14px;
}

.clip-shots h4 {
    font-size: 13px;
    margin-bottom: 8px;
    color: #555;
}

.shot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
    margin: 12px 0 24px;
}

.clip-shots .shot-grid {
    margin: 0;
}

.shot-card {
    border: 1px solid #e5e5e5;
    border-radius: 10px;
    padding: 8px;
    background: #fff;
}

.shot-card img {
    display: block;
    width: 100%;
    border-radius: 6px;
    background: #f3f4f6;
}

.shot-card .shot-time {
    font-size: 12px;
    font-weight: 700;
    margin: 8px 4px 0;
    color: var(--accent-dark);
}

.media-note {
    display: block;
    width: 100%;
    margin-top: 8px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font: inherit;
    font-size: 13px;
    min-height: 64px;
    resize: vertical;
}

.shot-card .media-note {
    min-height: 56px;
    font-size: 12px;
}

.bulk-notes {
    margin: 8px 0 28px;
    padding: 16px;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    background: #fff;
}

.bulk-notes h2 {
    font-size: 20px;
    margin-bottom: 6px;
}

.bulk-notes p {
    color: #666;
    font-size: 14px;
    margin-bottom: 10px;
}

.bulk-notes textarea {
    display: block;
    width: 100%;
    min-height: 220px;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    line-height: 1.45;
}

.bulk-notes .copy-row {
    margin-top: 12px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.pager {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.pager a {
    text-decoration: none;
    color: var(--accent-dark);
    font-size: 14px;
    font-weight: 600;
}

.pager .muted {
    color: #999;
    font-weight: 400;
}

.legacy-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 20px 0;
}

.legacy-card {
    background: #fef5e7;
    border: 2px dashed #f39c12;
    border-radius: 6px;
    padding: 15px;
    font-size: 13px;
}

.legacy-card h4 {
    color: #c87f0a;
    margin-bottom: 8px;
    font-size: 14px;
}

.legacy-card ul {
    margin-left: 15px;
    list-style-type: disc;
}

.legacy-card li {
    margin: 4px 0;
    color: #7d5f3f;
}

.legacy-card a {
    color: #d68910;
    text-decoration: none;
}

.legacy-card a:hover {
    text-decoration: underline;
}

.merge-info {
    background: #e8f8f5;
    border-left: 4px solid #1abc9c;
    padding: 15px;
    border-radius: 4px;
    margin: 15px 0;
    font-size: 13px;
    color: #0e6251;
}

.menu-toggle {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 20;
    background: #222;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 14px;
}

@media (max-width: 900px) {
    .menu-toggle {
        display: block;
    }

    .container {
        display: block;
    }

    .sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        z-index: 15;
        height: 100vh;
        transition: left 0.2s;
        box-shadow: 4px 0 16px rgba(0, 0, 0, 0.12);
    }

    .sidebar.open {
        left: 0;
    }

    .site-footer {
        padding: 14px 20px 18px;
    }

    .header {
        padding: 48px 20px 24px;
    }

    .page-body {
        padding: 20px;
    }

    .flow,
    .flow-5,
    .flow-2,
    .flow-3,
    .grid-2,
    .legacy-content,
    .tool-links {
        grid-template-columns: 1fr;
    }

    .quest-card {
        grid-template-columns: 1fr;
    }
}

.quest-hud {
    margin: 0 0 22px;
    padding: 16px 18px;
    border: 1px solid #fecdd3;
    border-radius: 14px;
    background: linear-gradient(135deg, #fff1f2, #fff);
    max-width: 860px;
}

.quest-level {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 12px;
}

.quest-level-emoji {
    font-size: 32px;
    animation: quest-bob 1.6s ease-in-out infinite;
}

.quest-level p {
    color: #666;
    font-size: 14px;
}

.quest-bar {
    position: relative;
    height: 18px;
    border-radius: 999px;
    background: #ffe4e6;
    overflow: hidden;
    margin-bottom: 14px;
}

.quest-bar-fill {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #fb7185, #e11d48);
    border-radius: 999px;
    transition: width 0.45s ease;
}

.quest-bar-label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 800;
    color: #9f1239;
}

.quest-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.quest-filter {
    border: 1px solid #fecdd3;
    background: #fff;
    color: #9f1239;
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.quest-filter.is-on,
.quest-filter:hover {
    background: #e11d48;
    border-color: #e11d48;
    color: #fff;
}

.quest-list {
    display: grid;
    gap: 16px;
    max-width: 860px;
}

.quest-card {
    position: relative;
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 14px;
    border: 1px solid #e5e5e5;
    border-radius: 14px;
    padding: 12px;
    background: #fff;
    overflow: visible;
    animation: quest-in 0.45s ease both;
    animation-delay: calc(var(--i, 0) * 55ms);
}

.quest-card:hover,
.quest-card:focus-within {
    z-index: 6;
}

.quest-card.is-pop {
    animation: quest-pop 0.42s ease;
}

.quest-card.is-static {
    animation: none;
}

.quest-card.is-dragging {
    opacity: 0.45;
}

.quest-card.is-drop-before {
    box-shadow: 0 -4px 0 #e11d48;
}

.quest-card.is-drop-after {
    box-shadow: 0 4px 0 #e11d48;
}

.quest-handle {
    position: absolute;
    left: 8px;
    top: 8px;
    z-index: 3;
    width: 28px;
    height: 28px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.92);
    color: #64748b;
    font-size: 14px;
    line-height: 1;
    letter-spacing: -2px;
    cursor: grab;
}

.quest-handle:active {
    cursor: grabbing;
}

.quest-move {
    border: 1px solid #e5e7eb;
    background: #f8fafc;
    border-radius: 8px;
    padding: 6px 8px;
    font-size: 13px;
    cursor: pointer;
}

.quest-move:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.quest-hint {
    margin-top: 12px;
    font-size: 13px;
    color: #64748b;
    font-weight: 600;
}

.quest-card.is-done {
    background: #f8fafc;
    border-color: #bbf7d0;
}

.quest-card.is-done h3,
.quest-card.is-done p {
    text-decoration: line-through;
    color: #64748b;
}

.quest-stamp {
    position: absolute;
    top: 14px;
    right: 12px;
    transform: rotate(12deg) scale(0.6);
    opacity: 0;
    border: 3px solid #16a34a;
    color: #16a34a;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 1px;
    padding: 2px 8px;
    border-radius: 6px;
    pointer-events: none;
}

.quest-card.is-done .quest-stamp {
    opacity: 1;
    transform: rotate(12deg) scale(1);
    transition: transform 0.35s ease, opacity 0.35s ease;
}

.quest-thumb {
    position: relative;
    z-index: 1;
}

.quest-thumb img {
    display: block;
    width: 100%;
    border-radius: 10px;
    background: #111;
    cursor: zoom-in;
}

.quest-zoom {
    position: fixed;
    z-index: 80;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 22px 60px rgba(15, 23, 42, 0.45);
    border: 2px solid #fff;
    transform: scale(0.96);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
}

.quest-zoom.is-on {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

.quest-zoom img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #111;
}

.quest-emoji {
    position: absolute;
    left: 8px;
    bottom: 8px;
    font-size: 22px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.35));
    animation: quest-wiggle 2.4s ease-in-out infinite;
}

.quest-body h3 {
    font-size: 18px;
    margin: 4px 0 6px;
    padding-right: 84px;
}

.quest-body p {
    font-size: 14px;
    color: #444;
    margin-bottom: 8px;
}

.quest-meta {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 12px;
    font-weight: 700;
}

.quest-kind {
    color: var(--accent-dark);
}

.quest-xp {
    color: #ca8a04;
}

.quest-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.quest-clear,
.quest-jump {
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}

.quest-clear {
    border: 0;
    background: #e11d48;
    color: #fff;
    cursor: pointer;
}

.quest-card.is-done .quest-clear {
    background: #334155;
}

.quest-jump {
    border: 1px solid #e5e7eb;
    color: var(--accent-dark);
    background: #f8fafc;
}

.quest-empty,
.quest-win {
    max-width: 860px;
    padding: 18px;
    border-radius: 12px;
    font-weight: 700;
}

.quest-empty {
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    color: #475569;
}

.quest-win {
    background: #ecfdf5;
    border: 1px solid #86efac;
    color: #166534;
    margin-bottom: 16px;
    animation: quest-in 0.4s ease;
}

.quest-reset-row {
    margin: 18px 0 0;
}

.quest-link {
    display: flex;
    gap: 14px;
    align-items: center;
    max-width: 860px;
    margin: 0 0 22px;
    padding: 14px 16px;
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    background: linear-gradient(90deg, #fff1f2, #fff);
    border: 1px solid #fecdd3;
}

.quest-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(225, 29, 72, 0.12);
}

.quest-link-emoji {
    font-size: 28px;
    animation: quest-wiggle 2s ease-in-out infinite;
}

.quest-link h2 {
    font-size: 18px;
    margin-bottom: 2px;
}

.quest-link p {
    font-size: 13px;
    color: #666;
}

#quest-burst {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 40;
}

.quest-spark {
    position: fixed;
    font-size: 18px;
    animation: quest-spark 0.9s ease-out forwards;
}

.quest-spark-big {
    font-size: 24px;
    animation-duration: 1.3s;
}

@keyframes quest-in {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes quest-pop {
    0% { transform: scale(1); }
    40% { transform: scale(1.03) rotate(-0.4deg); }
    100% { transform: scale(1); }
}

@keyframes quest-bob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

@keyframes quest-wiggle {
    0%, 100% { transform: rotate(-8deg); }
    50% { transform: rotate(8deg); }
}

@keyframes quest-spark {
    0% { opacity: 1; transform: translate(0, 0) scale(1); }
    100% { opacity: 0; transform: translate(var(--dx), 80px) scale(0.4); }
}

@media (prefers-reduced-motion: reduce) {
    .quest-card,
    .quest-level-emoji,
    .quest-emoji,
    .quest-link-emoji,
    .quest-spark,
    .quest-win {
        animation: none;
    }

    .quest-zoom {
        transition: none;
    }
}
