/* ============================================================
   MEEPLE MENAGERIE — Art Deco design system
   Deep black-green lacquer, champagne gold linework, cream type.
   Display: Limelight. Body: Josefin Sans. No external requests.
   ============================================================ */

@font-face {
  font-family: "Limelight";
  src: url("../assets/fonts/limelight-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Josefin Sans";
  src: url("../assets/fonts/josefin-sans-var.woff2") format("woff2");
  font-weight: 100 700; /* variable font */
  font-display: swap;
}

:root {
  --ink: #0a1410;
  --ink-2: #0e1a15;
  --panel: #10201a;
  --panel-2: #142720;
  --line: #23392f;
  --gold: #c8a55e;
  --gold-bright: #ecd193;
  --gold-dim: #86714a;
  --cream: #f0e7d1;
  --cream-dim: #b9ae94;
  --bordeaux: #b0554a;
  --verdigris: #6fae9b;
  --danger: #c76a5e;
  --display: "Limelight", "Georgia", serif;
  --body: "Josefin Sans", "Trebuchet MS", sans-serif;
  --frame: 1px solid var(--gold-dim);
  --radius: 2px;
  --nav-h: 62px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { height: 100%; }

body {
  min-height: 100%;
  background:
    /* faint deco fan rows */
    radial-gradient(circle at 50% 115%, rgba(200, 165, 94, 0.05) 0 18%, transparent 19%),
    repeating-radial-gradient(circle at 50% -60vh,
      transparent 0 68px,
      rgba(200, 165, 94, 0.028) 68px 70px),
    linear-gradient(180deg, #0d1a14 0%, var(--ink) 45%);
  background-attachment: fixed;
  color: var(--cream);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--gold); color: var(--ink); }

/* ---------------------------------------------------------- type */

h1, h2, h3 { font-weight: 400; }

.display {
  font-family: var(--display);
  letter-spacing: 0.08em;
  color: var(--gold-bright);
  text-transform: uppercase;
}

.label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--gold);
  font-weight: 600;
}

.muted { color: var(--cream-dim); }

a { color: var(--gold-bright); text-decoration: none; }

/* ---------------------------------------------------------- ornaments */

/* gold double rule with a centred diamond */
.deco-rule {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 0.8rem 0;
  color: var(--gold);
}
.deco-rule::before,
.deco-rule::after {
  content: "";
  flex: 1;
  height: 3px;
  border-top: 1px solid var(--gold-dim);
  border-bottom: 1px solid var(--gold-dim);
}
.deco-rule .gem {
  width: 7px;
  height: 7px;
  background: var(--gold);
  transform: rotate(45deg);
  box-shadow: 0 0 8px rgba(200, 165, 94, 0.6);
}

/* stepped ziggurat frame for panels */
.frame {
  position: relative;
  border: var(--frame);
  background:
    linear-gradient(160deg, rgba(236, 209, 147, 0.05), transparent 40%),
    var(--panel);
  padding: 1.2rem;
}
.frame::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(200, 165, 94, 0.28);
  pointer-events: none;
}
.frame > * { position: relative; }

.sunburst {
  position: relative;
  isolation: isolate;
}
.sunburst::before {
  content: "";
  position: absolute;
  inset: -60% -30%;
  background:
    repeating-conic-gradient(from -90deg at 50% 78%,
      rgba(200, 165, 94, 0.12) 0deg 2.4deg,
      transparent 2.4deg 9deg);
  -webkit-mask-image: radial-gradient(ellipse at 50% 78%, #000 0%, transparent 62%);
  mask-image: radial-gradient(ellipse at 50% 78%, #000 0%, transparent 62%);
  z-index: -1;
  pointer-events: none;
}

/* ---------------------------------------------------------- shell */

#app {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 1rem calc(var(--nav-h) + 2.5rem);
}

header.masthead {
  text-align: center;
  padding: 1.4rem 0 0.4rem;
}
header.masthead .wordmark {
  font-family: var(--display);
  font-size: clamp(1.35rem, 5.5vw, 2rem);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-bright);
  text-shadow: 0 0 22px rgba(200, 165, 94, 0.35);
}
header.masthead .wordmark a { color: inherit; }

