/* Department of Preservation: plain records-office look. */
/* Colors taken from the Department of Preservation seal. */
:root {
  --navy: #1f3048;      /* outer ring */
  --navy-dark: #172539;
  --slate: #4a6078;     /* inner field */
  --khaki: #8b8a76;     /* rim */
  --cream: #cfcab2;     /* laurels and lettering */
  --ink: #1e2530;
  --muted: #5f6670;
  --paper: #eeede6;
  --line: #cfccbf;
  --row: #f7f6f1;
  --red: #7d2e33;       /* flag stripes */
  --green: #3c6142;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px; }
a { color: var(--navy); }
h1, h2, h3, h4 { font-family: Georgia, "Times New Roman", serif; font-weight: normal; color: var(--navy-dark); }
h3 { font-size: 26px; margin: 24px 0 8px; border-bottom: 2px solid var(--navy); padding-bottom: 4px; }
h4 { font-size: 18px; margin: 28px 0 8px; }
code { background: #ebe8e0; padding: 1px 4px; border-radius: 2px; }
pre { background: #fff; border: 1px solid var(--line); padding: 8px 10px; overflow-x: auto; white-space: pre-wrap; }

/* Header */
.top { background: var(--navy); color: #fff; border-bottom: 3px solid var(--khaki); }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; padding-bottom: 10px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.seal {
  width: 42px; height: 42px; border-radius: 50%;
  border: 2px solid var(--khaki); color: var(--cream);
  display: flex; align-items: center; justify-content: center;
  font: bold 13px Georgia, serif; letter-spacing: .5px;
}
.logo { width: 52px; height: 52px; object-fit: contain; }
.logo-big { display: block; width: 120px; height: 120px; object-fit: contain; margin: 0 auto 8px; }
.brand-text { font: 20px Georgia, serif; line-height: 1.15; }
.brand-text small { display: block; font: 12px system-ui, sans-serif; color: #b9c4d1; letter-spacing: .3px; }
.who { display: flex; align-items: center; gap: 10px; font-size: 14px; color: #dbe2ec; }
.tag { background: var(--cream); color: var(--navy-dark); font-size: 12px; padding: 1px 6px; border-radius: 2px; }
.nav { display: flex; flex-wrap: wrap; gap: 2px; padding-bottom: 0; }
.nav a { color: #dbe2ec; text-decoration: none; padding: 7px 10px; font-size: 14px; border-radius: 3px 3px 0 0; }
.nav a:hover { color: #fff; background: rgba(255,255,255,.08); }
.nav a.active { background: var(--paper); color: var(--navy-dark); }
.nav .sep { width: 1px; background: rgba(255,255,255,.25); margin: 6px 6px; }

main { padding-bottom: 32px; }
.foot { color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); padding-top: 10px; padding-bottom: 24px; }

/* Messages */
.note { padding: 8px 12px; border: 1px solid; border-left-width: 4px; background: #fff; margin: 16px 0 0; }
.note.ok { border-color: #b9d3bd; border-left-color: var(--green); color: var(--green); }
.note.err { border-color: #e2bcbc; border-left-color: var(--red); color: var(--red); }
.err { color: var(--red); }
.ok { color: var(--green); }
.preview { background: var(--cream); color: var(--navy-dark); text-align: center; font-size: 14px; padding: 6px 12px;
  border-bottom: 1px solid var(--khaki); }
.preview button { margin-left: 8px; padding: 2px 10px; font-size: 13px; }
.view-as select { padding: 1px 4px; font-size: 12px; background: var(--navy-dark); color: #dbe2ec; border-color: #4a5c74; }
.dev { background: #f3e19a; color: #4a3d00; text-align: center; font-size: 13px; padding: 4px; }

/* Tables */
table { border-collapse: collapse; background: #fff; border: 1px solid var(--line); margin: 8px 0; max-width: 100%; }
th, td { padding: 7px 10px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
th { background: #e9e5db; font-weight: 600; font-size: 13px; color: #3a3a3a; }
tr:nth-child(even) td { background: var(--row); }
td form { margin: 0; }

/* Forms */
input, select, textarea, button { font: inherit; }
input, select, textarea {
  padding: 5px 8px; border: 1px solid #b9b4a8; border-radius: 3px; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid #9fb3cf; outline-offset: 0; border-color: var(--navy); }
textarea { width: 100%; max-width: 640px; }
button {
  padding: 5px 14px; border: 1px solid var(--navy-dark); border-radius: 3px;
  background: var(--navy); color: #fff; cursor: pointer;
}
button:hover { background: var(--navy-dark); }
button.danger { background: #fff; color: var(--red); border-color: #c99; }
button.danger:hover { background: #f7eaea; }
button.link { background: none; border: none; color: #dbe2ec; text-decoration: underline; padding: 0; }
form.inline { display: inline; }
form.stack label { font-size: 13px; color: #444; }
form.stack select, form.stack input:not([type=hidden]) { margin-top: 2px; }
th.num, td.num { text-align: right; white-space: nowrap; }
form p { margin: 8px 0; }

/* Profile tabs */
.tabs { display: flex; flex-wrap: wrap; gap: 0; border-bottom: 2px solid var(--navy); margin: 18px 0 12px; }
.tab { padding: 6px 14px; text-decoration: none; border: 1px solid transparent; border-bottom: none;
  border-radius: 3px 3px 0 0; margin-bottom: -2px; white-space: nowrap; }
.tab:hover { background: #fff; }
.tab.on { background: #fff; border-color: var(--line); border-bottom: 2px solid #fff; color: var(--navy-dark); font-weight: 600; }

/* Characters directory */
table.wide { display: table; width: 100%; }
td.nowrap { white-space: nowrap; }
.tier { display: inline-block; min-width: 2.2em; text-align: center; font-size: 11px; font-weight: 600;
  color: var(--navy); border: 1px solid #b9c3d3; border-radius: 2px; padding: 0 3px; margin-right: 2px; }
th a { color: inherit; }
.rbx { color: var(--muted); font-size: 13px; }
.rbx::before { content: "Roblox: "; }
.rbx a { color: var(--muted); }
.small-note { font-size: 13px; margin-top: 0; }
form.search { margin: 4px 0 6px; }
h4 a.small { font: 13px system-ui, sans-serif; margin-left: 10px; }

/* Item editor: cards that wrap instead of a wide table */
.icard { position: relative; background: #fff; border: 1px solid var(--line); padding: 10px 12px; margin: 8px 0 12px; }
.ihead { margin-bottom: 6px; }
.ifields { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-end; }
.ifields label { display: flex; flex-direction: column; font-size: 12px; color: #555; }
.ifields input { width: 100%; }
.ifields .w-sm { flex: 0 1 110px; }
.ifields .w-md { flex: 1 1 160px; }
.ifields .w-lg { flex: 2 1 220px; }
.ifields .w-full { flex: 1 1 100%; }
.ifields label.check { flex-direction: row; align-items: center; gap: 6px; font-size: 13px; padding-bottom: 6px; }
.ifields label.check input { width: auto; }
.iactions { margin-top: 8px; }
.idelete { position: absolute; right: 12px; bottom: 10px; }

/* Shop */
.cats { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 14px; }
.cat { padding: 4px 12px; border: 1px solid var(--line); background: #fff; border-radius: 3px; text-decoration: none; white-space: nowrap; }
.cat:hover { border-color: var(--navy); }
.cat.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.scroll { overflow-x: auto; }
table.shop { display: table; width: 100%; min-width: 640px; }
table.shop td.item { min-width: 240px; }
table.shop td.item a { font-weight: 600; }
table.shop .desc { color: var(--muted); font-size: 13px; margin-top: 2px; }
table.shop .num { white-space: nowrap; text-align: right; }
table.shop td.buy { white-space: nowrap; width: 1%; }
table.shop td.buy form { display: flex; gap: 6px; align-items: center; }
table.shop td.buy select { max-width: 220px; }

.box { background: #fff; border: 1px solid var(--line); padding: 20px 24px; margin-top: 32px; max-width: 520px; }
.box h3 { margin-top: 0; }
.box.center { margin-left: auto; margin-right: auto; text-align: center; }
a.btn { display: inline-block; background: var(--navy); color: #fff; padding: 8px 18px; border-radius: 3px; text-decoration: none; }
a.btn:hover { background: var(--navy-dark); }
.muted { color: var(--muted); }

/* Pages with lots of controls in a row scroll sideways on phones instead of breaking. */
table { display: block; width: fit-content; overflow-x: auto; }

@media (max-width: 600px) {
  /* Shop: one card per item on phones. */
  table.shop { min-width: 0; }
  table.shop, table.shop tbody, table.shop tr, table.shop td { display: block; width: auto; }
  table.shop tr.head { display: none; }
  table.shop tr { border-bottom: 1px solid var(--line); padding: 8px 10px; }
  table.shop td { border: none; padding: 2px 0; background: none !important; }
  table.shop td.item { min-width: 0; }
  table.shop td.num { display: inline-block; text-align: left; margin-right: 16px; }
  table.shop td.num::before { content: attr(data-label) ": "; color: var(--muted); }
  table.shop td.buy { margin-top: 6px; width: auto; }
  table.shop td.buy select { max-width: none; flex: 1; min-width: 0; }
  body { font-size: 15px; }
  .brand-text { font-size: 17px; }
  h3 { font-size: 22px; }
  input, select { max-width: 100%; }
}
