/* Upland Knights — modern site shell (sandbox) */
:root {
  --bb-bg: #1a1612;
  --bb-bg-elev: #2a231c;
  --bb-panel: #f7f1e6;
  --bb-panel-2: #efe6d6;
  --bb-ink: #1c1814;
  --bb-muted: #5c5348;
  --bb-line: #d4c4a8;
  --bb-accent: #8b2e1a;
  --bb-accent-2: #c45a00;
  --bb-gold: #c9a227;
  --bb-ok: #2f6b3a;
  --bb-radius: 12px;
  --bb-radius-sm: 8px;
  --bb-shadow: 0 10px 30px rgba(0,0,0,.35);
  --bb-font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --bb-serif: Georgia, "Times New Roman", serif;
  --bb-max: 1120px;
}

*, *::before, *::after { box-sizing: border-box; }

html { height: 100%; }

body.bb-body {
  margin: 0;
  min-height: 100%;
  font-family: var(--bb-font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--bb-ink);
  background:
    linear-gradient(180deg, rgba(20,16,12,.55), rgba(20,16,12,.75)),
    var(--bb-bg) url("../images/stone_background.jpg") repeat;
  background-attachment: fixed;
}

a { color: var(--bb-accent); text-decoration: none; }
a:hover { color: var(--bb-accent-2); text-decoration: underline; }

.bb-app {
  width: min(var(--bb-max), 96vw);
  margin: 1rem auto 2rem;
}

.bb-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .45rem .85rem;
  padding: .45rem .85rem .55rem;
  background: rgba(247,241,230,.97);
  border: 1px solid #5a4632;
  border-radius: var(--bb-radius) var(--bb-radius) 0 0;
  box-shadow: var(--bb-shadow);
}


.bb-brand,
a.bb-brand-hero {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  min-width: 0;
  max-width: min(420px, 62vw);
  text-decoration: none !important;
  color: inherit;
  padding: .2rem .45rem .2rem .25rem;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(18,14,10,.9), rgba(42,32,22,.55) 40%, rgba(42,32,22,.55) 60%, rgba(18,14,10,.9));
  border: 1px solid #3a2c1c;
  box-shadow: inset 0 0 0 1px rgba(255,220,140,.12);
}
a.bb-brand-hero:hover {
  filter: brightness(1.06);
}
.bb-brand img.title { display: none; } /* old logo retired */
.bb-brand .name { display: none; }
.bb-brand-mark {
  height: 42px;
  width: auto;
  max-width: 56px;
  object-fit: contain;
  flex: 0 0 auto;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,.5));
}
.bb-brand-mark-flip { transform: scaleX(-1); }
.bb-brand-copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  line-height: 1.05;
  padding: 0 .15rem;
}
.bb-brand-title {
  font-family: var(--bb-serif);
  font-weight: 700;
  font-size: clamp(.95rem, 2.2vw, 1.25rem);
  letter-spacing: .05em;
  text-transform: uppercase;
  color: #f7efd6;
  text-shadow: 0 1px 0 #2a1c10, 0 0 10px rgba(0,0,0,.4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.bb-brand-sub {
  margin-top: .12rem;
  font-size: .62rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #d2b56a;
  white-space: nowrap;
}

.bb-user {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: .75rem;
  font-size: .95rem;
}
.bb-user .who { font-weight: 700; }
.bb-user .logout {
  padding: .35rem .7rem;
  border-radius: 999px;
  background: #5a4632;
  color: #f7f1e6 !important;
  text-decoration: none !important;
  font-size: .85rem;
}
.bb-user .logout:hover { background: #7a5e42; }

.bb-primary-nav {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  width: 100%;
  padding-top: .2rem;
  border-top: 1px solid var(--bb-line);
}

.bb-primary-nav a {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .45rem .8rem;
  border-radius: 999px;
  background: var(--bb-panel-2);
  border: 1px solid var(--bb-line);
  color: var(--bb-ink) !important;
  text-decoration: none !important;
  font-weight: 600;
  font-size: .88rem;
}
.bb-primary-nav a:hover {
  background: #5a4632;
  color: #f7f1e6 !important;
  border-color: #5a4632;
}
.bb-primary-nav img { width: 18px; height: 18px; object-fit: contain; }



/* Tall hero retired — brand now lives in .bb-top */
.bb-hero { display: none !important; }

.bb-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .5rem;
  padding: .5rem .85rem;
  background: rgba(247,241,230,.97);
  border-left: 1px solid #5a4632;
  border-right: 1px solid #5a4632;
}