/* bottom navigation — arched deco tabs */
nav.tabs {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 40;
  display: flex;
  justify-content: center;
  gap: 0;
  height: var(--nav-h);
  background: linear-gradient(180deg, #12211b, #0b1511);
  border-top: 1px solid var(--gold-dim);
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.55);
  padding-bottom: env(safe-area-inset-bottom);
}
nav.tabs::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 0;
  right: 0;
  border-top: 1px solid rgba(200, 165, 94, 0.3);
}
nav.tabs a {
  flex: 1;
  max-width: 130px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--cream-dim);
  border-top: 2px solid transparent;
}
nav.tabs a svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.3; }
nav.tabs a.active {
  color: var(--gold-bright);
  border-top-color: var(--gold);
  background: linear-gradient(180deg, rgba(200, 165, 94, 0.09), transparent);
}

main { animation: rise 0.35s ease both; }
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* ---------------------------------------------------------- controls */

input, select, textarea, button {
  font-family: var(--body);
  font-size: 1rem;
  color: var(--cream);
}

.field { margin-bottom: 0.9rem; }
.field label {
  display: block;
  margin-bottom: 0.25rem;
}
.field label .label { display: inline; }

input[type="text"], input[type="search"], input[type="number"],
input[type="email"], input[type="password"], select, textarea {
  width: 100%;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.6rem 0.7rem 0.5rem;
  outline: none;
  transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--gold); }
input::placeholder { color: #7d755f; }

select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--gold) 50%), linear-gradient(135deg, var(--gold) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 2rem; }

button {
  cursor: pointer;
  background: none;
  border: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.62rem 1.15rem 0.5rem;
  border: 1px solid var(--gold-dim);
  color: var(--gold-bright);
  background: linear-gradient(180deg, rgba(200, 165, 94, 0.12), rgba(200, 165, 94, 0.03));
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: var(--radius);
  transition: all 0.15s;
}
.btn:hover { border-color: var(--gold); box-shadow: 0 0 14px rgba(200, 165, 94, 0.25); }
.btn.primary {
  background: linear-gradient(180deg, var(--gold-bright), var(--gold) 55%, #a9863f);
  color: #241b08;
  border-color: var(--gold);
}
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { border-color: var(--line); color: var(--cream-dim); background: none; }
.btn.ghost:hover { border-color: var(--gold-dim); color: var(--cream); }
.btn.danger { border-color: #6e3730; color: var(--danger); background: none; }
.btn.small { padding: 0.4rem 0.7rem 0.3rem; font-size: 0.64rem; }
.btn:disabled { opacity: 0.45; cursor: default; box-shadow: none; }

.btn-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.8rem; }

/* chips */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.32rem 0.6rem 0.22rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--cream-dim);
  background: rgba(16, 32, 26, 0.7);
  cursor: pointer;
  transition: all 0.12s;
  user-select: none;
}
.chip:hover { border-color: var(--gold-dim); color: var(--cream); }
.chip.on {
  border-color: var(--gold);
  color: var(--ink);
  background: var(--gold);
  font-weight: 600;
}
.chip-row { display: flex; flex-wrap: wrap; gap: 0.4rem; }

