@import url("https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=DM+Sans:wght@400;500;600;700&family=Rye&display=swap");

:root {
  color-scheme: dark;
  font-family: "DM Sans", sans-serif;
  color: #f0e4c9;
  background: #28221c;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --muted: #9c8d77;
  --line: #524337;
  --gold: #d7ae69;
  --panel: #342b22;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(ellipse at 50% 25%, rgb(90 67 44 / 17%), transparent 58%),
    #28221c;
}

button { font: inherit; }

.app-shell {
  width: min(100% - 48px, 1120px);
  margin: 0 auto;
}

.app-shell.is-map-view {
  display: flex;
  height: 100vh;
  height: 100dvh;
  flex-direction: column;
}

.app-shell.is-map-view #view-map {
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
}

.app-shell.is-map-view .map-card {
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
}

.app-shell.is-map-view .map-scroll {
  display: flex;
  container-type: size;
  min-height: 0;
  max-height: none;
  flex: 1 1 auto;
  align-items: safe center;
  justify-content: safe center;
  overflow: auto;
}

.app-shell.is-map-view .map-stage {
  width: min(100cqw, 133.333cqh);
  min-width: 0;
  height: min(100cqh, 75cqw);
  flex: 0 0 auto;
}

.app-shell.is-map-view .page-footer { flex: 0 0 auto; }

@media (max-height: 600px) {
  .app-shell.is-map-view .view-intro,
  .app-shell.is-map-view .page-footer { display: none; }
  .app-shell.is-map-view .map-toolbar { min-height: 56px; }
}

.topbar {
  height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgb(179 145 100 / 17%);
}

.brand {
  display: inline-flex;
  align-items: center;
  color: #efe2c9;
  font: 500 12px "DM Mono", monospace;
  letter-spacing: 1.4px;
  text-decoration: none;
}

.brand b { color: var(--gold); font-weight: 500; }

.brand-name { white-space: nowrap; text-transform: uppercase; }

.topbar-note, .eyebrow, .map-heading h2, .map-footer, .page-footer, .dialog-badge, .dialog-bottom {
  font: 10px "DM Mono", monospace;
  letter-spacing: 1.25px;
}