.bb-stat {
  background: var(--bb-panel-2);
  border: 1px solid var(--bb-line);
  border-radius: var(--bb-radius-sm);
  padding: .55rem .7rem;
}
.bb-stat h3 {
  margin: 0 0 .25rem;
  font-size: .72rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--bb-muted);
  font-weight: 700;
}
.bb-stat p { margin: 0; font-size: .9rem; }
.bb-stat strong { color: #3d2f22; }

.bb-alert {
  margin: 0;
  padding: .65rem 1rem;
  background: #fff4e5;
  border-left: 1px solid #5a4632;
  border-right: 1px solid #5a4632;
  color: #7a3e00;
  font-weight: 600;
}

.bb-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 0;
  background: rgba(247,241,230,.97);
  border: 1px solid #5a4632;
  border-top: none;
  border-radius: 0 0 var(--bb-radius) var(--bb-radius);
  box-shadow: var(--bb-shadow);
  min-height: 420px;
}

.bb-main {
  padding: 1rem 1.15rem 1.5rem;
  min-width: 0;
  border-right: 1px solid var(--bb-line);
}

.bb-aside {
  padding: .9rem .85rem 1.25rem;
  background: #f3eadb;
}
.bb-aside h2 {
  margin: .85rem 0 .4rem;
  font-size: .72rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--bb-muted);
}
.bb-aside h2:first-child { margin-top: 0; }
.bb-aside nav {
  display: flex;
  flex-direction: column;
  gap: .2rem;
}
.bb-aside a {
  display: block;
  padding: .4rem .55rem;
  border-radius: 6px;
  color: var(--bb-ink) !important;
  text-decoration: none !important;
  font-size: .92rem;
}
.bb-aside a:hover {
  background: #5a4632;
  color: #f7f1e6 !important;
}

