/* Controls: buttons, tabs, filter chips, parchment forms, notices and stat grids. */

/* ---- buttons ---- */
.btn {
  max-width: 100%; min-width: 0; white-space: normal; overflow-wrap: anywhere; text-align: center;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 20px;
  border: 2px solid; border-radius: 4px; font: 900 15.5px var(--font-body); text-decoration: none; cursor: pointer;
  transition: transform .2s var(--ease), filter .2s;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn-gold { color: #3a2400; background: linear-gradient(#ffe08a, #ffc847 50%, #f0a51c); border-color: #fff4c4 #b97b0c #b97b0c #fff4c4; box-shadow: 0 0 0 2px var(--night), 0 6px 14px #0006; }
.btn-gold:hover { color: #3a2400; }
.btn-blue { color: #fff; background: linear-gradient(#5aa0f5, #2f6fc4 50%, #245aa3); border-color: #b9dcff #1b4278 #1b4278 #b9dcff; box-shadow: 0 0 0 2px var(--night), 0 6px 14px #0006; text-shadow: 0 1px 0 var(--night); }
.btn-blue:hover { color: #fff; }
.btn-green { color: #fff; background: linear-gradient(#6fd45a, #3fa33a 50%, #2a8427); border-color: #c8f5b8 #1d5e1d #1d5e1d #c8f5b8; box-shadow: 0 0 0 2px var(--night), 0 8px 18px #0007; text-shadow: 0 1px 0 #1d5e1d; }
.btn-green:hover { color: #fff; }
.btn-wide { width: 100%; }
.btn.sm { min-height: 42px; padding: 0 18px; font-size: 15px; border-radius: 3px; }
.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; padding: 10px 24px 4px; }

/* ---- tabs (links or buttons) ---- */
.tabs { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; padding: 4px 24px 10px; }
.tab {
  display: inline-flex; align-items: center; min-height: 34px; padding: 0 14px; border: 2px solid; border-color: var(--gold-light) var(--gold-dark) var(--gold-dark) var(--gold-light); border-radius: 3px;
  background: var(--window) var(--tex-stone) 0 0 / 96px 96px; background-blend-mode: soft-light;
  color: #fff; font: 700 12.5px var(--font-game); text-decoration: none; text-shadow: 1px 1px 0 #000; cursor: pointer;
}
.tab:hover { color: #fff; filter: brightness(1.12); }
.tab[aria-pressed=true], .tab[aria-current] { background-color: #d99a1c; color: #3a2400; text-shadow: 0 1px 0 #ffe9a8; }

/* ---- filter chips ---- */
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; padding: 0 24px 12px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 12px; border: 2px solid var(--ink-line); border-radius: 999px; background: #fbf2dc; color: #4a3618; font: 800 13px var(--font-body); text-decoration: none; cursor: pointer; }
.chip:hover { border-color: var(--link); color: var(--link); }
.chip[aria-pressed=true], .chip[aria-current] { background: var(--link); border-color: var(--link); color: #fff; }

/* ---- forms on parchment ---- */
.pform { display: grid; gap: 14px; max-width: 520px; margin: 0 auto; padding: 8px 24px 6px; }
.pform.wide { max-width: none; }
.pf label, .pform label.lbl { display: block; margin-bottom: 5px; font-weight: 900; font-size: 14px; color: var(--ink-strong); }
.pf input, .pf select, .pf textarea {
  width: 100%; box-sizing: border-box; min-height: 44px; padding: 9px 12px; border: 1px solid #bea574; border-radius: 3px;
  background: #fffdf7; color: #253b48; font: 600 13px var(--font-body);
}
.pf input:focus, .pf select:focus, .pf textarea:focus { outline: none; border-color: var(--link); box-shadow: 0 0 0 3px #1d4f9c33; }
.pf small { display: block; margin-top: 4px; color: var(--ink-soft); font-size: 12.5px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; color: var(--ink-strong); }
.check input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--link); }

/* ---- notices ---- */
.note { display: flex; align-items: flex-start; gap: 12px; margin: 6px 24px 10px; padding: 12px 14px; border: 2px solid #e8b33a; border-radius: 4px; background: #fff6d6; color: var(--ink-strong); font-size: 15px; }
.note img { flex: none; width: 32px; height: 32px; image-rendering: pixelated; }
.note.red { background: #ffe6e0; border-color: #c0392b; }
.note.blue { background: var(--ice); border-color: #2f6fc4; }
.note b { color: #1a2333; }
.pgmain > .note { margin: 0; }

/* ---- key / value grid ---- */
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); gap: 10px; padding: 6px 24px 4px; }
.kv > div { padding: 10px 12px; background: #fff8e6aa; border: 1px solid #b08a5566; border-radius: 4px; }
.kv small { display: block; font-weight: 800; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); }
.kv b { display: block; margin-top: 2px; font: 900 20px var(--font-display); color: var(--link); }

@media (max-width: 640px) { .row2 { grid-template-columns: 1fr; } }

/* secondary or destructive actions: parchment outline that fills on hover */
.btn-ghost {
  color: var(--ink-strong);
  background: linear-gradient(#fff4d8, #efdbaf);
  border: 1px solid var(--ink-line);
  border-bottom-color: var(--gold-dark);
  border-radius: 3px;
  box-shadow: inset 0 1px 0 #fffdf3, inset 0 -2px 0 #b08a5533, 0 2px 3px #3a24101a;
  font-weight: 800;
  text-shadow: 0 1px 0 #fff8e680;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.btn-ghost:hover {
  color: var(--ink-strong); background: linear-gradient(#ffe9b4, #e8c782);
  border-color: var(--gold-dark); transform: none; filter: none;
}
.btn-ghost:active {
  background: #e4c58e; box-shadow: inset 0 2px 3px #3a241026;
  transform: translateY(1px);
}
.btn-ghost:focus-visible { outline: 2px solid var(--link); outline-offset: 3px; }
.btn-ghost:disabled, .btn-ghost[aria-disabled=true] { opacity: .55; cursor: not-allowed; transform: none; }

/* ---- tabs: clearer type and a stronger selected state (readability on parchment) ---- */
.tab {
  min-height: 36px; padding: 0 16px; font: 800 13.5px var(--font-body); letter-spacing: .01em;
  background-color: #1f4f8f; border-color: #8fb8ea #0b1d36 #0b1d36 #8fb8ea; text-shadow: 0 1px 0 #000;
  box-shadow: 0 2px 0 #0b1d3655; transition: transform .15s var(--ease), filter .15s;
}
.tab:hover { transform: translateY(-1px); filter: brightness(1.15); }
.tab[aria-pressed=true], .tab[aria-current] {
  background: linear-gradient(#ffe08a, #f2a91e); border-color: #fff4c4 #8a5f1c #8a5f1c #fff4c4;
  color: #2a1a00; text-shadow: none; box-shadow: 0 0 0 2px var(--night), 0 3px 8px #0005;
}
button.tab { cursor: pointer; }
.chip { font-size: 13.5px; }
.chip-sep { width: 1px; align-self: stretch; margin: 4px 6px; background: #b08a5588; }

/* ---- status pills ---- */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border: 1px solid #b08a55aa; border-radius: 999px; background: #fff8e6; font: 800 12px var(--font-body); color: var(--ink-strong); white-space: nowrap; }
.pill.on { border-color: #1f7a2e66; background: #e3f6df; color: #1f6a28; }
.pill.off { border-color: #9a3b2a66; background: #fbe4df; color: #8a2f20; }
.pill.gold { border-color: #b97b0c; background: #ffe9a8; color: #5a3a06; }
.pill a { color: inherit; }
