:root {
    --ink: #17212b;
    --muted: #687582;
    --paper: #32312e;
    --panel: #3f2320;
    --line: #d9d1c3;
    --accent: #d95835;
    --accent-dark: #9d3527;
    --topbar: #4d1b03;
    --shadow: 0 18px 50px rgba(23, 33, 43, .12);
}
* { box-sizing: border-box; }
html { background: var(--paper); }
body { min-height: 100vh; margin: 0; color: var(--ink); font-family: Georgia, 'Times New Roman', serif; background: radial-gradient(circle at 90% 8%, rgba(217, 88, 53, .11), transparent 28rem), var(--paper); background-size: cover; }
body.has-player { background-repeat: no-repeat; background-attachment: fixed; }
a { color: inherit; }
button, input { font: inherit; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; min-height: 66px; padding: 0 24px; color: #fffdf7; background: var(--topbar); box-shadow: 0 3px 0 rgba(0, 0, 0, .12); }
.icon-button { width: 40px; height: 40px; margin-right: 18px; border: 1px solid rgba(255,255,255,.3); color: inherit; background: transparent; cursor: pointer; font-size: 22px; line-height: 1; }
.brand { display: flex; align-items: center; gap: 10px; letter-spacing: .04em; }
.brand-mark { color: #f4b267; font-weight: 700; }
.volume-control { display: flex; align-items: center; gap: 8px; margin-left: 24px; padding: 4px 10px; background: rgba(0, 0, 0, .28); border: 1px solid rgba(255, 255, 255, .15); border-radius: 4px; }
.volume-mute-btn { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; padding: 0; border: 0; background: transparent; color: inherit; font-size: 15px; cursor: pointer; border-radius: 3px; }
.volume-mute-btn:hover { background: rgba(255, 255, 255, .15); color: #f4b267; }
.volume-slider { width: 85px; height: 5px; cursor: pointer; accent-color: #f4b267; vertical-align: middle; }
.volume-label { min-width: 38px; font-family: 'Courier New', monospace; font-size: 11px; color: #f4b267; text-align: right; }
.topbar nav { display: flex; gap: 18px; margin-left: auto; font-family: 'Courier New', monospace; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.topbar nav a { text-decoration: none; opacity: .82; }
.topbar nav a:hover { opacity: 1; color: #f4b267; }
.archive-menu { position: fixed; top: 66px; left: 0; z-index: 19; display: none; width: max-content; min-width: 280px; max-width: calc(100vw - 24px); padding: 14px; color: #fffdf7; background: #203746; box-shadow: 12px 18px 30px rgba(0, 0, 0, .25); }
.archive-menu.is-open { display: block; }
.menu-heading, .section-kicker, .eyebrow { font-family: 'Courier New', monospace; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; }
.menu-heading { padding: 4px 8px 12px; color: #f4b267; }
.menu-actions { display: flex; flex-direction: column; gap: 4px; margin-top: 14px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.18); }
.menu-actions a, .menu-actions button { display: block; width: 100%; padding: 8px; border: 0; color: inherit; background: transparent; cursor: pointer; text-align: left; text-decoration: none; }
.menu-actions a:hover, .menu-actions button:hover, .menu-item:hover, .folder-toggle:hover, .menu-folder.is-open > .folder-toggle { color: #17212b; background: #f4b267; }
.menu-actions form { margin: 0; }
.menu-tree, .menu-tree ul { margin: 8px 0 0; padding: 0; list-style: none; }
.menu-tree ul { position: absolute; top: -8px; left: calc(100% - 4px); display: none; min-width: 260px; width: max-content; padding: 8px; background: #203746; box-shadow: 10px 12px 25px rgba(0, 0, 0, .3); z-index: 25; }
.menu-folder { position: relative; }
.menu-folder.is-open > ul { display: block; }
.folder-toggle, .menu-item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px; border: 0; color: inherit; background: transparent; cursor: pointer; text-align: left; }
.folder-toggle::after { margin-left: auto; content: '▶'; font-size: 10px; color: #f4b267; }
.menu-folder.is-open > .folder-toggle::after { color: #17212b; }
.menu-item img { width: 20px; height: 20px; object-fit: cover; }
.workspace { width: min(1180px, calc(100% - 48px)); margin: 0 auto; padding: 64px 0 100px; }
body.has-player .workspace { width: min(1500px, calc(100% - 32px)); padding: 20px 0 60px; }
.content-area { min-height: 75vh; padding: clamp(28px, 6vw, 82px); background: rgba(255, 253, 247, .78); border: 1px solid var(--line); box-shadow: var(--shadow); }
body.has-player .content-area { padding: 0; min-height: 86vh; background: transparent; border: none; box-shadow: none; }
ruffle-player { display: block; width: 100%; height: 86vh; min-height: 720px; max-height: 92vh; }
.workspace.is-editing .content-area { display: none; }
.content-area h1, .content-area h2 { max-width: 720px; margin: 0 0 20px; font-size: clamp(2rem, 5vw, 4.8rem); line-height: .95; }
.content-area p { max-width: 660px; color: var(--muted); font-size: 1.1rem; line-height: 1.7; }
.notice { min-height: 0; margin-bottom: 0; color: var(--accent-dark); font-family: 'Courier New', monospace; font-size: 12px; }
.notice.show { min-height: 24px; margin-bottom: 16px; }
.editor { margin-top: 64px; }
.editor.is-hidden { display: none; }
.editor h2 { margin: 8px 0 22px; font-size: 2rem; }
.editor-subdirs { display: grid; gap: 24px; }
.editor-folder { padding-left: 18px; border-left: 2px solid var(--accent); }
.folder-editor { display: flex; align-items: end; gap: 10px; margin-bottom: 14px; }
.folder-editor label { flex: 1; }
.folder-editor button { padding: 9px 12px; border: 0; color: #fff; background: var(--topbar); cursor: pointer; }
.folder-editor button:hover { background: var(--accent); }
.editor-files { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin: 0 0 22px 18px; }
.section-kicker, .eyebrow { color: var(--accent); }
.item-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.item-editor, .login-panel { display: flex; flex-direction: column; gap: 12px; padding: 18px; border: 1px solid var(--line); background: var(--panel); }
.item-editor strong { overflow: hidden; color: var(--muted); font-family: 'Courier New', monospace; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
label { display: grid; gap: 5px; color: var(--muted); font-family: 'Courier New', monospace; font-size: 11px; text-transform: uppercase; }
input { width: 100%; padding: 9px; border: 1px solid var(--line); color: var(--ink); background: #fff; }
.item-editor button, .primary { padding: 10px 14px; border: 0; color: #fff; background: var(--accent); cursor: pointer; }
.item-editor button:hover, .primary:hover { background: var(--accent-dark); }
.login-shell { display: grid; min-height: 100vh; place-items: center; padding: 24px; background: linear-gradient(135deg, #162c3a 0 48%, #f4b267 48% 49%, var(--paper) 49%); }
.login-panel { width: min(430px, 100%); padding: 36px; box-shadow: var(--shadow); }
.login-panel h1 { margin: 0; font-size: 3rem; line-height: .95; }
.login-panel p:not(.eyebrow):not(.error) { color: var(--muted); line-height: 1.5; }
.error { padding: 10px; color: #fff; background: var(--accent-dark); font-family: 'Courier New', monospace; font-size: 12px; }
@media (max-width: 700px) {
    .topbar { padding: 0 14px; }
    .volume-control { margin-left: 10px; padding: 2px 6px; }
    .volume-slider { width: 55px; }
    .topbar nav { gap: 10px; }
    .workspace { width: min(100% - 24px, 1180px); padding-top: 24px; }
    .content-area { padding: 28px 22px; }
    .archive-menu { width: min(280px, 88vw); min-width: 0; }
    .menu-tree ul { position: static; display: block; width: auto; margin-left: 12px; padding: 0; box-shadow: none; }
}
