:root {
  color-scheme: light;
  --ink: #2d251c;
  --muted: #5c5344;
  --parchment: #eee5ca;
  --parchment-light: #faf3dd;
  --parchment-deep: #d8caa8;
  --line: #a8956c;
  --gold: #b99a4c;
  --gold-light: #e4cf85;
  --pine: #273b31;
  --pine-dark: #18261f;
  --red: #7a2e24;
  font-family: Verdana, Geneva, Tahoma, sans-serif;
  font-size: 14px;
}

* { box-sizing: border-box; }

html { min-width: 320px; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 15%, #394d3c55 0, transparent 34%),
    radial-gradient(circle at 85% 70%, #6d563744 0, transparent 38%),
    repeating-linear-gradient(135deg, #222922 0, #222922 3px, #202620 3px, #202620 6px);
  line-height: 1.5;
}

button, input, select, textarea { font: inherit; }

a { color: #284b55; }
a:hover { color: #153541; }

a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible {
  outline: 3px solid #2b7185;
  outline-offset: 2px;
}

.site-shell {
  width: min(100% - 32px, 1240px);
  margin: 26px auto;
  border: 1px solid #cbb979;
  box-shadow: 0 0 0 5px #15251d, 0 18px 52px #080d0acc;
  background: var(--parchment-deep);
}

.masthead {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 154px;
  padding: 28px 34px;
  color: #f8edc9;
  border-bottom: 5px ridge #ba9b54;
  background:
    radial-gradient(ellipse at 50% 105%, #85734766 0, transparent 57%),
    repeating-linear-gradient(90deg, #ffffff09 0, #ffffff09 1px, transparent 1px, transparent 14px),
    linear-gradient(150deg, #304b3a, #1a2c25 58%, #111e1a);
}

.masthead::before, .masthead::after {
  content: '';
  position: absolute;
  inset: 9px;
  pointer-events: none;
  border: 1px solid #e6d49545;
}

.masthead::after {
  inset: 14px;
  border-color: #090f0e80;
}

.masthead-logo {
  position: relative;
  z-index: 1;
  display: block;
  color: #f5df99;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(38px, 5.5vw, 72px);
  font-weight: bold;
  line-height: 1;
  letter-spacing: .045em;
  text-decoration: none;
  text-shadow: 0 2px #35240e, 2px 4px #090e0c, 0 0 23px #ddc47866;
}

.masthead-logo:hover { color: #fff0ad; }

.masthead-subtitle {
  position: relative;
  z-index: 1;
  margin: 8px 0 0 4px;
  color: #e4d6a8;
  font-size: 11px;
  font-weight: bold;
  letter-spacing: .24em;
  text-transform: uppercase;
}

.top-links {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.top-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 7px 12px;
  color: #f7eac5;
  border: 1px solid #ae9d69;
  background: #13231dcc;
  font-size: 12px;
  font-weight: bold;
  text-decoration: none;
}

.top-links a:hover { background: #385b44; }

.layout {
  display: grid;
  grid-template-columns: minmax(188px, 218px) minmax(0, 1fr) minmax(188px, 218px);
  align-items: start;
  gap: 15px;
  padding: 16px;
  background:
    repeating-linear-gradient(0deg, #8c795810 0, #8c795810 1px, transparent 1px, transparent 5px),
    linear-gradient(110deg, #d7c7a5, #e8dcbf 48%, #d4c39e);
}

.side-panel, .main-panel { min-width: 0; }

.panel {
  overflow: hidden;
  margin: 0 0 15px;
  border: 1px solid #9d8863;
  box-shadow: 1px 2px 0 #7c674a70, inset 0 1px #fff9;
  background: var(--parchment);
}

.panel > :not(.panel-title) { margin-left: 15px; margin-right: 15px; }
.panel > :last-child { margin-bottom: 16px; }

.panel-title {
  margin: 0 0 13px;
  padding: 8px 14px;
  color: #f7e8b8;
  border-bottom: 2px solid #9b7d41;
  background: linear-gradient(#415645, #23392d 55%, #1b2f25);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 18px;
  font-weight: bold;
  line-height: 1.25;
  text-shadow: 0 1px #0f1c14;
}

.panel p { margin-top: 0; }
.panel p:last-child { margin-bottom: 16px; }

.menu-list {
  display: grid;
  gap: 5px;
  margin: 0 10px 12px;
  padding: 0;
  list-style: none;
}

.panel > .menu-list { margin-left: 10px; margin-right: 10px; }

.menu-link {
  display: flex;
  align-items: center;
  min-height: 38px;
  padding: 7px 11px;
  color: #2b3528;
  border: 1px solid #bbae8c;
  background: linear-gradient(#fff8e7, #e1d2ae);
  font-size: 12px;
  font-weight: bold;
  text-decoration: none;
}

.menu-link:hover, .menu-link[aria-current='page'] {
  color: #f7e8b8;
  border-color: #856f41;
  background: linear-gradient(#4d674d, #263b2e);
}

.status-list {
  display: grid;
  gap: 6px;
  margin: 0 14px 15px;
  padding: 0;
  list-style: none;
  font-size: 12px;
}

.panel > .status-list { margin-left: 14px; margin-right: 14px; }
.status-list li { padding-bottom: 5px; border-bottom: 1px solid #cfc09e; }
.status-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.status-list strong { color: #25452e; }

.hero {
  position: relative;
  margin-bottom: 15px;
  overflow: hidden;
  padding: clamp(25px, 4vw, 44px);
  border: 1px solid #9e8d65;
  box-shadow: inset 0 0 0 5px #f2e6c4, 1px 2px 0 #7c674a70;
  background:
    radial-gradient(circle at 85% 15%, #fff8d6 0, transparent 35%),
    linear-gradient(145deg, #f8efd3, #dfcfa8);
}

.hero::after {
  content: '';
  position: absolute;
  width: 190px;
  height: 190px;
  right: -75px;
  bottom: -90px;
  border: 18px double #b49a6533;
  border-radius: 50%;
  pointer-events: none;
}

.hero-title {
  position: relative;
  z-index: 1;
  max-width: 700px;
  margin: 0 0 14px;
  color: #2e3628;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(29px, 4vw, 44px);
  line-height: 1.13;
}

.hero-copy {
  position: relative;
  z-index: 1;
  max-width: 660px;
  margin: 0 0 22px;
  color: #4b4637;
  font-size: 14px;
  line-height: 1.65;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 9px 16px;
  border: 1px solid #856a38;
  border-radius: 2px;
  box-shadow: inset 0 1px #fff9, 0 2px 0 #88734d88;
  cursor: pointer;
  font-size: 12px;
  font-weight: bold;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  transition: filter .15s ease, transform .15s ease;
}

.button:hover { filter: brightness(1.08); transform: translateY(-1px); }
.button:active { transform: translateY(1px); }
.button:disabled { cursor: not-allowed; filter: grayscale(.7); opacity: .6; transform: none; }

.button-primary {
  color: #fff6d7;
  background: linear-gradient(#9e7f39, #6b4e1f);
  text-shadow: 0 1px #3d2911;
}

.button-primary:hover { color: #fff9e7; }

.button-secondary {
  color: #293d2b;
  background: linear-gradient(#fff9e6, #ddd0ac);
}

.button-secondary:hover { color: #173b26; }

.form-grid {
  display: grid;
  gap: 15px;
  max-width: 590px;
  margin-top: 18px;
}

.field { display: grid; gap: 6px; min-width: 0; }
.field-label { font-size: 12px; font-weight: bold; }

.field-input {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 9px 11px;
  color: #231e17;
  border: 1px solid #8e7d59;
  border-radius: 2px;
  background: #fffdf4;
  box-shadow: inset 1px 2px 3px #3c30171e;
  font-size: 16px;
}

.field-input:disabled { background: #e7deca; }
.field-hint { color: var(--muted); font-size: 11px; }

.alert {
  margin: 0 0 16px;
  padding: 10px 13px;
  border: 1px solid;
  font-size: 12px;
  line-height: 1.5;
}

.alert-error { color: #571c16; border-color: #b57263; background: #f6ddd4; }
.alert-success { color: #1d4b2c; border-color: #7fa275; background: #e0efd8; }

.character-list {
  display: grid;
  gap: 7px;
  margin-top: 17px;
  padding: 0;
  list-style: none;
}

.character-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  min-height: 46px;
  padding: 9px 12px;
  border: 1px solid #c1b089;
  background: #f8f0d8;
}

.character-row:nth-child(even) { background: #eee2c4; }
.character-row strong { color: #2a3d30; }

.archive-search .button { justify-self: start; }
.archive-result-details { display: grid; gap: 3px; min-width: 0; }
.archive-result-details span { color: var(--muted); font-size: 12px; }
.archive-result form { margin: 0; }

.highscores-search {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
  margin-top: 18px;
  margin-bottom: 18px;
}

.highscores-search .field { flex: 1 1 230px; }
.highscores-search .button { flex: 0 0 auto; }
.highscores-summary { color: var(--muted); font-size: 12px; }

.highscores-scroll { overflow-x: auto; }
.highscores-table { width: 100%; min-width: 560px; border-collapse: collapse; font-size: 12px; }
.highscores-table th, .highscores-table td { padding: 9px 8px; border-bottom: 1px solid #c8b995; text-align: left; }
.highscores-table thead th { color: #f7e8b8; background: #344b3a; font-weight: bold; }
.highscores-table tbody tr:nth-child(odd) { background: #f8f0d8; }
.highscores-table tbody tr:nth-child(even) { background: #eee2c4; }
.highscores-table tbody th { color: #2a3d30; font-weight: bold; }
.highscores-table .highscores-rank { width: 74px; color: #5c4b29; font-weight: bold; }

.highscores-pages {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 18px;
  font-size: 12px;
}

.highscores-pages span { color: var(--muted); }
.highscores-pages a { min-width: 42px; }
.highscores-pages .highscores-page-current {
  color: #f7e8b8;
  border-color: #856f41;
  background: linear-gradient(#4d674d, #263b2e);
}

.footer {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px 16px;
  padding: 13px 18px;
  color: #d4cba9;
  border-top: 3px ridge #ad935c;
  background: #1c2b23;
  font-size: 11px;
  text-align: center;
}

.footer a { color: #f0d89c; }

@media (max-width: 1000px) {
  .layout { grid-template-columns: 180px minmax(0, 1fr); }
  .layout > .side-panel:last-child { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
  .site-shell { width: 100%; margin: 0; border-left: 0; border-right: 0; box-shadow: none; }
  .masthead { min-height: 0; flex-direction: column; align-items: flex-start; gap: 18px; padding: 25px 20px; }
  .masthead-logo { font-size: clamp(36px, 10vw, 56px); }
  .masthead-subtitle { font-size: 10px; letter-spacing: .15em; }
  .top-links { justify-content: flex-start; width: 100%; }
  .top-links a { min-height: 44px; }
  .layout { display: flex; flex-direction: column; gap: 12px; padding: 12px; }
  .main-panel, .side-panel { width: 100%; }
  .main-panel { order: 0; }
  .side-panel { order: 1; }
  .panel, .hero { margin-bottom: 12px; }
  .menu-link { min-height: 44px; }
  .status-list { font-size: 13px; }
  .button { min-height: 44px; }
}

@media (max-width: 450px) {
  .hero { padding: 25px 20px; }
  .hero-title { font-size: 29px; }
  .hero-copy { font-size: 13px; }
  .top-links a { flex: 1 1 auto; }
  .button { max-width: 100%; }
}