/* status gems */
.status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 600;
}
.status::before {
  content: "";
  width: 8px;
  height: 8px;
  transform: rotate(45deg);
  background: currentColor;
}
.status.paa-plads { color: var(--verdigris); }
.status.udlaant { color: var(--bordeaux); }
.status.laant { color: #c9b06a; }
.status.paa-vej { color: #b0bfd4; }
.status.givet-vaek, .status.solgt, .status.returneret { color: #837a66; }

/* ---------------------------------------------------------- stat band */

/* Live "collection profile" — figures + a complexity skyline that re-shapes
   to whatever set is currently shown. Sits between the rule and the search. */
.stat-band {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0.2rem 0 0.5rem;
  padding: 0.5rem 0.95rem 0.45rem;
  border: 1px solid var(--gold-dim);
  background:
    linear-gradient(160deg, rgba(236, 209, 147, 0.05), transparent 45%),
    var(--panel);
}
.stat-band::before {
  content: "";
  position: absolute;
  inset: 3px;
  border: 1px solid rgba(200, 165, 94, 0.18);
  pointer-events: none;
}
.stat-band > * { position: relative; }

.sb-figures { display: flex; gap: 1.15rem; }
.sb-fig { line-height: 1.05; }
.sb-fig b {
  display: block;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--gold-bright);
  letter-spacing: 0.03em;
  font-variant-numeric: tabular-nums;
}
.sb-fig span {
  display: block;
  margin-top: 3px;
  font-size: 0.54rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--cream-dim);
  white-space: nowrap;
}

.sb-chart { display: flex; flex-direction: column; gap: 3px; flex: none; }
.sb-bars { display: flex; align-items: flex-end; gap: 4px; height: 32px; }
/* Bars are full-height boxes scaled from the baseline; animating transform
   (not height) keeps them out of flex reflow and gives a smoother morph. */
.sb-bar {
  width: 13px;
  height: 32px;
  transform: scaleY(0);
  transform-origin: bottom;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold) 60%, #a9863f);
  border-top: 1px solid var(--gold-bright);
  box-shadow: 0 0 6px rgba(200, 165, 94, 0.22);
  transition: transform 0.45s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.sb-bar.empty {
  background: var(--line);
  border-top-color: var(--gold-dim);
  box-shadow: none;
}
.sb-axis {
  display: flex;
  justify-content: space-between;
  font-size: 0.5rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cream-dim);
}
@media (prefers-reduced-motion: reduce) { .sb-bar { transition: none; } }
@media (max-width: 400px) {
  .stat-band { padding: 0.45rem 0.7rem; gap: 0.7rem; }
  .sb-figures { gap: 0.8rem; }
  .sb-fig b { font-size: 1.05rem; }
  .sb-fig span { font-size: 0.5rem; letter-spacing: 0.08em; }
  .sb-bar { width: 11px; }
}

/* ---------------------------------------------------------- game list */

.toolbar { margin: 0.6rem 0 1rem; }
.toolbar .search-row { display: flex; gap: 0.5rem; }
.toolbar .search-row input { flex: 1; }

.filters {
  margin-top: 0.7rem;
  display: none;
}
.filters.open { display: block; }
.filters .grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.7rem;
  align-items: end; /* inputs stay on one line even if a label wraps */
}
.filters .grid .field { margin-bottom: 0; }

.count-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 0.9rem 0 0.4rem;
}

ul.games { list-style: none; }
ul.games li.game-row {
  display: block;
  border-bottom: 1px solid var(--line);
  animation: rise 0.3s ease both;
}
ul.games li.game-row > a {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.75rem 0.2rem 0.65rem;
  color: var(--cream);
  transition: background 0.12s;
}
ul.games li.game-row > a:hover { background: rgba(200, 165, 94, 0.05); }
.game-row .bullet {
  width: 7px;
  height: 7px;
  background: var(--gold-dim);
  transform: rotate(45deg) translateY(-1px);
}
.game-row .title { font-weight: 600; letter-spacing: 0.02em; }
.game-row .title small {
  display: block;
  font-weight: 400;
  font-size: 0.72rem;
  color: var(--cream-dim);
  letter-spacing: 0.05em;
}
.game-row .aside {
  text-align: right;
  font-size: 0.72rem;
  color: var(--cream-dim);
  white-space: nowrap;
}
.game-row .aside .rating { color: var(--gold-bright); font-weight: 600; letter-spacing: 0.05em; }

.empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--cream-dim);
}
.empty .display { font-size: 1.1rem; margin-top: 0.8rem; }

