@font-face { font-family: Figtree; src: url(/fonts/Figtree-Regular.ttf); font-weight: 400; font-display: swap; }
@font-face { font-family: Figtree; src: url(/fonts/Figtree-SemiBold.ttf); font-weight: 600; font-display: swap; }
@font-face { font-family: Figtree; src: url(/fonts/Figtree-Bold.ttf); font-weight: 700; font-display: swap; }
@font-face { font-family: Bricolage; src: url(/fonts/BricolageGrotesque-Bold.ttf); font-weight: 700; font-display: swap; }

:root {
  --bg: #F8F6F1;
  --card: #ffffff;
  --sand: #F3EBDD;
  --text: #262626;
  --muted: #5C5552;
  --wine: #8A2637;
  --wine-dark: #6E1D2B;
  --rose: #B45D6A;
  --gold: #C8963E;
  --line: #E7DED3;
  --ok: #2F6B4F;
  --radius: 18px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 17px/1.5 Figtree, system-ui, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
main { max-width: 640px; margin: 0 auto; padding: 8px 16px 48px; }
body.admin main { max-width: 960px; }

h1, h2 { font-family: Bricolage, Figtree, sans-serif; font-weight: 700; color: var(--wine-dark); line-height: 1.15; }
h1 { font-size: 28px; margin: 12px 0 16px; }
h2 { font-size: 20px; margin: 0 0 12px; }
a { color: var(--wine); }

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  max-width: 960px; margin: 0 auto;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
}
body:not(.admin) .top { max-width: 640px; }
.brand img { display: block; height: 32px; width: auto; }
.nav-link { font-weight: 600; text-decoration: none; }
.admin-nav { display: flex; gap: 16px; align-items: center; font-weight: 600; }
.admin-nav a { text-decoration: none; }

.card { background: var(--card); border-radius: var(--radius); padding: 20px; margin: 0 0 16px; box-shadow: 0 1px 2px rgb(38 38 38 / .06); }
.intro { margin-top: 24px; }
.hello { margin-top: 4px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 22px; border: 0; border-radius: 999px;
  background: var(--wine); color: #fff; font: 600 16px/1 Figtree, sans-serif; cursor: pointer;
}
.btn:active { background: var(--wine-dark); }
.btn-small { min-height: 40px; padding: 0 16px; font-size: 15px; }
.btn-ghost { background: transparent; color: var(--wine); box-shadow: inset 0 0 0 1.5px var(--wine); }
.btn-ghost:active { background: var(--sand); }
.btn-danger { background: #9b2c2c; }
button.link { background: none; border: 0; padding: 0; color: var(--wine); font: inherit; font-weight: 600; cursor: pointer; }
.danger { color: #9b2c2c !important; }

.stack { display: grid; gap: 14px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.span-2 { grid-column: span 2; }
label { display: grid; gap: 6px; font-weight: 600; font-size: 15px; }
input[type=email], input[type=password], input[type=text], input:not([type]), input[type=date],
input[type=time], input[type=number], input[type=datetime-local] {
  width: 100%; min-height: 48px; padding: 10px 14px; border: 1.5px solid var(--line); border-radius: 12px;
  background: #fff; font: 400 17px Figtree, sans-serif; color: var(--text);
}
input:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.code-input { font-size: 28px !important; letter-spacing: .3em; text-align: center; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.check input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--wine); flex: none; }
.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline input { width: auto; min-height: 40px; }

.list { list-style: none; margin: 0; padding: 0; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.row strong { white-space: nowrap; }
.row.is-cancelled strong { color: var(--muted); text-decoration: line-through; }
.actions { display: flex; gap: 12px; align-items: center; }

.muted { color: var(--muted); }
.small { font-size: 14px; }
.fine { color: var(--muted); font-size: 14px; margin: 12px 0 0; }
.tag { align-self: flex-start; display: inline-block; margin-top: 4px; padding: 2px 10px; border-radius: 999px; background: var(--sand); color: var(--muted); font-size: 13px; font-weight: 600; white-space: nowrap; }
.tag-gold { background: #F6E7C8; color: #7A5718; }

.flash { padding: 12px 16px; border-radius: 12px; background: #E3F0E8; color: var(--ok); font-weight: 600; margin: 8px 0 16px; }
.flash-error { background: #F7E1E4; color: var(--wine-dark); }
.flash-warn { background: #F6E7C8; color: #7A5718; }
.hint { background: var(--sand); border-radius: var(--radius); padding: 14px 16px; margin: 0 0 16px; font-size: 15px; }
.hint p { margin: 0 0 10px; }

.credit { background: var(--wine); color: #fff; }
.credit h2 { color: #fff; margin-top: 20px; }
.credit .muted, .credit .row .muted { color: #F3DADF; }
.credit .row { border-color: rgb(255 255 255 / .2); }
.credit .btn { background: #fff; color: var(--wine-dark); }
.credit-count { margin: 0; font-size: 20px; font-weight: 600; }
.credit-count span { font-family: Bricolage, sans-serif; font-size: 40px; margin-right: 4px; }

.big-stat { margin: 0 0 12px; font-size: 18px; }
.big-stat span { font-family: Bricolage, sans-serif; font-size: 40px; color: var(--wine); margin-right: 4px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0; }
.stats div { background: var(--bg); border-radius: 12px; padding: 10px 12px; }
.stats dt { font-size: 13px; color: var(--muted); }
.stats dd { margin: 0; font-size: 22px; font-weight: 700; }

.rules { padding-left: 20px; }
.rules li { margin-bottom: 8px; }
.prose h2 { margin-top: 24px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 10px 8px; border-top: 1px solid var(--line); vertical-align: top; }
th { font-size: 13px; color: var(--muted); font-weight: 600; border-top: 0; }
details { margin-top: 16px; }
summary { cursor: pointer; font-weight: 600; color: var(--wine); }
details .grid { margin-top: 12px; }

@media (max-width: 480px) {
  .grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  h1 { font-size: 24px; }
}
