/* Original Heroes III art is decoded from the cached game archives. */
:root {
  color-scheme: dark;
  --ink: #fff; --muted: #e6dcc4; --gold: #f2d784; --frame-blue: #22388a; --sidebar: 280px;
  --leather-fallback: radial-gradient(ellipse at 30% 20%, #654425, transparent 70%), linear-gradient(#4c2f17, #29190e);
  --gold-plate: linear-gradient(#fff2b8, #e3c26a 18%, #c49a3e 50%, #a97f2b 82%, #6f4f16);
  font: 16px/1.45 Georgia, 'Times New Roman', serif;
  color: var(--ink); background: #000;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
button, input, select { font: inherit; }
button, input, select, summary, a { -webkit-tap-highlight-color: transparent; }
button, input:not([type=checkbox]), select { min-height: 44px; }

/* ---- buttons: the scenario screen's gold plate ("Begin") ------------------- */
button {
  padding: 8px 22px;
  color: #120c03;
  font-weight: bold;
  letter-spacing: .02em;
  border: 2px solid #5a4010;
  border-radius: 0;
  background: var(--gold-plate);
  box-shadow: inset 0 0 0 1px #fff3c066, inset 0 0 0 3px #7e5d1c, 1px 2px 0 #000;
  text-shadow: 0 1px 0 #f5df9f;
  cursor: pointer;
  line-height: 1.2;
}
button:hover:not(:disabled) { filter: brightness(1.12); }
button:active:not(:disabled) { box-shadow: inset 0 2px 6px #000a; transform: translateY(1px); }
button:disabled { color: #6a5a38; text-shadow: none; filter: saturate(.35) brightness(.8); cursor: default; }
.quiet {
  color: #f2d784;
  font-weight: normal;
  font-size: 14px;
  text-shadow: 1px 1px 0 #000;
  border-color: #b8913c;
  background: linear-gradient(#3b2614, #24160b);
  box-shadow: inset 0 0 0 1px #000, inset 0 0 0 2px #6c4f1d, 1px 2px 0 #000;
}
.quiet:disabled { color: #9a8a68; }
/* With the game data: the original button frames, stretched by their caps. */
.h3-art button {
  border-style: solid;
  border-width: 0 26px 0 27px;
  padding: 8px 4px;
  background: none;
  box-shadow: none;
  border-image: var(--h3-button) 0 26 0 27 fill / 0 26px 0 27px stretch;
}
.h3-art button:hover:not(:disabled) { filter: none; border-image-source: var(--h3-button-hover); }
.h3-art button:active:not(:disabled) { box-shadow: none; border-image-source: var(--h3-button-down); }
.h3-art button:disabled { filter: none; color: #5d4c26; border-image-source: var(--h3-button-off); }
.h3-art .quiet {
  border-width: 3px 9px;
  padding: 6px 6px;
  border-image: var(--h3-quiet-button) 3 9 fill / 3px 9px stretch;
}
.h3-art .quiet:hover:not(:disabled) { border-image-source: var(--h3-quiet-button-hover); }
.h3-art .quiet:active:not(:disabled) { border-image-source: var(--h3-quiet-button-down); }
.h3-art .quiet:disabled { color: #8a7a58; border-image-source: var(--h3-quiet-button-off); }

:focus-visible { outline: 2px solid #fff1b0; outline-offset: 3px; }
a { color: var(--gold); text-underline-offset: 4px; }
h1, h2, h3, p { margin: 0; }
h2, h3 { color: var(--gold); font-weight: bold; text-shadow: 1px 1px 0 #000, 0 0 6px #000; }
h2 { font-size: 22px; letter-spacing: .02em; }
h3 { font-size: 19px; }
p { margin: 8px 0; color: var(--muted); text-shadow: 1px 1px 0 #000; }
small, .small { font-size: 14px; }


/* Only a jeweled gold loading bar is visible until the first game frame. */
#loading { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; background: #080706; }
.loading-content { width: min(420px, 76vw); text-align: center; }
progress { display: block; appearance: none; -webkit-appearance: none; width: 100%; height: 24px; padding: 4px; border: 2px solid #b49650; background: #080604; box-shadow: 0 0 0 1px #241706, 0 0 0 3px #53401f, inset 0 0 0 1px #000, inset 0 0 0 2px #25335e; accent-color: #d2ab50; }
progress::-webkit-progress-bar { background: #080604; box-shadow: inset 0 2px 5px #000; }
progress::-webkit-progress-value { background: repeating-linear-gradient(90deg, transparent 0 11px, #53380b88 11px 12px), linear-gradient(#fff0ac, #cba448 38%, #987023 70%, #e2be5a); }
progress::-moz-progress-bar { background: repeating-linear-gradient(90deg, transparent 0 11px, #53380b88 11px 12px), linear-gradient(#fff0ac, #cba448 38%, #987023 70%, #e2be5a); }
#loading.has-error #status { position: static; width: auto; height: auto; margin: 20px 0 12px; clip-path: none; white-space: normal; overflow-wrap: anywhere; }
#download { margin-top: 18px; }
#stage { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: #000; }
#screen { width: min(100vw, calc(100dvh * 4 / 3)); height: auto; aspect-ratio: 4 / 3; outline: none; }
#setup { position: absolute; inset: 0; z-index: 2; display: flex; align-items: center; justify-content: center; padding: 24px; overflow: auto; background: #0008; }
#online { width: 100%; max-width: 480px; margin: auto; }
.h3-dialog { padding: 28px; border: 6px solid #c8a554; box-shadow: inset 0 0 0 2px #000, inset 0 0 0 5px var(--frame-blue), 0 0 0 2px #392509, 0 12px 32px #000b; background: var(--h3-parchment, var(--leather-fallback)); }
.h3-art .h3-dialog { border: 16px solid transparent; border-image: var(--h3-frame) 64 / 64px round; padding: 24px; }
.room-entry-screen { display: flex; flex-direction: column; gap: 18px; }
.room-entry-screen h2, .room-entry-screen > p { text-align: center; margin: 0; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; color: var(--gold); font-size: 14px; text-shadow: 1px 1px #000; }
input:not([type=checkbox]), select { background: #000c; color: #fff; padding: 8px 11px; border: 1px solid #b8913c; border-radius: 0; box-shadow: inset 2px 2px 4px #000; max-width: 100%; min-width: 0; font-size: 16px; }
input::placeholder { color: #a99d86; }
.join-fields { display: flex; align-items: end; gap: 12px; }
.join-fields .field { flex: 1; }
#room-code { width: 100%; text-transform: uppercase; letter-spacing: .12em; }
#online-status { min-height: 1.5em; text-align: center; font-size: 14px; color: #fff; }
#setup.has-room #online { max-width: 1120px; }
#setup.has-room .room-entry-screen { display: none; }
#room { display: grid; grid-template-columns: minmax(0, 800px) 260px; gap: 16px; align-items: center; }
.scenario-screen { min-width: 0; }
#setup-screen { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; touch-action: none; outline: none; }
#setup-loading { text-align: center; }
.native-room-controls { font-size: 14px; max-height: calc(100dvh - 110px); overflow-y: auto; }
.h3-art .native-room-controls, .native-room-controls { padding: 16px 12px; }
.native-room-controls h2 { font-size: 19px; text-align: center; margin-bottom: 14px; }
.native-room-controls button { width: 100%; margin-top: 10px; }
#invite { display: block; overflow-wrap: anywhere; text-align: center; }
.row { display: flex; flex-direction: column; }
#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 #b8913c; background: #000000a8; 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; }

#message, #media-message { position: fixed; z-index: 12; left: 50%; top: 50%; transform: translate(-50%, -50%); width: max-content; max-width: min(90vw, 560px); margin: 0; padding: 20px 24px; border: 3px solid #e2bf62; box-shadow: inset 0 0 0 2px var(--frame-blue), 0 6px 30px #000b; background: var(--h3-parchment, var(--leather-fallback)); 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: var(--h3-parchment, var(--leather-fallback)); border-left: 3px solid #e2bf62; box-shadow: inset 2px 0 0 var(--frame-blue), inset 3px 0 0 #000; 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; }
.h3-art #online-sidebar button { padding: 7px 2px; }
.h3-art #online-sidebar .quiet { padding: 5px 4px; }
#end-day { width: 100%; font-size: 18px; }
#online-sidebar details { margin: 12px 0; border-top: 1px solid #b8913c; 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 #b8913c; padding-bottom: 12px; }
.sidebar-help { border-top: 1px solid #b8913c; margin-top: 18px; padding-top: 12px; font-size: 13px; }


@media (max-width: 820px), (max-height: 560px) {
  #setup { padding: 12px; }
  #room { grid-template-columns: 1fr; }
  #setup.has-room #online { max-width: 800px; }
  .native-room-controls { max-height: none; }
  #room-roster { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .native-room-controls .row { flex-direction: row; gap: 12px; }
}
@media (max-width: 760px) {
  body.online-playing #online-sidebar { width: 100%; top: auto; height: 28dvh; border-left: 0; border-top: 3px solid #e2bf62; padding-top: 10px; }
  body.online-playing #stage { right: 0; bottom: 28dvh; }
  body.online-playing #screen { width: min(100vw, calc(72dvh * 4 / 3)); }
}
