:root {
  --rm-brand-gold: #c5a15b;
  --rm-brand-ink: #f0e1c1;
  --rm-brand-muted: #bcc9b8;
  --rm-brand-border: #536451;
  --rm-brand-dark: #14251d;
}

body:has(> #menu) {
  background: radial-gradient(ellipse at 70% 0%, #284132, #101d16 58%, #0e1813);
}

main#menu {
  width: min(calc(100% - 40px), 1140px);
  padding-block: 24px 40px;
  gap: 16px;
}

#menu .rm-brand-hero {
  display: grid;
  align-content: center;
  justify-items: start;
  min-height: clamp(180px, 24vw, 270px);
  padding: clamp(22px, 5vw, 60px);
  border: 1px solid #6c6748;
  border-radius: 14px;
  text-align: left;
  background: linear-gradient(90deg, #0c1b14 4%, #10221be8 36%, #15291d1a 100%),
    url("world.webp") 68% 48% / cover #1d3527;
  box-shadow: 0 16px 36px #0004;
}

.rm-brand-lockup { display: flex; align-items: center; gap: clamp(11px, 2.2vw, 24px); }
.rm-brand-lockup img { width: clamp(37px, 6vw, 72px); height: auto; flex: none; }
#menu .rm-brand-hero h1 {
  margin: 0;
  color: #f2d99e;
  font: 700 clamp(30px, 6vw, 72px)/1.04 Georgia, serif;
  letter-spacing: -.045em;
  text-shadow: 0 2px 12px #09150e;
}
#menu .rm-brand-hero p { margin-top: 7px; color: var(--rm-brand-ink); font-size: clamp(12px, 1.6vw, 16px); }
#menu:not(:has(#rmOnlineHub:not([hidden]))):not([data-rm-in-lobby]) .rm-brand-hero,
#menu[data-rm-in-lobby] .rm-brand-hero { min-height: 0; padding: 15px 21px; }
#menu:not(:has(#rmOnlineHub:not([hidden]))):not([data-rm-in-lobby]) .rm-brand-lockup img,
#menu[data-rm-in-lobby] .rm-brand-lockup img { width: 32px; }
#menu:not(:has(#rmOnlineHub:not([hidden]))):not([data-rm-in-lobby]) .rm-brand-hero h1,
#menu[data-rm-in-lobby] .rm-brand-hero h1 { font-size: 32px; }
#menu:not(:has(#rmOnlineHub:not([hidden]))):not([data-rm-in-lobby]) .rm-brand-hero p,
#menu[data-rm-in-lobby] .rm-brand-hero p { display: none; }

#menu .grid { grid-template-columns: minmax(210px, 262px) minmax(0, 1fr); gap: 16px; }
#menu .panel {
  min-width: 0;
  padding: clamp(15px, 2.4vw, 24px);
  border-color: var(--rm-brand-border);
  background: linear-gradient(155deg, #20372a, #14251d 78%);
  box-shadow: 0 10px 24px #0003;
}
#menu h2 { color: var(--rm-brand-ink); line-height: 1.12; }
#menu label { color: var(--rm-brand-ink); font-size: 13px; font-weight: 650; }
#menu input:not([type="range"]), #menu select, #menu button { min-width: 0; }
#menu input:not([type="range"]), #menu select { width: 100%; min-height: 44px; background: #14251d; border-color: #71836c; }
#menu button:focus-visible, #menu input:focus-visible, #menu select:focus-visible,
dialog .rm-map-option:focus-visible { outline: 2px solid #f5d59a; outline-offset: 3px; }
#menu button:disabled { opacity: .62; }
#menu #preview { padding: 9px 11px; border-inline-start: 2px solid var(--rm-brand-gold); background: #102219; overflow-wrap: anywhere; }
#menu p { color: var(--rm-brand-muted); }

.rm-brand-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
#menu #rmLobbyFullscreen { float: none !important; min-height: 44px; padding: 8px 12px; }
#menu .rm-match-browser { padding: 0; background: transparent; border: 0; }
#menu .rm-match-browser .rm-menu-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
#menu .rm-match-browser .rm-menu-actions button {
  display: grid;
  grid-template-rows: auto 1fr;
  align-items: start;
  gap: 5px;
  min-height: 76px;
  padding: 12px;
  border: 1px solid #798363;
  background: #243b2d;
  text-align: left;
}
#menu .rm-match-browser .rm-menu-actions button:hover { border-color: #e2c482; background: #304b38; }
#menu .rm-match-browser #rmCustom { background: #d4b474; border-color: #ecd398; }
#menu .rm-match-browser #rmCustom:hover { background: #e5c98f; }
#menu .rm-match-browser #rmCustom :is(strong, span) { color: #19251a; }
#menu .rm-match-browser #rmLocal { border-style: solid; }
#menu .rm-match-browser .rm-empty { margin-top: 3px; }
#menu #rmOnlineResults { min-height: 0; }
#menu #rmOnlineResults .rm-feed-empty { min-height: 76px; }
#menu .rm-upcoming-button { min-height: 44px; }

