/* OrkestrAI's ink rules, square edges and offset shadows, kept; the colours are the game's own, taken from the
   traveller's picture: boot-brown ink, the cream of the bubbles, the teal of the coat for title bars, the
   pom-pom's gold for what is switched on and the scarf's red for where you are. So the panes read as paper
   objects lying on the painting instead of a cold toolbar over it.
   This theme is scoped to outer controls and panes. The game stage, bubbles, narration and HUD keep their
   original styling and palette. */
:where(.dock, .top-actions, .drawer, #community-rail, #panel-board, #auth-dialog, #floated) { --ink:#2e231c; --paper:#f4ead3; --panel:#e6d9bb; --card:#fbf4e2; --rule:#b3a284; --blue:#3a6462; --blue-dark:#2c5250; --soft:#6a5b4d; --gold:#e3b55a; --red:#a9412b; --glow:#76602e; --line:#2e231c; --glass:#f4ead3; --shade:rgba(38,27,20,.82); }
:where(.drawer, #panel-board, #auth-dialog, #floated) { font-size:16px; }
:where(.dock, .top-actions, .drawer, #panel-board, #auth-dialog, #floated) :is(button, .button, input, select, textarea) { border-radius:0; }
:where(.dock, .top-actions, .drawer, #panel-board, #auth-dialog, #floated) :is(button, .button) { border:2px solid var(--ink); background:var(--paper); color:var(--ink); box-shadow:2px 2px 0 var(--shade); transition:translate .06s, box-shadow .06s, background .12s; }
:where(.dock, .top-actions, .drawer, #panel-board, #auth-dialog, #floated) :is(button, .button):hover { background:#fffaf0; }
:where(.dock, .top-actions, .drawer, #panel-board, #auth-dialog, #floated) button:active { box-shadow:none; translate:2px 2px; }
:where(.dock, .top-actions, .drawer, #panel-board, #auth-dialog, #floated) button.quiet { color:var(--ink); border:2px solid var(--ink); background:transparent; }
:where(.dock, .top-actions, .drawer, #panel-board, #auth-dialog, #floated) button:disabled { background:var(--panel); color:#8a7c6c; box-shadow:none; border-color:var(--rule); }
:where(.dock, .top-actions, .drawer, #panel-board, #auth-dialog, #floated) :is(button,a,input,select,textarea,summary):focus-visible { outline:3px solid var(--red); outline-offset:2px; }
:where(.dock, .top-actions, .drawer, #panel-board, #auth-dialog, #floated) .small { color:var(--soft); }
:where(.dock, .top-actions, .drawer, #panel-board, #auth-dialog, #floated) .glow { color:var(--blue-dark); }

.dock button { border-radius:0; border:2px solid var(--ink); background:var(--paper); color:var(--ink); opacity:.94; backdrop-filter:none; box-shadow:3px 3px 0 var(--shade); }
.dock button:hover { opacity:1; }
.dock button[aria-expanded=true] { background:var(--gold); color:var(--ink); opacity:1; box-shadow:1px 1px 0 var(--shade); translate:2px 2px; }
.top-actions { max-width:calc(100vw - 460px); }
.top-actions #float { padding:7px 14px; background:var(--paper); color:var(--ink); border:2px solid var(--ink); font:700 12px/1.45 "Courier New",monospace; backdrop-filter:none; box-shadow:3px 3px 0 var(--shade); opacity:.94; }
.top-actions #float:hover { opacity:1; }
#community-status { color:var(--soft); background:var(--paper); border:1px solid var(--rule); border-radius:0; font:11px/1.4 "Courier New",monospace; padding:3px 10px; width:max-content; max-width:100%; opacity:.9; }

.drawer { top:110px; color:var(--ink); background:var(--paper); border:2px solid var(--ink); border-radius:0; backdrop-filter:none; box-shadow:6px 6px 0 var(--shade); max-height:calc(100dvh - 132px); animation:pane-in .14s steps(3) both;
 background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .25 0 0 0 0 .15 0 0 0 .11 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E"); scrollbar-color:var(--rule) transparent; scrollbar-width:thin; }
@keyframes pane-in { from { opacity:0; translate:-4px -4px; } }
@media (prefers-reduced-motion: reduce) { .drawer { animation:none; } }
.drawer .scroll { scrollbar-color:var(--rule) transparent; scrollbar-width:thin; }
.drawer.left { top:calc(max(10px,env(safe-area-inset-top)) + 48px); max-height:calc(100dvh - max(10px,env(safe-area-inset-top)) - 62px); width:min(350px,calc(100vw - 28px)); }
.community-drawer { width:min(340px,calc(100vw - 28px)); font-size:14px; }
.drawer.community-drawer header { padding:6px 8px; }
.drawer.community-drawer h2 { font-size:12px; letter-spacing:.05em; }
.drawer.community-drawer .scroll { padding:0 12px 12px; }
.community-drawer :is(button,input,textarea) { font-size:14px; }
.drawer header { padding:8px 10px; margin-bottom:14px; border-bottom:2px solid var(--ink); gap:10px;
 background:var(--blue) repeating-linear-gradient(to bottom, transparent 0 3px, rgba(20,40,38,.28) 3px 4px); }
.drawer h2 { color:#fff6df; background:var(--blue); padding:0 8px; margin-left:-2px; font:700 13px/1.5 "Courier New",monospace; letter-spacing:.08em; }
.drawer .close { display:grid; place-items:center; width:24px; height:24px; padding:0; background:var(--paper); color:var(--ink); border:2px solid var(--ink); font:700 18px/1 "Courier New",monospace; box-shadow:1px 1px 0 var(--ink); flex-shrink:0; }
.drawer .close:hover { background:var(--gold); }
.drawer .scroll { padding:0 16px 18px; }
.drawer .small { line-height:1.55; }
.drawer .line { align-items:start; font-size:14px; }
.drawer input[type=checkbox] { appearance:none; flex-shrink:0; width:18px; height:18px; margin:2px 0 0; border:2px solid var(--ink); background:var(--card); display:grid; place-items:center; cursor:pointer; }
.drawer input[type=checkbox]:checked { background:var(--gold); }
.drawer input[type=checkbox]:checked::after { content:""; width:9px; height:5px; border:solid var(--ink); border-width:0 0 3px 3px; rotate:-45deg; translate:0 -1px; }
.drawer input[type=checkbox]:disabled { border-color:var(--rule); background:var(--panel); cursor:default; }
.drawer input[type=range] { appearance:none; height:6px; background:var(--panel); border:2px solid var(--ink); accent-color:var(--blue); }
.drawer input[type=range]::-webkit-slider-thumb { appearance:none; width:14px; height:20px; background:var(--gold); border:2px solid var(--ink); box-shadow:2px 2px 0 var(--shade); cursor:grab; }
.drawer input[type=range]::-moz-range-thumb { width:10px; height:16px; border-radius:0; background:var(--gold); border:2px solid var(--ink); box-shadow:2px 2px 0 var(--shade); cursor:grab; }
#chapter-list { gap:6px; margin-bottom:18px; }
#chapter-list a { padding:9px 8px; border:1px solid var(--rule); border-left:4px solid var(--rule); border-radius:0; color:var(--ink); background:var(--card); transition:background .12s, border-color .12s; }
#chapter-list a:hover { background:#fffaf0; border-color:var(--ink); }
#chapter-list a[aria-current] { background:#f3dfae; border:2px solid var(--ink); border-left:6px solid var(--red); box-shadow:2px 2px 0 var(--shade); }
#chapter-list :is(.n,.m) { color:var(--blue-dark); font-family:"Courier New",monospace; }
#chapter-list .done .n { color:var(--blue-dark); }

:where(.drawer, #panel-board, #auth-dialog) :is(select, textarea, .stack-form input) { background:var(--card); color:var(--ink); border:2px solid var(--ink); border-radius:0; font-size:16px; }
:where(.drawer, #panel-board, #auth-dialog) :is(select, textarea, .stack-form input):focus { background:#fffdf6; }
:where(.drawer, #panel-board, #auth-dialog) ::placeholder { color:#93846f; }
:where(.drawer, #panel-board, #auth-dialog) select { appearance:none; padding-right:28px; background-image:linear-gradient(45deg,transparent 50%,var(--ink) 50%),linear-gradient(135deg,var(--ink) 50%,transparent 50%); background-position:calc(100% - 14px) 50%,calc(100% - 9px) 50%; background-size:5px 5px; background-repeat:no-repeat; }
.stack-form label { color:var(--ink); font-size:14px; font-weight:600; }
.stack-form input { box-shadow:inset 2px 2px 0 rgba(46,35,28,.12); }
.community-toolbar { gap:10px; padding-bottom:14px; border-bottom:1px dashed var(--rule); }
.community-toolbar label { color:var(--soft); font:12px/1.4 "Courier New",monospace; }
.community-toolbar select { font:14px/1.4 "Courier New",monospace; }
.community-card { border:1px solid var(--ink); border-left:4px solid var(--blue); border-radius:0; background:var(--card); padding:14px; box-shadow:2px 2px 0 rgba(38,27,20,.25); }
.community-card h3 { font:700 18px/1.3 Georgia,serif; color:var(--ink); }
.community-card p { color:var(--ink); font-size:14px; }
.card-meta { color:var(--soft); font:12px/1.4 "Courier New",monospace; }
.kind-label { color:var(--blue-dark); font-weight:bold; }
.community-card details { border-color:var(--rule); }
.community-card summary { color:var(--blue-dark); font-size:14px; }
.canonical { color:var(--blue-dark); border-left:3px solid var(--blue); background:#dfe6d6; }
.vote { border:2px solid var(--ink); background:var(--panel); color:var(--ink); }
.vote[aria-pressed=true] { color:var(--ink); background:var(--gold); }
.moment-link { color:var(--blue-dark); border:0; box-shadow:none; background:none; font:12px/1.5 "Courier New",monospace; text-decoration:underline; }
.proposal-intro { margin:0 0 10px; }
.proposal-guidance { border-top:1px dashed var(--rule); padding-top:12px; }
.proposal-guidance summary { color:var(--blue-dark); cursor:pointer; font-size:14px; }
.proposal-guidance label { margin-top:14px; }
#proposal-form :is(input,textarea) { font-weight:400; }
.story-idea h3 { margin-top:0; }
.story-idea h4 { font-size:14px; margin:14px 0 4px; }
.idea-footer, .comment-actions { display:flex; align-items:center; justify-content:space-between; gap:10px; }
#panel-chat { height:min(660px,calc(100dvh - 132px)); }
#panel-chat header { margin-bottom:0; }
#comment-scroll { flex:1; min-height:0; }
#comment-status { margin-top:14px; }
#comment-status:empty { display:none; }
#comment-scroll:has(#comment-status:not(:empty)) #comment-list:empty::before { display:none; }
#comment-list { margin:0; gap:0; }
#comment-list:empty::before { content:"Be the first to leave a comment."; display:block; padding:24px 12px; text-align:center; color:var(--soft); font:13px/1.6 "Courier New",monospace; }
.comment-row { border-bottom:1px solid #cfc2a4; padding:12px 0; overflow-wrap:anywhere; }
.comment-meta { display:flex; flex-wrap:wrap; align-items:baseline; gap:8px; color:var(--soft); font-size:12px; }
.comment-meta strong { color:var(--ink); font-size:14px; }
.comment-row p { margin:6px 0; white-space:pre-wrap; font-size:14px; }
.comment-actions { justify-content:start; }
.comment-actions .vote { font-size:12px; border:0; box-shadow:none; padding:2px 6px; background:transparent; color:var(--soft); }
.comment-actions .vote[aria-pressed=true] { color:var(--blue-dark); font-weight:bold; }
#panel-chat #comment-form { display:grid; grid-template-columns:1fr auto; align-items:center; gap:6px; border-top:2px solid var(--ink); background:var(--paper); padding:8px; margin:0; }
#comment-body { grid-column:1 / -1; max-height:100px; min-height:46px; padding:7px; resize:vertical; }
#comment-form #comment-anchor { border:0; box-shadow:none; background:none; color:var(--blue-dark); padding:0; justify-self:start; font:12px/1.5 "Courier New",monospace; }
#comment-form #comment-submit { padding:6px 14px; font-size:14px; }

#auth-dialog { color:var(--ink); background:var(--paper); border:2px solid var(--ink); border-radius:0; padding:24px; box-shadow:7px 7px 0 var(--shade); }
#auth-dialog::backdrop { background:rgba(30,22,18,.55); backdrop-filter:none; }
#auth-dialog h2 { margin:-24px -24px 18px; padding:11px 42px 11px 14px; border-bottom:2px solid var(--ink); color:#fff6df; background:var(--blue); font:700 13px/1.5 "Courier New",monospace; letter-spacing:.08em; text-transform:uppercase; }
.auth-close { top:7px; right:8px; padding:0 5px; background:var(--paper) !important; }
#auth-switch { margin:12px 0 10px; }

#panel-board { width:min(1040px,calc(100vw - 48px)); height:min(760px,90dvh); max-height:90dvh; padding:0; color:var(--ink); background:var(--paper); border:2px solid var(--ink); border-radius:0; box-shadow:8px 8px 0 var(--shade); overflow:hidden; }
#panel-board::backdrop { background:rgba(20,16,30,.6); }
#panel-board[open] { display:flex; flex-direction:column; }
#panel-board > header { flex-shrink:0; display:flex; align-items:start; justify-content:space-between; gap:16px; padding:16px 20px; background:var(--blue); color:#fff6df; border-bottom:2px solid var(--ink); }
#panel-board h2 { font:700 16px/1.5 "Courier New",monospace; color:inherit; letter-spacing:.08em; }
#panel-board header p { margin:4px 0 0; font-size:13px; }
#proposal-close { padding:0 7px; font-size:22px; line-height:1.2; }
#proposal-workspace { display:grid; grid-template-columns:1fr 1fr; min-height:0; flex:1; }
#proposal-workspace > section { overflow-y:auto; min-width:0; padding:20px; scrollbar-width:thin; scrollbar-color:var(--rule) transparent; }
#proposal-compose { border-left:1px solid var(--rule); background:var(--card); }
#proposal-workspace h3 { margin:0 0 8px; font:600 19px/1.4 Georgia,serif; }
#proposal-workspace .community-card h3 { font-size:18px; }
#proposal-form { margin:18px 0 0; }
#proposal-form input, #proposal-form textarea { font-size:14px; }
#proposal-submit { background:var(--blue); color:#fff6df; font-weight:600; }
#proposal-auth:empty { display:none; }

@media(max-width:700px) {
 #panel-board { width:calc(100vw - 20px); height:92dvh; max-height:92dvh; }
 #panel-board > header { padding:12px; }
 #proposal-workspace { display:block; overflow-y:auto; }
 #proposal-workspace > section { overflow:visible; padding:16px; }
 #proposal-compose { border-left:0; border-top:1px solid var(--rule); }
}

#floated { color:#f4ead3; justify-items:center; }
#floated p { max-width:38ch; font-size:16px; }
#floated button { font-size:14px; padding:9px 18px; }
#float-error { max-width:38ch; margin:4px auto; color:#fbf1dc; background:#392e29; padding:6px 10px; font-size:12px; }

/* The layout of the page (player, comments, the next story) is in watch.css. */
#community-bar { flex-shrink:0; }
#community-bar header { display:flex; align-items:center; gap:10px; padding:9px 12px; background:var(--blue) repeating-linear-gradient(to bottom,transparent 0 3px,rgba(20,40,38,.12) 3px 4px); border-bottom:2px solid var(--ink); }
#community-bar h2 { font:700 11px/1.5 "Courier New",monospace; letter-spacing:.12em; color:#fff6df; }
#community-account { margin-left:auto; min-width:0; }
#community-account button { padding:3px 8px; max-width:220px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; border:1px solid var(--ink); border-radius:0; box-shadow:1px 1px 0 var(--ink); background:var(--paper); font:700 11px/1.5 "Courier New",monospace; }
#comments-heading { flex-shrink:0; margin:0; padding:12px; border-bottom:1px solid var(--rule); font:700 13px/1.4 "Avenir Next","Segoe UI",sans-serif; color:var(--ink); }
#community-bar button:focus-visible { outline:2px solid var(--red); outline-offset:-2px; }
#community-bar #community-status { margin:0; padding:8px 12px; max-width:100%; }

[hidden] { display:none !important; }

@media(max-width:850px) {
 .top-actions { max-width:calc(100vw - 120px); }
 .top-actions #float { font-size:11px; padding:6px 9px; }
 .drawer { top:142px; max-height:calc(100dvh - 156px); box-shadow:4px 4px 0 var(--shade); z-index:8; }
 .community-toolbar { align-items:stretch; }
 #panel-chat { height:calc(100dvh - 156px); }
}

/* In a narrow window, sign-in belongs in the comments drawer's title bar. */
.drawer header #account-button { margin-left:auto; padding:2px 9px; font:700 11px/1.5 "Courier New",monospace; background:var(--paper); color:var(--ink); border:2px solid var(--ink); box-shadow:1px 1px 0 var(--ink); }
.drawer header #account-button:hover { background:var(--gold); }
.drawer #community-status { width:auto; margin:0 0 12px; text-align:left; }

/* The transport uses the same paper, square edge and offset shadow as the other player controls. */
#pause { width:38px; height:38px; padding:0; border-radius:0; background:#f4ead3; color:#2e231c; border:2px solid #2e231c; box-shadow:3px 3px 0 rgba(38,27,20,.82); font:700 13px/1 "Courier New",monospace; opacity:.94; transition:translate .06s, box-shadow .06s, background .12s; }
#pause:hover { background:#fffaf0; opacity:1; }
#pause[aria-pressed=true] { background:#e3b55a; color:#2e231c; opacity:1; }
#pause:active { translate:2px 2px; box-shadow:none; }

/* Full screen is dedicated to the game; floating is available again on exit. */
:fullscreen .top-actions { display:none; }
