:root {
  color-scheme: dark;
  --ink: #fff0cc;
  --muted: #d3c19f;
  --gold: #ddb65e;
  --edge: #80612d;
  --panel: #231c15;
  --sidebar: 280px;
  font: 16px/1.5 Georgia, 'Times New Roman', serif;
  color: var(--ink);
  background: #10141b;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body {
  background: radial-gradient(ellipse at 50% 5%, #34434c80, transparent 75%),
    linear-gradient(#0c1725e8, #090d14f2), url('dialog.png');
  min-height: 100vh;
  padding: 32px 20px;
}
button, input, select { font: inherit; }
button, input, select, summary, a { -webkit-tap-highlight-color: transparent; }
button, input:not([type=checkbox]), select { min-height: 44px; }
button {
  padding: 8px 18px;
  color: #ffe8ae;
  border: 1px solid #d5ad57;
  border-radius: 0;
  background: linear-gradient(#762d28e8, #3b1313ed), url('dialog.png');
  box-shadow: inset 0 0 0 1px #2b130e, inset 0 2px 0 #e4bb6270, inset 0 -3px 0 #160a0a;
  text-shadow: 1px 1px 1px #000;
  cursor: pointer;
  line-height: 1.25;
}
button:hover:not(:disabled) { filter: brightness(1.2); }
button:active:not(:disabled) { box-shadow: inset 0 2px 5px #000; }
button:disabled { color: #c3b89e; filter: saturate(.25); opacity: .58; cursor: default; }
:focus-visible { outline: 2px solid #fff1b0; outline-offset: 4px; }
a { color: #ffe39b; text-underline-offset: 4px; }
h1, h2, h3, p { margin: 0; }
h2, h3 { color: var(--gold); font-weight: normal; text-shadow: 1px 2px #080706; }
h2 { font-size: 25px; }
h3 { font-size: 20px; }
p { margin: 8px 0; color: var(--muted); }
small, .small { font-size: 14px; }
#setup {
  max-width: 1120px;
  margin: 0 auto;
  border: 3px ridge #d1a847;
  box-shadow: 0 0 0 2px #080907, 0 0 0 3px #826433, 0 20px 70px #000b;
  background: linear-gradient(#201911a8, #18110aa8), url('dialog.png');
  position: relative;
}
.corner { width: 64px; height: 64px; position: absolute; z-index: 1; pointer-events: none; background: url('corner.png'); }
.corner.tl { top: -2px; left: -2px; }
.corner.tr { top: -2px; right: -2px; transform: rotate(90deg); }
.corner.bl { bottom: -2px; left: -2px; transform: rotate(-90deg); }
.corner.br { bottom: -2px; right: -2px; transform: rotate(180deg); }
.castle-banner {
  min-height: 286px;
  display: flex;
  align-items: end;
  position: relative;
  padding: 30px 36px;
  border-bottom: 3px ridge #b6974f;
  background: linear-gradient(90deg, #06101ce8, #07101c22 65%),
    linear-gradient(0deg, #10131ab3, transparent 70%), url('hyrule.webp') 50% 5% / cover;
}
.brand { max-width: 550px; text-shadow: 0 2px 3px #000, 0 0 18px #000; }
.eyebrow { font-size: 12px; letter-spacing: .2em; text-transform: uppercase; color: #eed8a2; }
h1 { font-size: clamp(35px, 5.5vw, 62px); line-height: 1.05; color: #ffe2a0; font-weight: normal; letter-spacing: .035em; }
h1 span { display: block; font-size: .4em; line-height: 1.7; letter-spacing: .12em; }
.edition { margin: 10px 0 0; color: #f6e3bf; font-size: 15px; }
.menu-content { display: flex; flex-direction: column; padding: 28px 30px 22px; }
.play-options { display: grid; grid-template-columns: .9fr 1.25fr; gap: 28px; }
.menu-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.menu-number { display: grid; place-items: center; width: 32px; height: 32px; flex: 0 0 32px; color: #f3d48d; border: 1px solid #ae8439; box-shadow: inset 0 0 0 2px #22140c; background: #10293c; font-size: 18px; }
.menu-copy { min-height: 48px; margin-bottom: 18px; }
#solo { min-width: 0; padding-right: 28px; border-right: 1px solid #957039; }
#online { min-width: 0; }
.primary { background: linear-gradient(#82352bed, #4b1515ef), url('dialog.png'); }
#play { width: 100%; font-size: 21px; min-height: 54px; }
.preferences { margin-top: 17px; padding: 12px 0 0; border-top: 1px solid #80612d80; }
summary { color: #e4c98a; cursor: pointer; padding: 4px 0; }
.check-label { display: flex; align-items: center; gap: 8px; margin: 12px 0; cursor: pointer; }
input[type=checkbox] { width: 18px; height: 18px; margin: 0; accent-color: #9c782d; }
.quiet { background: linear-gradient(#273744, #141f29); border-color: #917243; font-size: 14px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin: 12px 0; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; color: #ecd7aa; font-size: 14px; }
input:not([type=checkbox]), select {
  background: #0c1822;
  color: #fff1d1;
  padding: 8px 11px;
  border: 1px solid #987849;
  border-radius: 0;
  box-shadow: inset 2px 2px 5px #0009;
  max-width: 100%;
  min-width: 0;
  font-size: 16px;
}
input::placeholder { color: #acada7; opacity: 1; }
input:disabled, select:disabled { color: #d0c5af; opacity: .7; }
#player-name { width: 100%; }
.room-entry { display: flex; align-items: end; gap: 10px; margin-top: 12px; }
.room-entry > button { flex: 1 0 auto; }
.join-fields { display: flex; gap: 8px; align-items: end; margin-left: auto; }
#room-code { text-transform: uppercase; width: 8.5em; letter-spacing: .1em; }
#online-status { font-size: 14px; margin-top: 12px; }
#room {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 24px;
  margin-top: 16px;
  padding-top: 18px;
  border-top: 2px ridge #b08a47;
}
.lobby-header { grid-column: 1 / -1; }
.lobby-settings, .lobby-players { min-width: 0; }
#setup.has-room .play-options { display: block; }
#setup.has-room #solo, #setup.has-room #online > .menu-copy,
#setup.has-room #online > .field, #setup.has-room .room-entry { display: none; }
#setup.has-room .castle-banner { min-height: 180px; }
#setup.has-room h1 { font-size: clamp(26px, 4vw, 40px); }
#setup.has-room h1 span { display: inline; font-size: .55em; letter-spacing: .03em; }
#setup.has-room .brand { max-width: none; }
#room h3 { margin-bottom: 10px; }
.invite-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
#invite { overflow-wrap: anywhere; flex: 1; min-width: 140px; font-size: 14px; }
#online-map { width: 100%; }
#map-description { font-size: 14px; max-height: 140px; overflow-y: auto; }
#map-description:empty { display: none; }
#room-roster { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 6px; }
#room-roster li { position: relative; min-height: 38px; padding: 8px 10px 8px 32px; border: 1px solid #6b5739; background: #101c29c9; font-size: 14px; overflow-wrap: anywhere; }
#room-roster li::before { content: ''; position: absolute; top: 11px; left: 11px; width: 10px; height: 16px; border: 1px solid #f6dc9a; background: var(--banner, #a5a5a5); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 75%, 0 100%); }
#room-roster [data-color='0'] { --banner: #df3b37; }
#room-roster [data-color='1'] { --banner: #507ee6; }
#room-roster [data-color='2'] { --banner: #bb9b66; }
#room-roster [data-color='3'] { --banner: #49a052; }
#room-roster [data-color='4'] { --banner: #ed8a35; }
#room-roster [data-color='5'] { --banner: #b076df; }
#room-roster [data-color='6'] { --banner: #48b4b7; }
#room-roster [data-color='7'] { --banner: #e586b6; }
.download-panel { margin-top: 24px; padding: 14px 18px; border: 1px solid #80612d; background: linear-gradient(#182735d9, #0c151fef); box-shadow: inset 0 0 0 2px #0e131a; }
body:not(.data-ready) .download-panel { order: -1; margin: 0 0 24px; }
.download-panel .eyebrow { font-size: 11px; }
#status { min-height: 1.5em; color: #f5e4c1; font-size: 14px; overflow-wrap: anywhere; }
.download-help { font-size: 13px; margin-bottom: 0; }
progress { width: 100%; height: 15px; margin-top: 10px; padding: 2px; border: 1px solid #ba9653; background: #101824; accent-color: #d2ab50; }
progress::-webkit-progress-bar { background: #101824; }
progress::-webkit-progress-value { background: linear-gradient(#f2d78b, #9e722d); }
progress::-moz-progress-bar { background: linear-gradient(#f2d78b, #9e722d); }
.menu-footer { margin: 18px 0 0; text-align: center; color: #c6b28c; font-size: 12px; letter-spacing: .06em; }
body.playing { padding: 0; overflow: hidden; }
body.playing #setup { display: none; }
#stage { display: none; position: fixed; inset: 0; align-items: center; justify-content: center; background: #000; }
body.playing #stage { display: flex; }
#screen { width: min(100vw, calc(100vh * 4 / 3)); height: auto; aspect-ratio: 4 / 3; outline: none; image-rendering: auto; }
#message, #media-message { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: max-content; max-width: min(90vw, 560px); margin: 0; padding: 20px 24px; border: 3px ridge #bd9548; background: linear-gradient(#22190c99, #22190c99), url('dialog.png'); box-shadow: 0 6px 30px #000b; color: var(--ink); }
#media-retry { margin: 8px; }
#note { display: none; position: fixed; bottom: 4px; left: 8px; color: #b8aa8a; font-size: 12px; pointer-events: none; }
body.playing #note { display: block; }
#online-sidebar { display: none; position: fixed; right: 0; top: 0; bottom: 0; width: var(--sidebar); padding: 18px 14px; background: linear-gradient(#161b24ed, #111824db), url('dialog.png'); border-left: 3px ridge #bb954c; overflow-y: auto; z-index: 2; font-size: 14px; }
body.online-playing #online-sidebar { display: block; }
body.online-playing #stage { right: var(--sidebar); }
body.online-playing #screen { width: min(calc(100vw - var(--sidebar)), calc(100vh * 4 / 3)); }
#online-sidebar h2 { font-size: 22px; margin-top: 5px; }
#online-sidebar button { margin: 3px 3px 3px 0; padding: 7px 10px; }
#end-day { width: 100%; font-size: 18px; }
#online-sidebar details { margin: 12px 0; border-top: 1px solid #826337; padding-top: 8px; }
#online-sidebar summary { color: var(--gold); }
#online-notice { white-space: pre-wrap; color: var(--ink); }
#online-questions:not(:empty) { border-bottom: 1px solid #967643; padding-bottom: 12px; }
.sidebar-help { border-top: 1px solid #715b39; margin-top: 18px; padding-top: 12px; font-size: 13px; }
@media (max-width: 820px) {
  body { padding: 18px 14px; }
  .castle-banner { min-height: 245px; padding: 28px; }
  .menu-content { padding: 24px; }
  .play-options { grid-template-columns: 1fr; gap: 24px; }
  #solo { padding: 0 0 24px; border-right: 0; border-bottom: 1px solid #957039; }
  .menu-copy { min-height: 0; }
  .preferences { margin-top: 12px; }
  #room { grid-template-columns: 1fr; gap: 18px; }
}
@media (max-width: 760px) {
  body.online-playing #online-sidebar { width: 100%; top: auto; height: 28vh; border-left: 0; border-top: 3px ridge #bb954c; padding-top: 10px; }
  body.online-playing #stage { right: 0; bottom: 28vh; }
  body.online-playing #screen { width: min(100vw, calc(72vh * 4 / 3)); }
}
@media (max-width: 480px) {
  body { padding: 12px 10px; }
  .castle-banner { min-height: 235px; padding: 28px 20px 20px; background-position: center, center, 57% 25%; }
  .menu-content { padding: 22px 18px; }
  .edition { font-size: 13px; }
  .room-entry { flex-wrap: wrap; }
  .room-entry > button { width: 100%; }
  .join-fields { width: 100%; margin: 0; }
  .join-fields .field { flex: 1; }
  #room-code { width: 100%; }
  .download-panel { padding: 12px; }
  .corner { width: 48px; height: 48px; background-size: 48px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; } }
/* The room uses the engine's original 800x600 scenario/Advanced Options UI. */
#room { display: block; }
#setup-screen { display: block; width: min(100%, 1000px); height: auto; aspect-ratio: 4 / 3; margin: 20px auto 0; border: 2px ridge #c5a258; touch-action: none; }
#setup-screen:focus-visible { outline-offset: 2px; }
.native-room-controls { margin-top: 16px; }
.native-room-controls .row a { margin-left: auto; font-size: 14px; }
.native-room-controls #room-roster { grid-template-columns: repeat(2,minmax(0,1fr)); }
#setup.has-room .castle-banner { min-height: 135px; padding-top: 18px; padding-bottom: 18px; }
#setup.has-room .download-panel, #setup.has-room .menu-footer { display: none; }
@media (max-width: 600px) {
  .native-room-controls #room-roster { grid-template-columns: 1fr; }
  #setup.has-room .menu-content { padding: 18px 8px; }
  .native-room-controls .row a { margin-left: 0; }
}
/* In a room, give the original setup screen the space used by the title art. */
#setup.has-room { max-width: 900px; }
#setup.has-room .castle-banner, #setup.has-room .menu-heading, #room .lobby-header h3 { display: none; }
#setup.has-room .menu-content { padding-top: 16px; padding-bottom: 16px; }
#setup.has-room #online-status { margin-top: 0; }
#room { padding-top: 0; border-top: 0; margin-top: 10px; }
#setup-screen { width: min(100%, 800px); margin-top: 14px; }