.topbar-note { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: #91a16b; box-shadow: 0 0 8px #91a16b80; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.account-button, .primary-button, .secondary-button { min-height: 34px; padding: 7px 11px; border: 1px solid #80613d; color: #efd9ad; background: #493a2b; font: 10px "DM Mono", monospace; cursor: pointer; }
.account-button { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.settings-button { display: grid; width: 34px; height: 34px; place-items: center; padding: 0; border: 1px solid #80613d; color: #efd9ad; background: #493a2b; font-size: 17px; cursor: pointer; }
.secondary-button { border-color: #66513b; color: #cabb9f; background: #3d3228; }
.account-button:hover, .settings-button:hover, .primary-button:hover, .secondary-button:hover { background: #60482f; }
.account-button:active, .settings-button:active, .primary-button:active, .secondary-button:active, .visibility-toggle:active { background: #765936; box-shadow: inset 0 2px 4px #1c140d99; transform: translateY(1px); }
.account-button:disabled, .settings-button:disabled, .primary-button:disabled, .secondary-button:disabled, .visibility-toggle:disabled { cursor: wait; opacity: .6; }
.remember-session-button[aria-pressed="true"] { border-color: #8d8157; color: #c9d49b; background: #3e4430; }
.remember-session-button[aria-pressed="true"]:hover { background: #505a3a; }
.account-button:focus-visible, .settings-button:focus-visible, .primary-button:focus-visible, .secondary-button:focus-visible { outline: 1px solid var(--gold); outline-offset: 2px; }
.language-picker select { max-width: 108px; padding: 6px 7px; border: 1px solid #66513b; color: #dfc79c; background: #3d3228; font: 10px "DM Mono", monospace; }
.language-picker select:focus-visible { outline: 1px solid var(--gold); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; clip-path: inset(50%); }

.primary-nav {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 16px 0 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgb(179 145 100 / 17%);
}
.nav-tab {
  min-height: 42px;
  padding: 9px 14px;
  border: 1px solid transparent;
  color: #a7957b;
  background: transparent;
  font: 11px "DM Mono", monospace;
  cursor: pointer;
}
.nav-tab:hover, .nav-tab:focus-visible { border-color: #66513b; color: #efd9ad; outline: none; }
.nav-tab[aria-selected="true"] { border-color: #80613d; color: #f1d291; background: #493a2b; }
.view-panel { min-width: 0; }

.map-card {
  overflow: hidden;
  border: 1px solid #66513b;
  background: #332b22;
  box-shadow: 0 20px 60px #130f0b80, inset 0 1px #ffffff08;
}

.text-page, .leaderboard-page, .home-page {
  padding: clamp(20px, 4vw, 38px);
  border: 1px solid #66513b;
  background: #332b22;
  box-shadow: 0 20px 60px #130f0b80, inset 0 1px #ffffff08;
}
.text-page h1, .leaderboard-page h1 { margin: 0; color: #f4e8d0; font: clamp(25px, 4vw, 34px) "Rye", serif; }
.home-page h1 { margin: 0; color: #f4e8d0; font: clamp(34px, 7vw, 60px) "Rye", serif; }
.home-eyebrow { margin: 0 0 12px; color: var(--gold); font: 10px "DM Mono", monospace; letter-spacing: 1.4px; }
.home-lore { max-width: 760px; margin: 20px 0 12px; color: #e2d2b7; font: 19px/1.7 "DM Sans", sans-serif; }
.home-how-to-play { max-width: 760px; margin: 0; color: #aa9b85; font-size: 14px; line-height: 1.8; }
.home-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.home-actions .primary-button, .home-actions .secondary-button { min-height: 40px; }
.view-intro { margin: 0 0 14px; }
.view-intro h1 { margin: 0 0 6px; color: #f4e8d0; font: clamp(24px, 4vw, 32px) "Rye", serif; }
.view-intro p { margin: 0; color: #aa9b85; font-size: 13px; line-height: 1.6; }
.page-intro { margin: 10px 0 23px; color: #aa9b85; font-size: 14px; line-height: 1.6; }
.rules-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; counter-reset: rules; }
.rules-list li { position: relative; padding: 16px 18px 16px 54px; border: 1px solid #554638; background: #2e271f; counter-increment: rules; }
.rules-list li::before { position: absolute; top: 16px; left: 18px; color: var(--gold); font: 15px "DM Mono", monospace; content: counter(rules, decimal-leading-zero); }
.rules-list h2 { margin: 0 0 7px; color: #e8d5b2; font: 16px "Rye", serif; }
.rules-list p { margin: 0; color: #aa9b85; font-size: 13px; line-height: 1.6; }
.leaderboard-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; max-width: 760px; }
.leaderboard-filter { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 10px; }
.leaderboard-controls label { color: #cabb9f; font: 10px "DM Mono", monospace; }
.leaderboard-controls select { min-height: 36px; padding: 8px; border: 1px solid #66513b; color: #f0e4c9; background: #28221c; font: 13px "DM Sans", sans-serif; }
.leaderboard-controls select:focus-visible { outline: 1px solid var(--gold); }
.leaderboard-page .status-message { margin: 15px 0; }
.leaderboard-section { margin-top: 26px; padding: 13px; border: 1px solid #554638; }
.leaderboard-section h2 { width: fit-content; margin: -23px 0 10px -6px; padding: 0 6px; color: #e8d5b2; background: #332b22; font: 14px "Rye", serif; }
.leaderboard-section .page-intro { margin: 0 0 12px; }
.leaderboard-scroll { overflow-x: auto; }
.leaderboard-table { width: 100%; border-collapse: collapse; text-align: left; }
.leaderboard-table th, .leaderboard-table td { padding: 12px 14px; border-bottom: 1px solid #554638; }
.leaderboard-table th { color: #d7ae69; font: 10px "DM Mono", monospace; letter-spacing: .8px; text-transform: uppercase; }
.leaderboard-table td { color: #e4d5bb; font-size: 13px; }
.leaderboard-admin-badge { display: inline-block; padding: 2px 5px; border: 1px solid #a87f46; border-radius: 3px; color: #f0cb83; background: #4a3925; font: 9px "DM Mono", monospace; letter-spacing: .3px; text-transform: uppercase; vertical-align: 1px; }
.leaderboard-table td:nth-child(3), .leaderboard-table th:nth-child(3),
.leaderboard-table td:nth-last-child(-n+2), .leaderboard-table th:nth-last-child(-n+2) { text-align: right; font-variant-numeric: tabular-nums; }
.officer-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px 18px; margin: 0; padding: 0; list-style: none; }
.officer-list li { padding: 8px 0; border-bottom: 1px solid #554638; color: #e4d5bb; font-size: 13px; }

.map-toolbar { min-height: 72px; display: flex; justify-content: space-between; align-items: center; padding: 0 20px; border-bottom: 1px solid #554638; }
.map-heading { display: flex; align-items: center; gap: 12px; }
.map-pin-icon { color: var(--gold); font-size: 20px; }
.map-heading h2 { margin: 0 0 5px; color: #e7d5b5; font-size: 10px; }
.map-heading p { margin: 0; color: #988974; font-size: 12px; }
.map-actions { display: flex; align-items: center; gap: 9px; color: #b6a58b; font: 11px "DM Mono", monospace; }
.zoom-button { width: 29px; height: 29px; border: 1px solid #66513b; color: #dfc79c; background: #3d3228; cursor: pointer; font-size: 17px; }
.zoom-button:hover, .zoom-button:focus-visible { background: #554331; outline: 1px solid var(--gold); }
.zoom-level { min-width: 38px; text-align: center; }

.map-scroll { max-height: min(72vh, 680px); overflow: auto; overscroll-behavior: contain; background: #d9b36f; scrollbar-color: #96734a #372d23; }
.map-scroll { cursor: grab; }
.map-scroll.is-dragging { cursor: grabbing; user-select: none; }
.map-scroll.is-dragging .map-marker { pointer-events: none; }
.map-stage { position: relative; width: 100%; min-width: 680px; aspect-ratio: 4 / 3; overflow: hidden; transform-origin: top left; }
.map-image { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; }
.markers { position: absolute; inset: 0; container-type: inline-size; }
.map-marker { position: absolute; z-index: 2; width: clamp(30px, 4.1cqi, 42px); height: clamp(30px, 4.1cqi, 42px); display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: transparent; transform: translate(-50%, -50%); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.map-date-node { position: absolute; z-index: 4; display: grid; gap: 2px; width: max-content; max-width: clamp(80px, 12.5cqi, 128px); padding: 5px 7px; border: 1px solid #55402c; color: #f5e6c6; background: #35291fe8; box-shadow: 0 2px 6px #17110db0; font: clamp(6px, .78cqi, 8px) "DM Mono", monospace; white-space: normal; pointer-events: none; box-sizing: border-box; }
.map-date-node-title { color: #f1d291; text-transform: uppercase; }
.map-current-time { position: absolute; z-index: 5; display: grid; justify-items: center; gap: 1px; transform: translate(-50%, -50%); pointer-events: none; }
.map-current-time-icon { display: grid; width: clamp(24px, 3.125cqi, 32px); height: clamp(24px, 3.125cqi, 32px); place-items: center; border: 2px solid #f1d291; border-radius: 50%; background: #493a2b; box-shadow: 0 2px 10px #17110dba; font-size: clamp(14px, 1.76cqi, 18px); }
.marker-pulse { position: absolute; inset: 5px; border: 1px solid #fff0c1a8; border-radius: 50%; box-shadow: 0 2px 6px #30201380; transition: transform .18s ease, background .18s ease; }
.is-available .marker-pulse { background: #332820ec; }
.is-upcoming .marker-pulse { border-color: #e9d8b484; background: #766b5acc; }
.marker-symbol { position: relative; display: grid; min-width: 22px; min-height: 22px; place-items: center; color: #f4ca78; font-size: 16px; transition: transform .18s ease; }
.is-upcoming .marker-symbol { color: #f0dfc1; font-size: 14px; }
.marker-awards { position: absolute; top: -4px; right: -9px; display: flex; gap: 1px; font-size: 11px; line-height: 1; }
.marker-title { position: absolute; z-index: 6; width: 112px; padding: 4px 5px; border: 1px solid #76583a; color: #4a3524; background: #f0d7a8f2; font: 8px/1.25 "DM Mono", monospace; text-align: center; text-shadow: none; overflow-wrap: anywhere; box-sizing: border-box; pointer-events: none; opacity: 0; transition: opacity .15s ease; }
.map-marker:hover + .marker-title, .map-marker:focus-visible + .marker-title { opacity: 1; }
.is-upcoming .marker-title { border-color: #766955; color: #453e34; background: #d3c7b1ed; }
.map-current-time-label { position: absolute; z-index: 4; width: max-content; max-width: clamp(80px, 12.5cqi, 128px); padding: 4px 6px; border: 1px solid #55402c; color: #fff0c1; background: #35291fe8; box-shadow: 0 2px 6px #17110db0; font: clamp(6px, .78cqi, 8px) "DM Mono", monospace; text-align: center; white-space: normal; box-sizing: border-box; }
.map-marker:hover .marker-pulse, .map-marker:focus-visible .marker-pulse { transform: scale(1.18); background: #68462c; }
.map-marker:hover .marker-symbol, .map-marker:focus-visible .marker-symbol { transform: scale(1.12); }
.map-marker:focus-visible { outline: 2px solid #fff2ca; outline-offset: 1px; }
.map-label { position: absolute; z-index: 1; color: #604932; font: 9px "DM Mono", monospace; letter-spacing: 1px; text-shadow: 0 1px #f1d395a8; pointer-events: none; }
.label-mountains { top: 10%; left: 67%; transform: rotate(-15deg); }
.label-river { top: 47%; left: 77%; transform: rotate(-43deg); }
.label-trail { top: 82%; left: 10%; transform: rotate(-10deg); }
.label-town { top: 70%; left: 45%; font-size: 8px; }
.map-error { padding: 20px; color: #fff; font-size: 14px; }

.map-footer { min-height: 43px; display: flex; align-items: center; justify-content: space-between; padding: 0 20px; color: #a7957b; font-size: 9px; }
.map-footer > span:first-child { display: flex; align-items: center; gap: 8px; }
.legend-dot { width: 7px; height: 7px; border-radius: 50%; background: #e0b565; }
.map-coordinates { color: #786b58; }
.page-footer { display: flex; align-items: center; justify-content: space-between; padding: 23px 2px; color: #817360; font-size: 9px; }
.page-footer b { padding-left: 5px; color: var(--gold); }

.problem-dialog { box-sizing: border-box; width: min(920px, calc(100vw - 64px)); max-height: calc(100vh - 32px); overflow-y: auto; padding: 27px 30px 21px; border: 1px solid #846642; color: #f0e4c9; background: #352b22; box-shadow: 0 25px 90px #0e0c09c9; }
.problem-dialog::backdrop { background: #14110ed9; backdrop-filter: blur(3px); }
.dialog-top { display: flex; align-items: center; justify-content: space-between; }
.dialog-badge { color: var(--gold); font-size: 9px; }
.dialog-close { width: 34px; height: 34px; border: 1px solid #66513b; color: #d9c8a9; background: transparent; cursor: pointer; font-size: 23px; line-height: 1; }
.dialog-close:hover, .dialog-close:focus-visible { color: #fff; background: #4a3b2c; outline-color: var(--gold); }
.dialog-location { margin: 27px 0 8px; color: #b3996b; font: 10px "DM Mono", monospace; letter-spacing: 1.3px; text-transform: uppercase; }
.problem-dialog h2 { margin: 0 0 18px; color: #f4e8d0; font: 27px "Rye", serif; }
.dialog-problem { color: #d7c9b2; font-size: 15px; line-height: 1.75; }
.dialog-problem p { margin: 0 0 13px; }
.dialog-problem strong { color: #f1d291; }
.dialog-problem .katex-display { overflow-x: auto; overflow-y: hidden; padding: 5px 0; color: #f1d291; }
.countdown { margin: 25px 0 10px; padding: 20px; border: 1px solid #66513b; text-align: center; }
.countdown p { margin: 0 0 13px; color: #b3996b; font-size: 13px; }
.countdown-value { display: block; color: #f1d291; font: 25px "DM Mono", monospace; font-variant-numeric: tabular-nums; }
.publish-time { display: block; margin-top: 12px; color: #a7957b; font-size: 12px; }
.dialog-bottom { display: flex; justify-content: space-between; gap: 12px; margin-top: 25px; padding-top: 15px; border-top: 1px solid #554638; color: #8e7c64; font-size: 8px; }
.difficulty { color: #d2ad71; }
.problem-dialog [hidden], .account-dialog [hidden], .admin-dialog [hidden], .problem-editor-dialog [hidden] { display: none !important; }
.problem-edit-link { display: inline-block; margin: 0 0 18px; text-decoration: none; }
.submission-panel { margin-top: 21px; padding: 16px; border: 1px solid #66513b; }
.submission-panel h3, .admin-dialog h3 { margin: 0 0 8px; color: #e8d5b2; font: 16px "Rye", serif; }
.submission-panel p, .admin-dialog p { color: #aa9b85; font-size: 13px; line-height: 1.5; }
.submission-panel summary, .password-section summary { color: #e8d5b2; cursor: pointer; font: 16px "Rye", serif; }
.submission-panel summary:focus-visible, .password-section summary:focus-visible { outline: 1px solid var(--gold); outline-offset: 4px; }
.player-submission-status { margin-top: 21px; padding: 16px; border: 1px solid #66513b; }
.player-submission-status h3 { margin: 0 0 10px; color: #e8d5b2; font: 16px "Rye", serif; }
.player-submission-status p { color: #cabb9f; font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.player-submission-status p:last-child { margin-bottom: 0; }
.player-submission-status strong { color: #f1d291; }
.player-submission-row { display: grid; grid-template-columns: minmax(140px, 1fr) minmax(0, 2fr); gap: 12px; }
.submission-panel form, .auth-form, .admin-dialog form, #admin-promotion-form { display: grid; gap: 9px; }
.submission-panel label, .account-dialog label, .admin-dialog label { color: #cabb9f; font: 10px "DM Mono", monospace; }
.submission-panel input, .account-dialog input, .account-dialog select, .admin-dialog input, .admin-dialog textarea, .admin-dialog select, .admin-dialog > section > select {
  width: 100%;
  min-height: 36px;
  padding: 8px;
  border: 1px solid #66513b;
  color: #f0e4c9;
  background: #28221c;
  font: 13px "DM Sans", sans-serif;
}
.submission-panel input[type="file"] { min-height: auto; font-size: 11px; }
.submission-panel input:focus-visible, .account-dialog input:focus-visible, .account-dialog select:focus-visible, .admin-dialog input:focus-visible, .admin-dialog textarea:focus-visible, .admin-dialog select:focus-visible { outline: 1px solid var(--gold); }
.submission-panel .primary-button, .account-dialog .primary-button, .admin-dialog .primary-button, .account-dialog .secondary-button, .admin-dialog .secondary-button { justify-self: start; }
.password-input { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; }
.password-input .password-toggle { min-width: 68px; }
.auth-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.auth-actions button, #request-password-reset, .profile-form button, #admin-promotion-form button, #password-update-form button { width: 100%; min-width: 0; }
.profile-section, .admin-promotion-section, .password-section { margin: 20px 0 0; padding-top: 16px; border-top: 1px solid #554638; }
.profile-section h3, .admin-promotion-section h3 { margin: 0 0 12px; color: #e8d5b2; font: 16px "Rye", serif; }
.admin-promotion-section > p { color: #aa9b85; font-size: 13px; line-height: 1.5; }
.password-section[open] summary { margin-bottom: 12px; }
.profile-form { display: grid; gap: 9px; }
.signin-prompt { color: #b3996b; font-size: 13px; }
.account-dialog, .admin-dialog, .problem-editor-dialog { width: min(620px, calc(100% - 28px)); max-height: min(780px, calc(100% - 28px)); padding: 23px; border: 1px solid #846642; color: #f0e4c9; background: #352b22; box-shadow: 0 25px 90px #0e0c09c9; }
.admin-dialog { width: min(900px, calc(100% - 28px)); }
.problem-editor-dialog { width: min(900px, calc(100% - 28px)); }
.account-dialog::backdrop, .admin-dialog::backdrop, .problem-editor-dialog::backdrop { background: #14110ed9; backdrop-filter: blur(3px); }
.account-dialog .dialog-top h2, .admin-dialog .dialog-top h2, .problem-editor-dialog .dialog-top h2 { margin: 0; color: #f4e8d0; font: 22px "Rye", serif; }
.account-dialog .dialog-top, .admin-dialog .dialog-top, .problem-editor-dialog .dialog-top { margin-bottom: 20px; }
.account-dialog .dialog-done, .admin-dialog .dialog-done { margin-top: 15px; }
.problem-editor-dialog > p { color: #aa9b85; font-size: 13px; line-height: 1.5; }
.problem-editor-dialog form { display: grid; gap: 12px; }
.problem-editor-dialog label { color: #cabb9f; font: 10px "DM Mono", monospace; }
.problem-editor-dialog input, .problem-editor-dialog select, .problem-editor-dialog textarea { width: 100%; min-height: 36px; padding: 8px; border: 1px solid #66513b; color: #f0e4c9; background: #28221c; font: 13px "DM Sans", sans-serif; }
.problem-editor-dialog textarea { min-height: 210px; resize: vertical; padding: 12px; font: 12px/1.6 "DM Mono", monospace; tab-size: 2; }
.problem-editor-dialog textarea:focus-visible { outline: 1px solid var(--gold); }
.problem-editor-dialog input:focus-visible, .problem-editor-dialog select:focus-visible { outline: 1px solid var(--gold); }
.problem-editor-dialog fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.problem-editor-dialog #problem-editor-fields > * + * { margin-top: 12px; }
.problem-editor-dialog fieldset:disabled { opacity: .7; }
.problem-editor-file-row, .problem-editor-schedule-fields, .problem-editor-statement { display: grid; gap: 7px; }
.problem-editor-section-toggles { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.problem-editor-section-toggles label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.problem-editor-section-toggles input { width: 15px; min-height: 15px; margin: 0; accent-color: var(--gold); }
.problem-editor-localized, .problem-editor-schedule, .problem-editor-statements, .problem-editor-solution-types { margin: 0; padding: 13px !important; border: 1px solid #554638 !important; }
.problem-editor-localized legend, .problem-editor-schedule legend, .problem-editor-statements legend, .problem-editor-solution-types legend { padding: 0 6px; color: #e8d5b2; font: 14px "Rye", serif; }
.problem-editor-solution-types > p { margin: 3px 0 10px; color: #aa9b85; font-size: 11px; line-height: 1.5; }
.problem-editor-solution-type-list { display: grid; gap: 7px; }
.problem-editor-solution-type-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 8px; }
.problem-editor-solution-type-row input[type="checkbox"] { width: 18px; min-height: 18px; accent-color: var(--gold); }
.problem-editor-solution-type-row label { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.problem-editor-solution-type-row button { min-height: 32px; padding: 5px 8px; }
.problem-editor-solution-type-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.problem-editor-solution-types .status-message { margin: 5px 0 0; }
.problem-editor-statement + .problem-editor-statement { margin-top: 10px; padding-top: 12px; border-top: 1px solid #554638; }
.problem-editor-localized-grid { display: grid; grid-template-columns: minmax(100px, .7fr) repeat(3, minmax(0, 1fr)); align-items: center; gap: 8px; }
.problem-editor-localized-grid > strong { color: #d7ae69; font: 10px "DM Mono", monospace; text-align: center; }
.problem-editor-localized-grid > label { font-size: 9px; }
.problem-editor-schedule-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; gap: 12px; }
.problem-editor-schedule-fields > div { display: grid; gap: 7px; }
.problem-editor-position { display: grid; gap: 5px; margin-top: 12px; padding-top: 10px; border-top: 1px solid #554638; }
.problem-editor-position p { margin: 0; color: #aa9b85; font-size: 11px; line-height: 1.5; }
.problem-editor-position strong, .problem-editor-position span:last-child { color: #d7c9b2; }
.problem-editor-field-label { color: #cabb9f; font: 10px "DM Mono", monospace; }
.visibility-toggle { min-height: 36px; padding: 8px 12px; border: 1px solid #66513b; color: #f0e4c9; background: #493a2b; font: 11px "DM Mono", monospace; cursor: pointer; }
.visibility-toggle[aria-pressed="true"] { border-color: #8d8157; color: #c9d49b; background: #3e4430; }
.visibility-toggle[aria-pressed="false"] { color: #cabb9f; background: #3d3228; }
.latex-toolbar { display: flex; flex-wrap: wrap; gap: 4px; }
.latex-tool { min-width: 36px; min-height: 30px; padding: 4px 7px; border: 1px solid #66513b; color: #f1d291; background: #493a2b; font: 12px "DM Mono", monospace; cursor: pointer; }
.latex-tool:hover, .latex-tool:focus-visible { border-color: #b3996b; outline: none; }
.problem-editor-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.problem-editor-actions button:disabled { cursor: wait; opacity: .6; }
.status-message { min-height: 1em; color: #b4c28a; font-size: 12px; }
.status-message.is-error { color: #e39b7e; }
.admin-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 18px; padding-bottom: 10px; border-bottom: 1px solid #554638; }
.admin-tab { min-height: 38px; padding: 8px 12px; border: 1px solid transparent; color: #a7957b; background: transparent; font: 10px "DM Mono", monospace; cursor: pointer; }
.admin-tab:hover, .admin-tab:focus-visible { border-color: #66513b; color: #efd9ad; outline: none; }
.admin-tab[aria-selected="true"] { border-color: #80613d; color: #f1d291; background: #493a2b; }
.admin-view { margin: 18px 0 25px; }
.admin-view > h3 { margin-bottom: 12px; color: #e8d5b2; font: 16px "Rye", serif; }
.admin-filters { display: grid; grid-template-columns: auto minmax(100px, 1fr) auto minmax(100px, 1fr) auto minmax(100px, 1fr); align-items: center; gap: 8px 12px; margin: 14px 0; }
.admin-filters label { color: #cabb9f; font: 10px "DM Mono", monospace; }
.admin-challenge-links { display: grid; gap: 16px; }
.admin-challenge-group { margin: 18px 0 0; padding: 13px; border: 1px solid #554638; }
.admin-challenge-group > h4 { width: fit-content; margin: -23px 0 10px -6px; padding: 0 6px; color: #e8d5b2; background: #352b22; font: 14px "Rye", serif; }
.admin-challenge-group-items { display: grid; gap: 8px; }
.admin-challenge-item { display: grid; grid-template-columns: minmax(0, 1fr); gap: 7px; padding: 8px; border: 1px solid #554638; }
.admin-challenge-item > .secondary-button { display: flex; align-items: center; gap: 7px; width: 100%; min-width: 0; overflow: hidden; text-align: left; white-space: nowrap; cursor: pointer; transition: background .12s ease, box-shadow .12s ease, transform .12s ease; }
.admin-challenge-item > .secondary-button:active { background: #765936; box-shadow: inset 0 2px 4px #1c140d99; transform: translateY(1px); }
.admin-challenge-item > .secondary-button:focus { outline: 1px solid var(--gold); outline-offset: 2px; }
.admin-challenge-order { flex: 0 0 2.5ch; color: var(--gold); font-variant-numeric: tabular-nums; text-align: right; }
.admin-challenge-item > .secondary-button > span:last-child { overflow: hidden; text-overflow: ellipsis; }
.admin-challenge-item > .secondary-button.is-hidden-problem { color: #8e7c64; }
.admin-challenge-controls { display: grid; grid-template-columns: minmax(180px, 1fr) auto auto; align-items: center; gap: 8px; }
.admin-challenge-controls input { width: 100%; min-width: 0; }
.admin-challenge-controls .visibility-toggle { white-space: nowrap; }
.admin-challenge-item [data-save-schedule] { justify-self: start; }
.admin-challenge-item .admin-challenge-save-status { grid-column: 1 / -1; }
.admin-challenge-save-status { grid-column: 1 / -1; margin: 0; color: #b4c28a; font-size: 11px; }
.admin-challenge-save-status.is-error { color: #e39b7e; }
.admin-challenge-save-status a { margin-left: 5px; color: #e0bd7d; }
.admin-competition-schedule { min-width: 0; margin: 16px 0; padding: 13px; border: 1px solid #554638; }
.admin-competition-schedule legend { padding: 0 6px; color: #e8d5b2; font: 14px "Rye", serif; }
.admin-competition-schedule-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; align-items: end; gap: 12px; }
.admin-competition-schedule-fields > div { display: grid; gap: 7px; }
.admin-competition-schedule-fields input { width: 100%; min-width: 0; min-height: 36px; padding: 8px; border: 1px solid #66513b; color: #f0e4c9; background: #28221c; font: 13px "DM Sans", sans-serif; }
.admin-competition-schedule .status-message { margin: 8px 0 0; }
.submission-problem-group { margin: 18px 0; }
.submission-problem-group > h4 { margin: 0 0 8px; color: #d7ae69; font: 13px "DM Mono", monospace; }
.submission-problem-entries { display: grid; gap: 10px; }
.submission-card { margin: 10px 0; padding: 14px; border: 1px solid #66513b; }
.submission-card summary { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; color: #e3d3b5; cursor: pointer; }
.submission-card summary:focus-visible { outline: 1px solid var(--gold); outline-offset: 4px; }
.submission-player-category { color: #b3996b; font: 9px "DM Mono", monospace; }
.submission-card .submission-review-status { display: inline-block; margin: 0 0 0 auto; padding: 3px 7px; color: #e1bb79; background: #493a2b; font: 9px "DM Mono", monospace; }
.submission-card .submission-review-status.is-reviewed { color: #b4c28a; }
.submission-card > button, .submission-card > a, .submission-card > form { margin-top: 12px; }
.submission-card .secure-file-link { display: inline-block; margin: 10px; color: #e0bd7d; }
.review-form { margin-top: 13px; padding-top: 12px; border-top: 1px solid #554638; }
.review-form textarea { min-height: 65px; }
.admin-field { display: grid; gap: 6px; }
.admin-field--checkbox { display: flex; align-items: center; gap: 8px; }
.admin-field--checkbox input { width: auto; min-height: auto; accent-color: var(--gold); }

@media (max-width: 600px) {
  .app-shell { width: calc(100% - 28px); }
  .topbar { height: 61px; }
  .topbar-note { display: none; }
  .brand { font-size: 9px; letter-spacing: .5px; }
  .language-picker select { max-width: 90px; font-size: 9px; }
  .topbar-actions { gap: 5px; }
  .account-button { max-width: 72px; min-height: 31px; padding: 5px; font-size: 8px; }
  .topbar .brand-name { max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
  .primary-nav { gap: 4px; margin: 11px 0 14px; padding-bottom: 7px; }
  .nav-tab { min-height: 38px; padding: 7px 4px; font-size: 9px; }
  .map-toolbar { min-height: 66px; padding: 0 12px; }
  .map-heading { gap: 8px; }
  .map-pin-icon { font-size: 17px; }
  .map-heading h2 { font-size: 9px; letter-spacing: .75px; }
  .map-heading p { font-size: 10px; }
  .map-actions { gap: 6px; }
  .map-stage { min-width: 650px; }
  .app-shell.is-map-view .map-stage { min-width: 0; }
  .map-footer { padding: 0 12px; font-size: 8px; }
  .map-coordinates { font-size: 7px; letter-spacing: .6px; }
  .page-footer { font-size: 8px; letter-spacing: .6px; }
  .problem-dialog { width: calc(100vw - 24px); max-height: calc(100vh - 24px); padding: 22px 20px 18px; }
  .player-submission-row { grid-template-columns: 1fr; gap: 3px; }
  .problem-dialog h2 { font-size: 24px; }
  .dialog-problem { font-size: 14px; }
  .dialog-bottom { font-size: 7px; }
  .countdown { padding: 16px 10px; }
  .countdown-value { font-size: 20px; }
  .account-dialog, .admin-dialog { padding: 17px; }
  .auth-actions { grid-template-columns: 1fr; }
  .auth-actions button, #request-password-reset, .profile-form button, #password-update-form button, .account-session > .secondary-button { width: 100%; }
  .text-page, .leaderboard-page, .home-page { padding: 20px 15px; }
  .home-lore { font-size: 16px; }
  .leaderboard-controls { grid-template-columns: 1fr; gap: 9px; }
  .rules-list li { padding: 14px 12px 14px 42px; }
  .rules-list li::before { top: 14px; left: 12px; }
  .leaderboard-filter { grid-template-columns: 1fr; gap: 6px; }
  .admin-filters { grid-template-columns: 1fr; }
  .admin-filters select { width: 100%; }
  .leaderboard-table th, .leaderboard-table td { padding: 10px 8px; font-size: 11px; }
  .submission-card summary { align-items: flex-start; }
  .submission-card .submission-review-status { margin-left: 0; }
  .problem-editor-localized-grid { grid-template-columns: 1fr; }
  .problem-editor-localized-grid > :first-child { display: none; }
  .problem-editor-localized-grid > label { grid-column: 1 / -1; margin-top: 5px; }
  .problem-editor-localized-grid > strong { text-align: left; }
  .problem-editor-schedule-fields { grid-template-columns: 1fr; }
  .problem-editor-solution-type-row { grid-template-columns: minmax(0, 1fr) auto; }
  .problem-editor-solution-type-row label { grid-column: 1; grid-row: 2; }
  .problem-editor-solution-type-row button { grid-column: 2; grid-row: 1 / span 2; }
  .admin-challenge-item { gap: 6px; padding: 6px; }
  .admin-challenge-controls { grid-template-columns: minmax(0, 1fr) auto; gap: 6px; }
  .admin-challenge-controls [data-save-schedule] { grid-column: 1 / -1; }
  .admin-challenge-item > .secondary-button, .admin-challenge-item .visibility-toggle { padding: 7px; font-size: 10px; }
  .admin-competition-schedule-fields { grid-template-columns: 1fr; }
  .admin-competition-schedule-fields button { width: 100%; }
}

@media (max-width: 360px) {
  .topbar .brand-name { max-width: 100px; }
  .map-toolbar { padding: 0 8px; }
  .map-pin-icon { display: none; }
  .map-heading { gap: 5px; }
  .map-heading h2 { font-size: 8px; }
  .map-actions { gap: 4px; }
  .zoom-button { width: 26px; height: 26px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