/* ---------------------------------------------------------- detail */

.detail-head { text-align: center; padding-top: 0.6rem; }
.detail-head h1 {
  font-family: var(--display);
  font-size: clamp(1.5rem, 6vw, 2.3rem);
  letter-spacing: 0.06em;
  color: var(--gold-bright);
  line-height: 1.15;
  margin: 0.4rem 0;
}
.detail-head .label { display: inline-block; }

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  margin: 1.1rem 0;
}
.facts .fact {
  background: var(--panel);
  text-align: center;
  padding: 0.7rem 0.3rem 0.55rem;
}
.facts .fact b {
  display: block;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--gold-bright);
  letter-spacing: 0.04em;
}
.facts .fact span {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--cream-dim);
}

.kv { margin: 0.9rem 0; }
.kv dt { float: left; clear: left; width: 7.2rem; }
.kv dd { margin-left: 7.8rem; margin-bottom: 0.3rem; }

.copies { margin-top: 0.4rem; }
.copy-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 0.7rem 0.8rem;
  margin-bottom: 0.6rem;
}
.copy-card .who { font-size: 0.85rem; color: var(--cream); }
.copy-card .note { flex-basis: 100%; font-size: 0.75rem; color: var(--cream-dim); }
.copy-card .spacer { flex: 1; }
.copy-card .actions { display: flex; flex-wrap: wrap; gap: 0.4rem; }

/* ---------------------------------------------------------- udlån view */

.person-block { margin-bottom: 1.6rem; }
.person-block h2 {
  font-family: var(--display);
  font-size: 1.15rem;
  letter-spacing: 0.1em;
  color: var(--gold-bright);
  text-transform: uppercase;
}

/* ---------------------------------------------------------- dialogs */

dialog {
  border: 1px solid var(--gold-dim);
  background: var(--panel);
  color: var(--cream);
  padding: 0;
  width: min(92vw, 420px);
  margin: auto;
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.7);
}
dialog::backdrop { background: rgba(4, 8, 6, 0.72); backdrop-filter: blur(3px); }
dialog .dlg-inner { padding: 1.2rem 1.2rem 1.1rem; }
dialog .dlg-inner::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(200, 165, 94, 0.25);
  pointer-events: none;
}
dialog h2 {
  font-family: var(--display);
  font-size: 1.05rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-bright);
  text-align: center;
  margin-bottom: 0.9rem;
}

/* toast */
#toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h) + 16px);
  transform: translateX(-50%) translateY(20px);
  background: var(--gold);
  color: #241b08;
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  padding: 0.6rem 1.2rem 0.5rem;
  border-radius: 2px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s;
  z-index: 60;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}
#toast.show { opacity: 1; transform: translateX(-50%); }

/* ---------------------------------------------------------- login */

.login-stage {
  min-height: 92vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1rem;
}
.login-stage .monogram { margin-bottom: 1rem; }
.login-stage .monogram svg { width: 92px; height: 92px; }
.login-stage h1 {
  font-family: var(--display);
  font-size: clamp(2rem, 9vw, 3.2rem);
  line-height: 1.05;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-bright);
  text-shadow: 0 0 34px rgba(200, 165, 94, 0.4);
}
.login-stage .tagline {
  margin: 0.5rem 0 1.6rem;
  color: var(--cream-dim);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  font-size: 0.68rem;
}
.login-card { width: min(92vw, 360px); text-align: left; }
.login-error { color: var(--danger); font-size: 0.8rem; margin-bottom: 0.6rem; }

/* ---------------------------------------------------------- forms */

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 0.8rem;
}
.form-grid .wide { grid-column: 1 / -1; }

.checkline {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0.4rem 0 0.9rem;
  cursor: pointer;
}
.checkline input { width: auto; accent-color: var(--gold); }

@media (min-width: 700px) {
  body { font-size: 17px; }
  nav.tabs a { font-size: 0.66rem; }
}