#menu #rmCustomPanel, #menu #rmJoinPanel, #menu #setup, #menu #rmOnlineLobby {
  width: 100%;
  max-width: 740px;
  justify-self: center;
}
#menu #rmJoinPanel { max-width: 510px; }
#menu .rm-section-top { padding-bottom: 10px; border-bottom: 1px solid #56654d; }
#menu .rm-section-top button { min-height: 44px; }
#menu .rm-match-panel button.gold { min-height: 46px; background: #d4b474; color: #19251a; }
#menu .rm-match-panel #rmJoinSpectator { min-height: 44px; }
#menu .rm-match-panel .rm-explain:empty, #setup #status:empty { display: none; }
#menu #rmInvite { font-variant-numeric: tabular-nums; letter-spacing: .08em; }
#menu #rmMapChosen:empty { display: none; }
#menu .rm-map-choice-row:has(#rmMapChosen:empty) { grid-template-columns: 1fr; }
#menu .rm-map-choice-label, #menu .rm-kingdom-frame { border-color: #66765e; background: #192f23; }
#menu .rm-local-setup { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 16px; align-items: start; }
#menu .rm-local-settings { display: grid; gap: 10px; }
#menu #setup #mapcard { display: block; height: auto; aspect-ratio: 1.08; border: 1px solid #64735a; }
.rm-load-brand { display: flex; align-items: center; justify-content: center; gap: 8px; }
.rm-load-brand img { width: 21px; height: auto; }

@media (max-width: 700px) {
  main#menu { width: calc(100% - 24px); padding-top: 12px; gap: 12px; }
  #menu .grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  #menu .rm-brand-hero { min-height: 153px; padding: 18px; background-position: center, 63% center; }
  #menu .rm-brand-hero h1 { font-size: clamp(28px, 8vw, 52px); }
  #menu #rmUpcomingResults { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 490px) {
  #menu .rm-match-browser .rm-menu-actions, #menu .rm-local-setup { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  #menu .rm-match-browser .rm-menu-actions button { min-height: 54px; padding: 9px 12px; gap: 2px; }
  #menu #setup #mapcard { max-height: 162px; }
  #menu #rmOnlineResults { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

/* Shared with the match iframe. Only the county selection card is targeted. */
.start-choice {
  border: 1px solid #917c50;
  border-radius: 10px;
  background: linear-gradient(155deg, #273e2e, #152820 78%) !important;
  color: var(--rm-brand-ink);
}
.start-choice .rm-selection-kicker { display: flex; gap: 8px; align-items: center; color: #f3d69a; }
.start-choice .rm-selection-kicker::before {
  content: "";
  display: inline-block;
  flex: 0 0 16px;
  height: 19px;
  background: url("realmmuster-mark.svg") center / contain no-repeat;
}
.start-choice .rm-empty-county { color: var(--rm-brand-ink); }
.start-choice .rm-selection-info { border-color: #64755c; }
.start-choice .rm-selection-status { color: #f0d495; }
.start-choice button:focus-visible { outline: 2px solid #f5d59a; outline-offset: 2px; }