.bb-aside .profile-lookup {
  margin-top: .5rem;
  display: flex;
  gap: .35rem;
}
.bb-aside .profile-lookup input[type="text"] {
  flex: 1;
  min-width: 0;
  padding: .35rem .45rem;
  border: 1px solid var(--bb-line);
  border-radius: 6px;
  font: inherit;
}
.bb-aside .profile-lookup input[type="submit"] {
  padding: 0.35rem 0.7rem;
  border: 2px solid #5a4020;
  border-radius: 6px;
  background: linear-gradient(180deg, #f0e0a0 0%, #d4b45a 48%, #a88830 100%);
  color: #2a1c08;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}
.bb-aside .profile-lookup input[type="submit"]:hover {
  background: linear-gradient(180deg, #f8ecc0 0%, #e0c46a 48%, #b89840 100%);
  color: #1a1000;
}
.bb-aside .game-time {
  margin-top: .75rem;
  font-size: .85rem;
  color: var(--bb-muted);
}

.bb-foot {
  margin-top: .85rem;
  text-align: center;
  color: #d9cbb5;
  font-size: .85rem;
}
.bb-foot a { color: #f0d9a8; }

/* Page title helper used by bb_page_header */
.bb-page-title {
  margin: 0 0 1rem;
  font-family: var(--bb-serif);
  font-size: 1.45rem;
  color: #3d2f22;
  border-bottom: 2px solid var(--bb-line);
  padding-bottom: .4rem;
}

.bb-panel {
  background: #fffdf8;
  border: 1px solid var(--bb-line);
  border-radius: var(--bb-radius-sm);
  padding: 1rem 1.1rem;
  margin: 0 0 1rem;
}

.bb-btn {
  display: inline-block;
  font: 700 0.78rem/1 "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none !important;
  color: #2a1c08 !important;
  padding: 0.42rem 0.95rem 0.46rem;
  border-radius: 6px;
  border: 2px solid #5a4020;
  background: linear-gradient(180deg, #f0e0a0 0%, #d4b45a 48%, #a88830 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,220,.65), inset 0 -2px 3px rgba(80,50,10,.35), 0 2px 3px rgba(0,0,0,.28);
  text-shadow: 0 1px 0 rgba(255,255,220,.45);
  cursor: pointer;
}
.bb-btn:hover { background: linear-gradient(180deg, #f8ecc0 0%, #e0c46a 48%, #b89840 100%); color: #1a1000 !important; }

/* Kill the classic boxy table look inside page content */
.bb-main table {
  width: 100% !important;
  max-width: 100%;
  border-collapse: collapse;
  background: #fffdf8;
  border: 1px solid var(--bb-line);
  border-radius: var(--bb-radius-sm);
  overflow: hidden;
  margin: .5rem 0 1rem;
  box-shadow: none;
}
.bb-main table table {
  border: 0;
  background: transparent;
  margin: 0;
}
.bb-main th,
.bb-main td {
  padding: .65rem .8rem !important;
  border-bottom: 1px solid var(--bb-line);
  vertical-align: top;
  font-size: .95rem;
  color: var(--bb-ink);
}
.bb-main tr:last-child td { border-bottom: 0; }
.bb-main th {
  background: var(--bb-panel-2);
  text-align: left;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--bb-muted);
}
.bb-main center {
  display: block;
  text-align: left;
}
.bb-main hr {
  border: 0;
  border-top: 1px solid var(--bb-line);
  margin: 1rem 0;
}
.bb-main font[size="+2"],
.bb-main font[size="+1"] {
  font-family: var(--bb-serif);
  font-size: 1.25rem !important;
  font-weight: 700;
}
.bb-main input[type="text"],
.bb-main input[type="password"],
.bb-main input[type="email"],
.bb-main input[type="number"],
.bb-main select,
.bb-main textarea {
  font: inherit;
  padding: .45rem .55rem;
  border: 1px solid var(--bb-line);
  border-radius: 6px;
  background: #fff;
  max-width: 100%;
}
.bb-main input[type="submit"],
.bb-main input[type="button"],
.bb-main button {
  display: inline-block;
  font: 700 0.78rem/1 "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #2a1c08 !important;
  padding: 0.42rem 0.95rem 0.46rem;
  border-radius: 6px;
  border: 2px solid #5a4020;
  background: linear-gradient(180deg, #f0e0a0 0%, #d4b45a 48%, #a88830 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,220,.65), inset 0 -2px 3px rgba(80,50,10,.35), 0 2px 3px rgba(0,0,0,.28);
  text-shadow: 0 1px 0 rgba(255,255,220,.45);
  cursor: pointer;
}
.bb-main input[type="submit"]:hover,
.bb-main input[type="button"]:hover,
.bb-main button:hover,
.bb-main input[type="submit"]:focus-visible,
.bb-main input[type="button"]:focus-visible,
.bb-main button:focus-visible {
  background: linear-gradient(180deg, #f8ecc0 0%, #e0c46a 48%, #b89840 100%);
  color: #1a1000 !important;
}
.bb-main input[type="submit"]:active,
.bb-main input[type="button"]:active,
.bb-main button:active {
  background: linear-gradient(180deg, #b89840 0%, #c9a84a 55%, #e0c46a 100%);
}
.bb-main button:disabled,
.bb-main input[type="submit"]:disabled,
.bb-main input[type="button"]:disabled {
  opacity: .55;
  cursor: not-allowed;
}

/* Public / visitor pages */
.bb-public {
  width: min(720px, 94vw);
  margin: 2rem auto;
  padding: 1.25rem 1.4rem 1.6rem;
  background: rgba(247,241,230,.97);
  border: 1px solid #5a4632;
  border-radius: var(--bb-radius);
  box-shadow: var(--bb-shadow);
}
.bb-public-nav {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin: .75rem 0 1.25rem;
}
.bb-public-nav a {
  padding: .4rem .75rem;
  border-radius: 999px;
  background: var(--bb-panel-2);
  border: 1px solid var(--bb-line);
  color: var(--bb-ink) !important;
  text-decoration: none !important;
  font-weight: 600;
}


/* ===== Responsive: tablet + phone ===== */
.bb-primary-nav { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }

@media (max-width: 960px) {
  .bb-app { width: min(100%, 96vw); margin: .5rem auto 1.25rem; }
  .bb-layout { grid-template-columns: 1fr; }
  .bb-main { border-right: 0; border-bottom: 1px solid var(--bb-line); }
  .bb-aside {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .75rem 1rem;
  }
  .bb-aside h2 { grid-column: 1 / -1; margin-top: .25rem; }
  .bb-aside nav { gap: .15rem; }
  .bb-aside .profile-lookup,
  .bb-aside .game-time { grid-column: 1 / -1; }
}

@media (max-width: 720px) {
  .bb-stats { grid-template-columns: 1fr 1fr; }
  .bb-top { padding: .65rem .75rem; }
  .bb-brand .name { display: none; }
  .bb-brand img.title { height: 44px; }
  .bb-primary-nav a { padding: .4rem .65rem; font-size: .82rem; }
  .bb-primary-nav img { width: 16px; height: 16px; }
  .bb-user { width: 100%; margin-left: 0; justify-content: space-between; }
  .bb-main { padding: .85rem .8rem 1.1rem; }
  .bb-aside { grid-template-columns: 1fr; padding: .85rem .8rem 1.1rem; }
  .bb-main table,
  .bb-main th,
  .bb-main td { font-size: .88rem; }
  .bb-main td, .bb-main th { padding: .5rem .55rem !important; }
  /* Stack dense legacy 2-column tables a bit more gently */
  .bb-main table[width],
  .bb-main table[width="100%"],
  .bb-main table[width="800"],
  .bb-main table[width="600"] { display: block; overflow-x: auto; }
}

@media (max-width: 420px) {
  .bb-stats { grid-template-columns: 1fr; }
  .bb-primary-nav a img { display: none; }
  .bb-public { margin: .75rem auto; padding: 1rem; }
}

@media (hover: none) {
  .bb-primary-nav a,
  .bb-aside a,
  .bb-btn { min-height: 44px; }
}

.bb-public-brand {
  display: flex;
  justify-content: center;
  margin: 0 0 .65rem;
}
.bb-public-brand .bb-brand-hero { max-width: 360px; }


/* Item icons (Armory art) beside names in inventory / barracks / merchant tables */
.bb-item-with-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  vertical-align: middle;
}
.bb-item-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, #8a2830 0%, #5a1018 45%, #2a080c 100%);
  box-shadow:
    0 0 0 2px #a8a8b0,
    0 0 0 3px #5a5a62,
    inset 0 1px 3px rgba(255, 180, 180, 0.25),
    inset 0 -2px 5px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  vertical-align: middle;
}
.bb-item-icon img {
  width: 72%;
  height: 72%;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.5));
}
.bb-item-name { vertical-align: middle; }


/* ===== btnlinks 2026-09-24: shared gold medieval button =====
   Same look as the Barracks ARMORY / CUSTOMIZE / TRAINER buttons (moved here from units/default.php).
   .bb-btn-armory = Barracks row buttons (small left margin); .bb-btn-gold = end-of-page action/back links. */
.bb-btn-armory,
.bb-btn-gold {
  display: inline-block;
  padding: 0.22rem 0.7rem 0.28rem;
  vertical-align: middle;
  font: 700 0.78rem/1 "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none !important;
  color: #2a1c08 !important;
  border-radius: 6px;
  border: 2px solid #5a4020;
  background: linear-gradient(180deg, #f0e0a0 0%, #d4b45a 48%, #a88830 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 220, 0.65),
    inset 0 -2px 3px rgba(80, 50, 10, 0.35),
    0 2px 3px rgba(0, 0, 0, 0.28);
  text-shadow: 0 1px 0 rgba(255, 255, 220, 0.45);
  cursor: pointer;
}
.bb-btn-armory { margin-left: 0.45rem; }
.bb-btn-gold { margin: 0.3rem 0.2rem; padding: 0.42rem 0.95rem 0.46rem; }
.bb-btn-armory:hover,
.bb-btn-gold:hover,
.bb-btn-gold:focus-visible {
  background: linear-gradient(180deg, #f8ecc0 0%, #e0c46a 48%, #b89840 100%);
  color: #1a1000 !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 240, 0.75),
    inset 0 -2px 3px rgba(80, 50, 10, 0.3),
    0 2px 4px rgba(0, 0, 0, 0.32);
}
.bb-btn-armory:active,
.bb-btn-gold:active {
  background: linear-gradient(180deg, #b89840 0%, #c9a84a 55%, #e0c46a 100%);
  box-shadow: inset 0 2px 4px rgba(60, 40, 10, 0.45);
}
.bb-btn-gold b { font-weight: 700; }
@media (max-width: 760px) { .bb-btn-gold { min-height: 40px; line-height: 1.6; } }

/* ===== tellfriends 2026-10-10: public form cards (Tell Friends, Signup) ===== */
.bb-public { color: var(--bb-ink); }
.bb-public input[type="text"],
.bb-public input[type="email"],
.bb-public input[type="password"],
.bb-public textarea {
  font: inherit;
  padding: .5rem .6rem;
  border: 1px solid var(--bb-line);
  border-radius: 6px;
  background: #fff;
  color: var(--bb-ink);
  max-width: 100%;
  box-sizing: border-box;
}
.bb-public input:focus,
.bb-public textarea:focus {
  outline: 2px solid var(--bb-gold);
  outline-offset: 1px;
  border-color: #a88830;
}
.bb-public input[type="submit"] {
  display: inline-block;
  font: 700 0.78rem/1 "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #2a1c08 !important;
  padding: 0.5rem 1.1rem 0.55rem;
  border-radius: 6px;
  border: 2px solid #5a4020;
  background: linear-gradient(180deg, #f0e0a0 0%, #d4b45a 48%, #a88830 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,220,.65), inset 0 -2px 3px rgba(80,50,10,.35), 0 2px 3px rgba(0,0,0,.28);
  text-shadow: 0 1px 0 rgba(255,255,220,.45);
  cursor: pointer;
}
.bb-public input[type="submit"]:hover,
.bb-public input[type="submit"]:focus-visible {
  background: linear-gradient(180deg, #f8ecc0 0%, #e0c46a 48%, #b89840 100%);
  color: #1a1000 !important;
}

.bb-tf-lead { margin: 0 0 .35rem; font-family: var(--bb-serif); font-size: 1.2rem; color: #3d2f22; text-align: center; }
.bb-tf-sub { margin: 0 0 1rem; color: var(--bb-muted); line-height: 1.5; text-align: center; }
.bb-tf-card { padding: 1.1rem 1.2rem 1.25rem; box-shadow: inset 0 0 0 1px rgba(201,162,39,.25); }
.bb-tf-row { display: flex; flex-direction: column; gap: .3rem; margin: 0 0 1rem; }
.bb-tf-row label,
.bb-tf-cell label { font-weight: 700; color: #3d2f22; font-size: .92rem; }
.bb-tf-row input,
.bb-tf-row textarea,
.bb-tf-cell input { width: 100%; }
.bb-tf-row textarea { resize: vertical; min-height: 6.5rem; line-height: 1.45; }
.bb-tf-hint { color: var(--bb-muted); font-size: .82rem; }
.bb-tf-friends { border: 0; border-top: 2px solid var(--bb-line); margin: 0; padding: .8rem 0 0; min-width: 0; }
.bb-tf-friends legend { font-family: var(--bb-serif); font-weight: 700; color: #3d2f22; padding: 0 .5rem 0 0; font-size: 1.05rem; }
.bb-tf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem 1rem; }
.bb-tf-cell { display: flex; flex-direction: column; gap: .25rem; min-width: 0; }
.bb-tf-bad { border-color: #b3261e !important; background: #fff4f2 !important; }
.bb-tf-error { margin: 1rem 0 0; padding: .55rem .8rem; border: 1px solid #b3261e; border-left-width: 4px; border-radius: 6px; background: #fff4f2; color: #7a1a14; font-weight: 600; }
.bb-tf-error[hidden] { display: none; }
.bb-tf-actions { margin-top: 1.2rem; text-align: center; }
.bb-tf-send { padding: .65rem 1.8rem .7rem; font-size: .9rem; min-width: 11rem; }
.bb-tf-send:disabled { opacity: .6; cursor: wait; }
@media (max-width: 560px) {
  .bb-tf-grid { grid-template-columns: 1fr; }
  .bb-tf-send { width: 100%; min-height: 46px; }
  .bb-tf-row input, .bb-tf-cell input, .bb-tf-row textarea { font-size: 16px; } /* no iOS zoom */
}
