/* ===========================
   Theme + Base
=========================== */
:root{
  --bg-olive:#59573E;
  --bg-olive-rgb: 89, 87, 62;
  --brand-red:#b74c56;

  --panel:#ffffff;
  --panel-edge:#d8d8d8;
  --header:#dedccf;

  --ink:#111111;
  --muted:#6a6a6a;

  /* Primary brand button colours */
  --btn-disabled-bg:#ededed;
  --btn-disabled-text:#bdbdbd;

  --btn-on:#A5A26D;     /* lighter green */
  --btn-hover:#59573E;  /* darker green */
  --btn-text:#ffffff;

  --shadow: 0 10px 24px rgba(0,0,0,.22);
  --radius:14px;

  /* Derived colour tokens */
  --brand-red-hover:#9e3a43;
  --brand-red-rgb:183,76,86;
  --btn-on-rgb:165,162,109;
  --border-ink:#1b1b1b;

  /* UI colour tokens */
  --ink-soft:#333333;
  --nav-hover:#f27a2a;
  --nav-press:#E85228;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }

body{
  margin:0;
  font-family: system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial;
  color:var(--ink);
  background: var(--bg-olive);
}

/* ===========================
   Top header
=========================== */
.topbar{
  position:sticky;
  top:0;
  z-index:20;
  height:92px;
  display:flex;
  align-items:center;
  background: rgba(var(--bg-olive-rgb), .5);
  backdrop-filter: blur(2px);
}

.topbar-inner{
  max-width: 840px;
  margin: 0 auto;
  width:100%;
  padding: 18px;
  display:flex;
  align-items:center;
  justify-content:space-between;
}

.icon-btn{
  width:72px;
  height:72px;
  border:0;
  border-radius:14px;
  background: rgba(255,255,255,.22);
  display:grid;
  place-items:center;
  cursor:pointer;
  &:active { transform: translateY(1px); }
}

.burger-lines{ width:30px; }
.burger-lines span{
  display:block;
  height:3px;
  background: rgba(0,0,0,.55);
  border-radius:999px;
  margin: 6px 0;
}

.brand-mini{
  font-weight:900;
  letter-spacing:.5px;
  color:#fff;
  font-size: 20px;
  display:flex;
  align-items:baseline;
  gap:2px;
}
.brand-mini .amp{ color:var(--brand-red); }

.brand-mini-logo{
  display: block;
  height: 50px;
  width: auto;
  max-width: 100%;
}

@media (max-width: 768px){
  .brand-mini-logo {
    height: 35px;
  }
}

/* ===========================
   Layout + Cards
=========================== */
.wrap{
  max-width: 840px;
  margin: 0 auto;
  padding: 18px 18px 190px; /* 190px bottom clears the fixed dock */
}

.card{
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ===========================
   Hero / Login
=========================== */
.hero{
  padding: 26px 18px;
  margin-top: 6px;
}

.hero-inner{
  max-width: 560px;
  margin: 0 auto;
  text-align:center;
}

.brand-big{
  font-weight: 1000;
  letter-spacing: 1px;
  font-size: 48px;
  line-height: .95;
}

.brand-big .amp{
  color: var(--brand-red);
  font-size: 1.25em;
  position: relative;
  top: 0.04em;
}

.hero p{
  margin: 18px auto 0;
  max-width: 520px;
  font-size: 20px;
  line-height: 1.15;
}

.login{
  margin-top: 18px;
  overflow:hidden;
}

.login-head{
  background: var(--header);
  padding: 22px 18px;
  text-align:center;
}

.login-head h2{
  margin:0;
  font-size: 34px;
  letter-spacing: 1px;
}

.login-body{
  padding: 26px 22px 30px;
}

label{
  display:block;
  text-align:center;
  font-weight: 750;
  font-size: 20px;
  margin: 14px 0 10px;
}

.input{
  width:100%;
  height: 66px;
  border: 2px solid var(--border-ink);
  border-radius: 10px;
  padding: 0 18px;
  font-size: 20px;
  outline: none;
  &::placeholder { color:#8e8e8e; }
}

/* ===========================
   Buttons (shared)
=========================== */
.cta,
.dash-create{
  width: 100%;
  border: 0;
  border-radius: 999px;
  font-weight: 900;
  letter-spacing: 1px;
  cursor:pointer;
  transition: background .12s ease, color .12s ease, transform .08s ease, opacity .12s ease;
}

.cta{
  height: 70px;
  font-size: 20px;
  margin-top: 22px;
}

.dash-create{
  max-width: 520px;
  height: 64px;
  font-size: 18px;
  margin-top: 16px;
  font-weight: 950;
}

.cta[disabled],
.dash-create[disabled]{
  background: var(--btn-disabled-bg);
  color: var(--btn-disabled-text);
  cursor:not-allowed;
  opacity: 1;
}

.cta:not([disabled]),
.dash-create:not([disabled]),
.dash-create.is-enabled{
  background: var(--btn-on);
  color: var(--btn-text);
}

.cta:not([disabled]):hover,
.dash-create:not([disabled]):hover,
.dash-create.is-enabled:hover{
  background: var(--btn-hover);
  color: var(--btn-text);
}

.cta:active,
.dash-create:active{
  transform: translateY(1px);
}

.btn{
  height:56px;
  border:0;
  border-radius: 999px;
  background: var(--btn-on);
  color: var(--btn-text);
  font-weight: 1000;
  letter-spacing: 1px;
  cursor:pointer;
  transition: background .12s ease, transform .08s ease;
  &:hover { background: var(--btn-hover); }
  &:active { transform: translateY(1px); }
  &[disabled] { background: var(--btn-disabled-bg); color: var(--btn-disabled-text); cursor:not-allowed; }
}

/* ===========================
   Notices + Links
=========================== */
.notice{
  display:none;
  margin: 14px auto 0;
  max-width: 620px;
  text-align:center;
  font-size: 16px;
  padding: 10px 12px;
  border-radius: 10px;
}
.notice.error{ display:block; background: rgba(255,0,0,.08); border:1px solid rgba(255,0,0,.25); }
.notice.success{ display:block; background: rgba(0,255,140,.10); border:1px solid rgba(0,255,140,.25); }

.links{
  margin-top: 22px;
  display:flex;
  flex-direction:column;
  gap: 18px;
  align-items:center;
}
.links a{
  color: var(--btn-on);
  text-decoration: underline;
  font-size: 20px;
  font-weight: 650;
}

.password-hint{
  margin-top: 14px;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  color: #666;
  line-height: 1.5;
}

/* ===========================
   Drawer
=========================== */
.drawer-overlay{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.18);
  opacity:0;
  pointer-events:none;
  transition: opacity .18s ease;
  z-index: 50;
}

.drawer{
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: min(360px, 84vw);
  background: #c9c9c9;
  transform: translateX(-105%);
  transition: transform .22s ease;
  z-index: 60;
  display:flex;
  flex-direction:column;
  padding: 18px 20px 16px;
  &.open { transform: translateX(0); }
}
.drawer-overlay.open{ opacity:1; pointer-events:auto; }

.drawer-top{
  display:flex;
  justify-content:flex-end;
}

.close-btn{
  width: 64px;
  height: 64px;
  border-radius: 14px;
  border:0;
  background: rgba(255,255,255,.40);
  font-size: 28px;
  line-height: 1;
  cursor:pointer;
}

.nav{
  margin-top: 28px;
  display:flex;
  flex-direction:column;
  gap: 20px;
}
.nav a{
  font-size: 16px;
  font-weight: 900;
  letter-spacing: .3px;
  line-height: 1.05;
  color: var(--ink);
  text-decoration:none;
  transition: color .12s ease;
}
.nav a:hover,
.drawer-auth-link:hover,
.drawer-map-link:hover{
  color: var(--nav-hover);
}
#drawer a.is-selected{
  color:var(--nav-hover);
  font-weight: 900;
  pointer-events: none;
  cursor: default;
}

.drawer-context{
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.drawer-context-row{
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.drawer-context-row .drawer-context-label,
.drawer-context-row .drawer-context-value{
  display: inline;
}

/* Keep REALM MAP on its own line */
.drawer-context-row:last-child{
  display: block;
}
.drawer-context-label{
  font-size: 16px;
  font-weight: 900;
  letter-spacing: .3px;
  color: var(--ink-soft);
}
.drawer-context-value{
  font-size: 16px;
  font-weight: 900;
  line-height: 1.2;
  color: var(--btn-on);
}
.drawer-map-link{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  font-size: 16px;
  font-weight: 900;
  color: var(--ink);
  text-decoration: none;
}
#drawerWorldName{
  color: var(--btn-on);
  transition: color .12s ease;
}
.drawer-map-link:hover #drawerWorldName{
  color: var(--nav-hover);
}
.drawer-map-icon{
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}

.drawer hr{
  border: 0;
  border-top: 1px solid rgba(255,255,255,.7);
  border-bottom: 1px solid rgba(0,0,0,.22);
  height: 0;
  margin: 16px 0;
}

.drawer-auth{
  margin-top: 24px;
}
.drawer-auth-link{
  display: inline-block;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: .3px;
  color: var(--ink);
  text-decoration: none;
  transition: color .12s ease;
}

.drawer-footer{
  margin-top:auto;
  font-size: 12px;
  font-weight: 650;
  color:#121212;
  opacity:.9;
  line-height: 1.35;
}
.drawer-version{
  font-weight: 500;
  opacity: .7;
}

/* ===========================
   GM Filter Bar
=========================== */
.gm-filter{
  max-width: 840px;
  margin: 0 auto;
  padding: 18px 18px 0;
}
.gm-filter-inner{
  display: flex;
  gap: 12px;
  background: var(--brand-red);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 18px;
}
.gm-filter-group{
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.gm-filter-label{
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  color: rgba(255,255,255,.85);
  text-transform: uppercase;
}
.gm-filter-select{
  width: 100%;
  height: 58px;
  border: 2px solid rgba(255,255,255,.3);
  border-radius: 10px;
  padding: 0 18px;
  padding-right: 48px;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  background: rgba(0,0,0,.2);
  outline: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6' fill='none' stroke='white' stroke-width='3.25' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 18px center;
  background-size: 22px 22px;
}
.gm-filter-select option{
  color: var(--ink);
  background: #fff;
}

/* Page footer (login, register) */
.page-footer{
  text-align: center;
  padding: 24px 16px 32px;
  font-size: 14px;
  font-weight: 600;
  color: rgba(255,255,255,.55);
  line-height: 1.6;
}

/* ===========================
   Dashboard (Knights list)
=========================== */
.dash-card{ overflow:hidden; }

.dash-head{
  background: var(--header);
  padding: 18px;
  text-align:center;
}

.dash-title{
  margin: 0;
  font-size: 34px;
  letter-spacing: 1px;
  font-weight: 1000;
}

.dash-body{
  padding: 18px 18px 22px;
  text-align:center;
}

.dash-body .k-input,
.dash-body .dash-select,
.dash-body .dash-create{
  max-width: 520px;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.dash-subtitle{
  margin: 8px 0 14px;
  font-size: 20px;
  font-weight: 850;
}

.dash-field{
  display:flex;
  justify-content:center;
}

.dash-select{
  width: 100%;
  max-width: 520px;
  height: 58px;
  border: 2px solid var(--border-ink);
  border-radius: 10px;
  padding: 0 18px;
  padding-right: 58px;
  font-size: 18px;
  outline:none;
  background: #fff;
  -webkit-appearance:none;
  appearance:none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6' fill='none' stroke='%23111111' stroke-width='3.25' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat:no-repeat;
  background-position: right 18px center;
  background-size: 22px 22px;
}

.dash-list{
  margin-top: 12px;
  display:flex;
  flex-direction:column;
  gap: 10px;
}

.dash-empty{
  padding: 12px 0 6px;
  color: rgba(0,0,0,.35);
  font-weight: 700;
}

.dash-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  text-decoration:none;
  color: inherit;
  background: rgba(0,0,0,.04);
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 12px;
  padding: 14px;
  text-align:left;
  &:active { transform: translateY(1px); }
}

.dash-row-main{
  flex:1;
  min-width: 0;
}

.dash-row-name{
  font-size: 18px;
  font-weight: 900;
}

.dash-row-meta{
  margin-top: 4px;
  font-size: 13px;
  color: rgba(0,0,0,.55);
  font-weight: 650;
}

.dash-row-del{
  width: 44px;
  height: 44px;
  display:grid;
  place-items:center;
  border: 0;
  background: transparent;
  cursor: pointer;
  flex: 0 0 auto;
  padding: 0;
}
.dash-row-del img{
  width: 22px;
  height: 22px;
  display:block;
}
.dash-row-del:active{ transform: translateY(1px); }
.dash-row-del:disabled{ opacity: .45; cursor: not-allowed; }

/* ===========================
   Bottom navigation (dock)
=========================== */
.bottomnav{
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  z-index: 40;
  width: min(840px, 100%);
  padding: 18px;
  padding-bottom: calc(18px + env(safe-area-inset-bottom));
  padding-left: calc(18px + 20px);
  padding-right: calc(18px + 20px);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  background: var(--bg-olive);
  &::before {
    content:"";
    position:absolute;
    left:0; right:0;
    top:-50px;
    height:50px;
    background: linear-gradient(
    to top,
    rgba(var(--bg-olive-rgb), 1),
    rgba(var(--bg-olive-rgb), 0)
    );
    pointer-events:none;
  }
}

.bn-item{
  width: 92px;
  height: 92px;
  border-radius: 18px;
  background: #d9d9d9;
  display: grid;
  place-items: center;
  text-decoration: none;
  transition: background .12s ease, transform .08s ease;
  &.is-selected { background: var(--btn-on); }
  &.is-press { background: var(--nav-press); }
  &:hover { background: var(--nav-press); }
  &:active { transform: translateY(1px); }
}

/* ===========================
   Dice
=========================== */
.dice-card{ overflow:hidden; }

.dice-head{
  background: var(--header);
  padding: 18px;
  text-align:center;
}

.dice-title{
  margin: 0;
  font-size: 34px;
  letter-spacing: 1px;
  font-weight: 1000;
}

.dice-body{
  padding: 18px 18px 22px;
  text-align:center;
}

.dice-grid{
  margin-top: 8px;
  display:flex;
  flex-direction:column;
  gap: 14px;
}

.dice-row{
  display:grid;
  grid-template-columns: 96px 56px 1fr 56px;
  gap: 14px;
  align-items:center;
}

.die-btn{
  width:96px;
  height:64px;
  border:0;
  background: transparent;
  padding:0;
  cursor:pointer;
  display:grid;
  place-items:center;
  &:active { transform: translateY(1px); }
}

.die-btn img{
  width: 90px;
  height: 62px;
  display:block;
}

.mini-btn{
  width:56px;
  height:44px;
  border-radius: 8px;
  border: 1px solid rgba(0,0,0,.08);
  background: rgba(0,0,0,.03);
  display:grid;
  place-items:center;
  cursor:pointer;
  font-weight: 950;
  color: var(--btn-on);
  font-size: 24px;
  line-height: 1;
  user-select:none;
  transition: background .12s ease, transform .08s ease;
  &:hover { background: rgba(0,0,0,.06); }
  &:active { transform: translateY(1px); }
  &[disabled] { opacity:.35; cursor:not-allowed; }
}

.count-pill{
  height:44px;
  border-radius: 10px;
  border: 2px solid var(--border-ink);
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight: 950;
  letter-spacing: 1px;
  font-size: 18px;
  background:#fff;
}

.roll-btn{
  margin-top: 18px;
  width:100%;
  max-width: 520px;
  height: 64px;
  border:0;
  border-radius: 999px;
  background: var(--btn-on);
  color: var(--btn-text);
  font-weight: 1000;
  letter-spacing: 1px;
  font-size: 18px;
  cursor:pointer;
  transition: background .12s ease, transform .08s ease;
  &:hover { background: var(--btn-hover); }
  &:active { transform: translateY(1px); }
}

.hist{
  margin-top: 18px;
  display:flex;
  flex-direction:column;
  gap: 12px;
  text-align:left;
}

.hist-row{
  display:grid;
  grid-template-columns: 92px 1fr 54px;
  gap: 14px;
  align-items:center;
  padding: 16px;
  border-radius: 14px;
  background: rgba(0,0,0,.04);
  border: 1px solid rgba(0,0,0,.10);
}

.hist-die{
  display:grid;
  place-items:center;
}
.hist-die img{
  width: 90px;
  height: 62px;
  display:block;
}

.hist-main{ min-width: 0; }

.hist-top{
  display:flex;
  justify-content:space-between;
  gap: 12px;
  align-items:baseline;
}

.hist-exp{
  font-weight: 950;
  letter-spacing: .5px;
  font-size: 18px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.hist-time{
  color: rgba(0,0,0,.55);
  font-weight: 750;
  font-size: 12px;
  white-space:nowrap;
}

.hist-rolls{
  margin-top: 6px;
  color: rgba(0,0,0,.70);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .2px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.hist-total{
  margin-top: 6px;
  font-weight: 1000;
  font-size: 22px;
}

.hist-del{
  width: 44px;
  height: 44px;
  display:grid;
  place-items:center;
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 0;
  &:active { transform: translateY(1px); }
}
.hist-del img{ width: 22px; height: 22px; display:block; }

/* ===========================
   Knight (character page)
=========================== */
.knight-card{ overflow:hidden; }
.knight-head{ background: var(--header); padding:18px; text-align:center; }
.knight-title{ margin:0; font-size:34px; letter-spacing:1px; font-weight:1000; }
.knight-body{ padding:18px 18px 22px; }

.k-section{ margin-top: 14px; }
.k-section:first-child{ margin-top: 0; }

.k-label{ font-weight:900; margin: 10px 0 8px; }

.k-input{
  width:100%;
  height:56px;
  border:2px solid var(--border-ink);
  border-radius:10px;
  padding: 0 16px;
  font-size:18px;
  outline:none;
  background:#fff;
}

/* Custom chevron for all select.k-input */
select.k-input{
  -webkit-appearance: none;
  appearance: none;
  padding-right: 58px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6' fill='none' stroke='%23111111' stroke-width='3.25' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 18px center;
  background-size: 22px 22px;
}

.k-input-title{
  background: var(--header);
  font-weight: 900;
  margin-bottom: 10px;
}

.k-grid2{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.k-step{
  display:grid;
  grid-template-columns: 56px 1fr 56px;
  gap: 12px;
  align-items:center;
}

.k-mini{
  width:42px;
  height:44px;
  border-radius: 8px;
  border: 1px solid rgba(0,0,0,.08);
  background: rgba(0,0,0,.03);
  display:grid;
  place-items:center;
  cursor:pointer;
  font-weight: 950;
  color: var(--btn-on);
  font-size: 24px;
  line-height: 1;
  user-select:none;
  flex-shrink: 0;
  &:active { transform: translateY(1px); }
  &[disabled] { opacity:.35; cursor:not-allowed; }
}

.k-pill{
  height:44px;
  border-radius: 10px;
  border: 2px solid var(--border-ink);
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight: 950;
  letter-spacing: 1px;
  font-size: 18px;
  background:#fff;
  min-width: 0;
  white-space: nowrap;
}

.k-stat-row{
  display:grid;
  grid-template-columns: auto 42px minmax(80px, 1fr) 42px auto;
  gap: 8px;
  align-items:center;
  padding: 8px 0;
}
.k-stat-name{ font-weight: 1000; letter-spacing:.5px; min-width:0; }
.k-stat-name.red{ color: var(--brand-red); }
.k-stat-abbr{ font-size: 14px; color: var(--ink); }

.k-stat-mode{ display:flex; gap:4px; justify-content:flex-end; flex-shrink:0; }
.k-mode-btn{
  height:34px;
  min-width:40px;
  padding:0 8px;
  border-radius:999px;
  border:2px solid var(--border-ink);
  background:#fff;
  font-weight:950;
  font-size: 12px;
  letter-spacing:.5px;
  cursor:pointer;
  line-height:1;
  opacity:.55;
  &.on {
    background: var(--btn-on);
    color: var(--btn-text);
    border-color: transparent;
    opacity:1;
  }
}

.k-toggle-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  padding: 10px 0;
}
.k-toggle-label{ font-weight: 950; }
.k-help{ color: rgba(0,0,0,.55); font-weight:650; font-size: 13px; }

.k-switch{
  width:64px; height:34px; border-radius:999px;
  background: rgba(0,0,0,.12);
  position: relative;
  border: 1px solid rgba(0,0,0,.10);
  cursor:pointer;
  flex: 0 0 auto;
  &::after {
    content:"";
    position:absolute; top:4px; left:4px;
    width:26px; height:26px; border-radius:999px;
    background:#fff;
    transition: transform .14s ease, background .14s ease;
    box-shadow: 0 4px 10px rgba(0,0,0,.15);
  }
  &.on { background: var(--btn-on); }
}
.k-switch.on::after{ transform: translateX(30px); }

.k-box{
  background: rgba(0,0,0,.04);
  border: 1px solid rgba(0,0,0,.10);
  border-radius: 14px;
  padding: 14px;
}
.k-box .k-input{ height:52px; }



        /* ── Time Tracker ── */
    .time-tracker{
      display: none;
      gap: 12px;
      margin-bottom: 14px;
      background: #fff;
      border-radius: 10px;
      padding: 16px 18px;
      box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  &.is-visible { display: flex; }
}
    .time-col{ flex: 1; min-width: 0; }
    .time-col-label{
      font-size: 10px;
      font-weight: 700;
      letter-spacing: 2px;
      color: #888;
      text-transform: uppercase;
      margin-bottom: 6px;
    }
    .time-col select.dash-select:disabled{
      background: #f5f3ee;
      color: #555;
      opacity: 1;
    }
    .time-desc{
      margin-top: 10px;
      font-size: 13px;
      line-height: 1.5;
      color: #555;
    }
    .time-desc b{ color: var(--ink-soft); }
    .time-desc em{ font-style: italic; color: #777; }
    .time-desc ul{
      margin: 6px 0 0 0;
      padding-left: 18px;
      list-style: disc;
    }
    .time-desc li{ margin-bottom: 4px; }
    .myth-realm-group{ margin-bottom: 18px; }
    .myth-realm-group:last-child{ margin-bottom: 0; }
    .myth-realm-label{
      background: #fff;
      border-radius: 14px;
      padding: 18px 22px;
      margin-bottom: 12px;
      box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    }
    .myth-realm-label-name{
      margin: 0;
      font-size: 18px;
      font-weight: 900;
      letter-spacing: 0.5px;
      text-transform: uppercase;
      color: var(--ink);
    }
    @media (max-width: 480px){
      .time-tracker { flex-direction: column; }
      .myth-realm-label { padding: 16px 18px; }
      .myth-realm-label-name { font-size: 16px; }
    }

        .co-member-player{
      display: flex;
      align-items: center;
      gap: 14px;
    }
    .co-member-player-main{
      flex: 1;
      min-width: 0;
    }
    .co-member-knight{
      margin-top: 2px;
      font-size: 14px;
      font-weight: 600;
      color: var(--ink-soft);
      overflow-wrap: anywhere;
    }
    .co-member-knight-type{
      color: var(--btn-on);
      font-weight: 700;
    }
    .co-member-knight-empty{
      color: var(--muted);
      font-style: italic;
      font-weight: 600;
    }
    .co-member-realm{
      min-width: 110px;
      font-size: 14px;
      font-weight: 700;
      color: var(--ink-soft);
      text-align: left;
    }
    @media (max-width: 680px){
      .co-member-player {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas:
          "main remove"
          "realm remove";
        align-items: start;
        column-gap: 12px;
        row-gap: 6px;
      }
      .co-member-player-main { grid-area: main; }
      .co-member-realm {
        grid-area: realm;
        min-width: 0;
      }
      .co-member-player .co-member-remove {
        grid-area: remove;
        align-self: center;
      }
    }

        .seer-create-tools{
      display: grid;
      grid-template-columns: minmax(0,1fr) minmax(0,1fr);
      gap: 10px;
      margin-top: 8px;
    }
    .seer-random-btn{
      margin-top: 0;
      max-width: none;
      width: 100%;
      height: 58px;
      border-radius: 999px;
    }
    .seer-panel + .seer-panel{ margin-top: 14px; }
    
    @media (max-width: 420px){
      .st-tabs { gap: 6px; }
      .st-tab { padding-left: 10px; padding-right: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 25vw; }
    }

     /* ===========================
       About – section cards
    =========================== */
    .about-section{
      background: var(--panel);
      border-radius: 14px;
      padding: 32px 22px;
      margin-bottom: 16px;
      box-shadow: 0 2px 8px rgba(0,0,0,.08);
      min-height: 70vh;
      display: flex;
      flex-direction: column;
      justify-content: center;
      text-align: center;
    }

    /* Chapter title cards – olive background, white text */
    .about-chapter{
      background: var(--bg-olive);
      color: #fff;
      text-align: center;
      min-height: 40vh;
    }
    .about-chapter-title{
      font-size: 28px;
      font-weight: 950;
      letter-spacing: 3px;
      margin: 0;
    }

    /* Section titles */
    .about-title{
      font-size: 22px;
      font-weight: 950;
      letter-spacing: .5px;
      color: var(--ink);
      margin: 0 0 18px;
      padding-bottom: 10px;
      border-bottom: 2px solid var(--brand-red);
    }

    /* Subtitle / emphasis */
    .about-sub{
      font-size: 16px;
      font-weight: 900;
      letter-spacing: .5px;
      color: var(--brand-red);
      margin: 20px 0 8px;
    }

    /* Body text */
    .about-body p{
      font-size: 16px;
      line-height: 1.7;
      color: var(--ink-soft);
      margin: 0 0 12px;
    }
    .about-body strong{
      font-weight: 800;
      color: var(--ink);
    }

    /* Large callout text */
    .about-lead{
      font-size: 18px;
      font-weight: 700;
      line-height: 1.6;
      color: var(--ink);
      margin: 0 0 14px;
    }

    /* Oath / creed styling */
    .about-oath{
      font-size: 16px;
      font-weight: 900;
      letter-spacing: .5px;
      color: var(--brand-red);
      line-height: 2;
      margin: 12px 0;
    }

    /* Numbered items */
    .about-numbered{
      counter-reset: about-num;
      padding: 0;
      margin: 0 0 12px;
      list-style: none;
      text-align: center;
    }
    .about-numbered li{
      counter-increment: about-num;
      font-size: 16px;
      line-height: 1.6;
      color: var(--ink-soft);
      margin-bottom: 14px;
      padding: 0;
      position: relative;
  &::before {
    content: counter(about-num);
    display: block;
    width: 26px;
    height: 26px;
    background: var(--brand-red);
    color: #fff;
    border-radius: 50%;
    font-size: 14px;
    font-weight: 900;
    margin: 0 auto 6px;
    line-height: 26px;
  }
}
    .about-numbered li strong{
      font-weight: 800;
      color: var(--ink);
    }

    /* Stat definitions */
    .about-stat{
      margin-bottom: 14px;
    }
    .about-stat-name{
      font-weight: 900;
      color: var(--brand-red);
      font-size: 16px;
    }
    .about-stat-desc{
      font-size: 15px;
      color: var(--ink-soft);
      line-height: 1.5;
      margin-top: 2px;
    }

    /* Compact list */
    .about-list{
      padding: 0;
      margin: 0 0 12px;
      list-style: none;
    }
    .about-list li{
      font-size: 16px;
      line-height: 1.6;
      color: var(--ink-soft);
      margin-bottom: 4px;
    }

    /* Closing section */
    .about-closing{
      text-align: center;
    }
    .about-closing p{
      text-align: center;
    }

    /* TOC */
    .about-toc{
      padding: 18px 20px;
      margin-bottom: 18px;
    }
    .about-toc-title{
      font-size: 13px;
      font-weight: 900;
      letter-spacing: 1.5px;
      color: var(--brand-red);
      margin: 0 0 8px;
    }
    .about-toc-link{
      display: block;
      padding: 8px 0;
      font-size: 15px;
      font-weight: 700;
      color: var(--ink);
      text-decoration: none;
      border-bottom: 1px solid rgba(0,0,0,.06);
    }
    .about-toc-link:last-of-type{ border-bottom: none; }
    .about-toc-link:hover{ color: var(--btn-on); }

    @media (max-width: 600px){
      .about-section { padding: 26px 18px; min-height: 60vh; }
      .about-chapter-title { font-size: 24px; }
      .about-title { font-size: 20px; }
    }


/* ===========================
   Notes (shared — knights, equipment, etc.)
=========================== */
.notes{
  display:flex;
  flex-direction:column;
  gap: 10px;
  margin-top: 10px;
}

.note-row{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap: 12px;
  background: rgba(0,0,0,.04);
  border: 1px solid rgba(0,0,0,.10);
  border-radius: 14px;
  padding: 14px;
}

.note-text{
  font-weight: 700;
  color: rgba(0,0,0,.75);
  white-space: pre-wrap;
  flex:1;
}

.note-del{
  width:44px; height:44px;
  border:0; background: transparent;
  cursor:pointer;
  display:grid; place-items:center;
  flex: 0 0 auto;
}
.note-del img{ width:22px; height:22px; display:block; }
.note-del:active{ transform: translateY(1px); }

.note-add{
  display:grid;
  grid-template-columns: 1fr 120px;
  gap: 10px;
  margin-top: 10px;
}
.note-add textarea{
  width:100%;
  min-height: 56px;
  border:2px solid var(--border-ink);
  border-radius:10px;
  padding: 12px 14px;
  font-size:16px;
  outline:none;
  resize: vertical;
}

/* ===========================
   Responsive
=========================== */
@media (max-width:520px){
  .k-grid2{ grid-template-columns: 1fr; }
}

@media (max-width:420px){
  /* Login / Hero */
  .brand-big{ font-size: 40px; }
  .hero p{ font-size: 16px; }
  .login-head h2{ font-size: 30px; }
  label{ font-size: 16px; }
  .input{ font-size: 16px; height: 60px; }
  .cta{ font-size: 16px; height: 64px; }
  .links a{ font-size: 16px; }
  .nav a{ font-size: 24px; }

  /* Bottom nav */
  .bottomnav{
    width: min(620px, calc(100% - 20px));
    gap: 12px;
    padding: 16px 10px 16px;
  }
  .bn-item{
    width: 82px;
    height: 82px;
    border-radius: 18px;
  }

  /* Dice */
  .dice-title{ font-size: 30px; }
  .dice-row{
    grid-template-columns: 86px 52px 1fr 52px;
    gap: 10px;
  }
  .die-btn{ width:86px; }
  .die-btn img{ width: 80px; }
}

/* ===========================
   Back button
=========================== */
.back-bar{
  display:flex;
  align-items:center;
  gap: 14px;
  margin-bottom: 18px;
  text-decoration: none;
  color: var(--ink);
  cursor: pointer;
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 18px;
  transition: transform .15s ease, box-shadow .15s ease;
  &:hover {
    transform: translateX(-4px);
    box-shadow: 0 12px 28px rgba(0,0,0,.28);
  }
  &:active { transform: translateX(-2px) translateY(1px); }
}

.back-icon{
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  transition: background .15s ease, color .15s ease;
}
.back-bar:hover .back-icon{
  background: var(--ink);
  color: #fff;
}

.back-icon svg{
  width: 22px;
  height: 22px;
  transition: transform .15s ease;
}
.back-bar:hover .back-icon svg{
  transform: translateX(-2px);
}

.back-label{
  font-weight: 900;
  font-size: 18px;
  letter-spacing: .5px;
}

/* ===========================
   Knight special tables (2×6)
=========================== */
.k-table-block{
  margin-top: 14px;
}
.k-table-title{
  background: var(--header);
  font-weight: 900;
  font-size: 18px;
  letter-spacing: .5px;
  padding: 12px 16px;
  border-radius: 10px 10px 0 0;
  border: 2px solid var(--border-ink);
  border-bottom: none;
}
.k-table{
  width: 100%;
  border-collapse: collapse;
  border: 2px solid var(--border-ink);
  border-radius: 0 0 10px 10px;
  overflow: hidden;
}
.k-table th{
  background: rgba(0,0,0,.06);
  font-weight: 900;
  font-size: 13px;
  letter-spacing: .5px;
  text-transform: uppercase;
  padding: 10px 12px;
  text-align: left;
  border-bottom: 2px solid var(--border-ink);
}
.k-table th:first-child{
  width: 36px;
  text-align: center;
}
.k-table td{
  padding: 0;
  border-bottom: 1px solid rgba(0,0,0,.10);
}
.k-table tr:last-child td{
  border-bottom: none;
}
.k-table td:first-child{
  width: 36px;
  text-align: center;
  font-weight: 900;
  color: var(--muted);
  padding: 10px 12px;
}
.k-table td input{
  width: 100%;
  border: none;
  background: transparent;
  padding: 10px 12px;
  font-size: 15px;
  outline: none;
  &:focus { background: rgba(var(--btn-on-rgb),.08); }
}

.k-roll-btn{
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.k-table.no-title{
  border-radius: 10px;
}

/* Dice roll button (dropdowns) */
.k-dice-btn{
  margin-top: 8px;
  width: 100%;
  height: 44px;
  border: 2px solid var(--btn-on);
  border-radius: 999px;
  background: #fff;
  color: var(--btn-on);
  font-weight: 900;
  font-size: 15px;
  letter-spacing: .5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background .15s ease, color .15s ease, transform .08s ease;
  &:hover {
    background: var(--btn-on);
    color: #fff;
  }
  &:active { transform: translateY(1px); }
}

/* Note editing */
.note-edit-area{
  width: 100%;
  min-height: 56px;
  border: 2px solid var(--btn-on);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 16px;
  font-weight: 700;
  color: rgba(0,0,0,.75);
  outline: none;
  resize: vertical;
  flex: 1;
}
.note-actions{
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.note-save, .note-cancel{
  height: 38px;
  padding: 0 16px;
  border-radius: 999px;
  border: none;
  font-weight: 900;
  font-size: 14px;
  letter-spacing: .5px;
  cursor: pointer;
  transition: background .12s ease, transform .08s ease;
}
.note-save{
  background: var(--btn-on);
  color: #fff;
  &:hover { background: var(--btn-hover); }
}
.note-cancel{
  background: rgba(0,0,0,.08);
  color: var(--ink);
  &:hover { background: rgba(0,0,0,.14); }
}
.note-save:active, .note-cancel:active{ transform: translateY(1px); }

.note-text{
  cursor: pointer;
  &:hover { color: rgba(0,0,0,.9); }
}

/* Stat roll buttons */
.k-stat-roll{
  margin-top: 4px;
  margin-bottom: 8px;
}

/* ===========================
   Knight Filter / Selector Bar
=========================== */
.kf{
  margin-bottom: 18px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.kf-bar{
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border: none;
  background: var(--btn-on);
  color: #fff;
  cursor: pointer;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: .5px;
  text-align: left;
  transition: background .12s ease;
  &:hover { background: var(--btn-hover); }
  &:active { opacity: .9; }
}

.kf-icon{ flex: 0 0 auto; width: 28px; height: 28px; display: block; }
.kf-label{ flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kf-chevron{ flex: 0 0 auto; transition: transform .2s ease; }

.kf-panel{
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-top: none;
  padding: 8px 0;
}

.kf-item{
  display: block;
  width: 100%;
  padding: 12px 18px;
  border: none;
  background: transparent;
  text-align: left;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  transition: background .1s ease;
  &:hover { background: rgba(0,0,0,.05); }
}
.kf-item.kf-current{
  font-weight: 900;
  background: rgba(var(--btn-on-rgb),.10);
}
.kf-item-deceased{ color: var(--brand-red); }

.kf-status{
  font-weight: 700;
  font-size: 14px;
  opacity: .7;
}
.kf-deceased{
  color: var(--brand-red);
  opacity: 1;
}

.kf-empty{
  padding: 14px 18px;
  color: var(--muted);
  font-weight: 700;
  font-size: 15px;
}

/* ===========================
   Seer Filter Bar
=========================== */
.kf--seer{ margin-top: -10px; }

.sf-bar{
  background: var(--bg-olive);
  &:hover { background: #4a4833; }
}

.sf-group-label{
  padding: 10px 18px 4px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 1.5px;
  color: var(--muted);
  text-transform: uppercase;
}

.sf-knight-name{
  font-weight: 600;
  font-size: 14px;
  opacity: .65;
}

/* Disabled stat buttons for party seer view */
#seerBody [data-sstat][data-delta]:disabled{
  opacity: .3;
  cursor: default;
}
#seerBody [data-smode]:disabled{
  opacity: .4;
  cursor: default;
}

/* ===========================
   Confirmation Modal
=========================== */
.modal-overlay{
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.modal-overlay[hidden]{ display: none; }

.modal-card{
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: 0 16px 48px rgba(0,0,0,.30);
  padding: 30px 24px;
  max-width: 400px;
  width: 100%;
  text-align: center;
}

.modal-warn{
  font-size: 48px;
  line-height: 1;
  margin-bottom: 8px;
}

.modal-title{
  margin: 0 0 12px;
  font-size: 24px;
  font-weight: 1000;
  letter-spacing: 1px;
}

.modal-text{
  margin: 0 0 24px;
  font-size: 16px;
  font-weight: 650;
  color: var(--muted);
  line-height: 1.4;
}

.modal-actions{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.modal-btn{
  height: 52px;
  border: none;
  border-radius: 999px;
  font-weight: 900;
  font-size: 16px;
  letter-spacing: .5px;
  cursor: pointer;
  transition: background .12s ease, transform .08s ease;
  &:active { transform: translateY(1px); }
}

.modal-btn-cancel{
  background: var(--brand-red);
  color: #fff;
  &:hover { background: var(--brand-red-hover); }
}

.modal-btn-confirm{
  background: var(--btn-on);
  color: #fff;
  &:hover { background: var(--btn-hover); }
}

/* ===========================
   Action Buttons (Delete, Reassign)
=========================== */
.k-action-btn{
  width: 100%;
  height: 56px;
  border: none;
  border-radius: 999px;
  font-weight: 900;
  font-size: 16px;
  letter-spacing: 1px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background .12s ease, transform .08s ease;
  margin-top: 8px;
  &:active { transform: translateY(1px); }
}

.k-action-delete{
  background: var(--brand-red);
  color: #fff;
  &:hover { background: var(--brand-red-hover); }
}

/* ===========================
   Condition switches (danger variant)
=========================== */
.k-switch-danger.on{
  background: var(--brand-red);
}
.k-divider{
  border: none;
  border-top: 1px solid rgba(0,0,0,.12);
  margin: 4px 0;
}

/* ===========================
   Overrides inside knight body
=========================== */
.knight-body .dash-select,
.knight-body .dash-create{
  max-width: none;
}

/* ===========================
   Seer description boxes
=========================== */
.seer-desc{
  min-height: 70px;
  padding: 12px 16px;
  resize: vertical;
  margin-bottom: 10px;
  font-size: 16px;
  line-height: 1.4;
}
.seer-desc:last-child{
  margin-bottom: 0;
}

/* ===========================
   Myths & Omens
=========================== */

/* List items */
.myth-list-item{
  display: flex;
  align-items: center;
  width: 100%;
  padding: 18px 20px;
  margin-bottom: 14px;
  border: 1px solid var(--panel-edge);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  font-size: 18px;
  font-weight: 800;
  color: var(--ink);
  cursor: default;
  text-align: left;
}
.myth-list-opened{
  background: var(--btn-on);
  color: #fff;
  border-color: var(--btn-on);
  cursor: pointer;
  &:hover { background: var(--btn-hover); }
  &:active { opacity: .9; }
}

.myth-list-name{ flex: 1; }
.myth-list-chevron{ flex: 0 0 auto; opacity: .8; }
.myth-list-vis{
  flex: 0 0 auto;
  margin-right: 8px;
  opacity: .8;
}
.myth-list-vis-hidden{
  opacity: .35;
}
.myth-list-lock{
  flex: 0 0 auto;
  opacity: .3;
}
.myth-list-opened .myth-list-lock{ opacity: .6; }

/* Back bar */
.myth-back{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 12px 18px;
  margin-bottom: 14px;
  border: 1px solid var(--panel-edge);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 1px;
  color: var(--ink);
  cursor: pointer;
  width: 100%;
  text-align: left;
  &:hover { background: #f0f0f0; }
  &:active { opacity: .9; }
}

/* Myth header card */
.myth-header-card{
  overflow: hidden;
  margin-bottom: 14px;
}
.myth-header-top{
  background: var(--header);
  padding: 24px 20px 18px;
  text-align: center;
}
.myth-title{
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 2px;
  margin: 0;
}
.myth-verse{
  padding: 16px 20px 20px;
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  font-style: italic;
  text-align: center;
  color: var(--btn-on);
  line-height: 1.5;
  white-space: pre-line;
}

/* Omen cards */
.myth-omen-card{
  margin-bottom: 14px;
  padding: 16px 20px;
}
.myth-omen-revealed{
  background: var(--header);
  border-color: var(--panel-edge);
}
.myth-omen-locked{
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--panel);
}
.myth-omen-label{
  font-size: 16px;
  font-weight: 800;
  color: var(--ink);
}
.myth-omen-bullets{
  margin: 10px 0 0 0;
  padding-left: 20px;
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
}
.myth-omen-bullets li{
  margin-bottom: 6px;
}
.myth-omen-bullets li:last-child{ margin-bottom: 0; }

.myth-omen-locked .myth-list-lock{
  opacity: .3;
}

/* Notes card */
.myth-notes-card{
  padding: 18px 16px;
  margin-bottom: 14px;
}

/* GM omen row — label + toggle side by side */
.myth-omen-gm-row{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* Cast section */
.cast-template{
  padding: 14px 0;
  border-bottom: 1px solid rgba(0,0,0,.08);
  text-align: center;
}
.cast-template:last-child{ border-bottom: none; }

/* Myth special table */
#tableSection .card{ text-align: center; }
#tableSection .k-label{ text-align: center; }
#tableSection .dash-select{ text-align: left; display: block; margin-left: auto; margin-right: auto; }
#tableSection .dash-create{ display: block; margin-left: auto; margin-right: auto; max-width: 320px; }

.cast-name{
  font-size: 16px;
  font-weight: 900;
  color: var(--ink);
}
.cast-stats{
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  margin-top: 4px;
}
.cast-desc{
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  margin-top: 6px;
}
.cast-generate{
  display: block;
  margin: 10px auto 0;
  font-size: 14px;
  height: 48px;
  max-width: 320px;
}

/* Generated NPC instance */
.cast-npc{
  margin-top: 10px;
  padding: 12px;
  border-radius: 10px;
  background: rgba(0,0,0,.04);
  border: 1px solid rgba(0,0,0,.08);
}
.cast-npc-slain{ opacity: .5; }
.cast-npc-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.cast-npc-name{
  font-size: 15px;
  font-weight: 800;
}
.cast-npc-status{
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--btn-on);
}
.cast-npc-slain .cast-npc-status{ color: var(--brand-red); }

/* Prompts */
.prompt-row{
  margin-bottom: 8px;
  font-size: 15px;
  line-height: 1.5;
  text-align: center;
}
.prompt-row:last-child{ margin-bottom: 0; }
.prompt-label{
  font-weight: 900;
}
.prompt-value{
  font-weight: 500;
}

#linkSection + #seerSheet,
#linkSection{
  margin-bottom: 18px;
}

/* ===========================
   Companies page
=========================== */
.co-card{
  padding: 20px;
  margin-bottom: 18px;
}
.co-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.co-header-left{
  display: flex;
  align-items: center;
  gap: 8px;
}
.co-default-badge{
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--btn-on);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
}
.co-set-default{
  border: 1px solid var(--btn-on);
  background: transparent;
  color: var(--btn-on);
  font-size: 12px;
  font-weight: 800;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .12s, color .12s;
  &:hover {
    background: var(--btn-on);
    color: #fff;
  }
}
.co-field{
  margin-bottom: 14px;
}
.co-label{
  font-size: 14px;
  font-weight: 900;
  letter-spacing: .5px;
  margin-bottom: 6px;
  color: var(--ink-soft);
}
.co-input{
  font-size: 16px;
}
.co-members{
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.co-member{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(0,0,0,.04);
  border: 1px solid rgba(0,0,0,.06);
}
.co-member-name{
  flex: 1;
  font-size: 15px;
  font-weight: 700;
}
.co-member-role{
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--muted);
}
.co-member-remove{
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity .12s;
  &:hover { opacity: .8; }
}
.co-member-empty{
  padding: 8px 0;
  font-size: 14px;
  color: var(--muted);
  font-style: italic;
}
.co-add-member{
  margin-top: 10px;
}
.co-add-select{
  width: 100%;
  max-width: none;
  font-size: 14px;
  height: 44px;
}
.co-actions{
  margin-top: 18px;
  text-align: center;
}
.co-delete{
  margin: 0 auto;
}
.co-delete-disabled{
  opacity: .3;
  cursor: not-allowed;
}
.co-delete-hint{
  margin-top: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  font-style: italic;
}

/* ===========================
   Steeds & Beasts
=========================== */
.beast-attack{
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 800;
  color: var(--ink);
}
.beast-attack-die{
  font-size: 16px;
  font-weight: 700;
  color: var(--brand-red);
}

.beast-atk-slot{
  padding-bottom: 4px;
}
.beast-atk-row{
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}
.beast-atk-die,
.beast-atk-mult,
.beast-atk-mod{
  width: auto;
  min-width: 60px;
  height: 48px;
  border: 2px solid var(--border-ink);
  border-radius: 10px;
  padding: 0 8px;
  font-size: 16px;
  font-weight: 700;
  text-align: center;
}
.beast-atk-x{
  font-size: 16px;
  font-weight: 900;
  color: var(--muted);
}
.beast-atk-name{
  font-size: 16px;
}
.beast-atk-roll{
  font-size: 14px;
  height: 44px;
}
.beast-atk-result{
  margin-top: 8px;
  padding: 10px 14px;
  background: rgba(var(--brand-red-rgb),.08);
  border: 1px solid rgba(var(--brand-red-rgb),.2);
  border-radius: 10px;
  font-size: 16px;
  font-weight: 800;
  color: var(--brand-red);
  text-align: center;
}

/* Equipment item selector groups */
.kf-group-label{
  padding: 8px 18px 4px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
}
.eq-create-label{
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1px;
  text-align: center;
  margin-bottom: 6px;
  color: var(--ink-soft);
}

/* Knight armour display */
.k-armour-bar{
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0 4px;
  border-top: 1px solid rgba(0,0,0,.08);
}
.k-armour-label{
  font-size: 16px;
  font-weight: 900;
  color: var(--brand-red);
}
.k-armour-total{
  font-size: 22px;
  font-weight: 900;
  color: var(--ink);
  min-width: 36px;
}
.k-armour-breakdown{
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

/* ===========================
   Rules page
=========================== */
.rules-search-bar{
  margin-bottom: 14px;
}
.rules-search-input{
  width: 100%;
  height: 52px;
  border: 2px solid var(--border-ink);
  border-radius: 12px;
  padding: 0 18px;
  font-size: 16px;
  font-weight: 700;
  background: #fff;
  outline: none;
  &:focus { border-color: var(--btn-on); }
}
.rules-toc{
  padding: 18px 20px;
  margin-bottom: 18px;
}
.rules-toc-title{
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 1.5px;
  color: var(--brand-red);
  margin: 0 0 8px;
}
.rules-toc-link{
  display: block;
  padding: 8px 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid rgba(0,0,0,.06);
}
.rules-toc-link:last-of-type{
  border-bottom: none;
}
.rules-toc-link:hover{
  color: var(--btn-on);
}
.rules-section{
  background: var(--panel);
  border-radius: 14px;
  padding: 22px 20px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.rules-title{
  font-size: 20px;
  font-weight: 900;
  letter-spacing: .5px;
  color: var(--ink);
  margin: 0 0 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--brand-red);
}
.rules-sub{
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 1px;
  color: var(--brand-red);
  margin: 18px 0 8px;
}
.rules-content p{
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink-soft);
  margin: 0 0 10px;
}
.rules-content strong{
  font-weight: 800;
  color: var(--ink);
}
.rules-list{
  padding-left: 20px;
  margin: 0 0 10px;
}
.rules-list li{
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink-soft);
  margin-bottom: 4px;
}
.rules-list-num{
  list-style-type: decimal;
}
mark.rules-hl{
  background: rgba(var(--brand-red-rgb),.2);
  color: inherit;
  padding: 1px 2px;
  border-radius: 3px;
}
.rules-no-results{
  text-align: center;
  padding: 30px 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--muted);
}

/* ===========================
   Spark Tables page
=========================== */
.st-tabs{
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.st-tab{
  flex: 1;
  min-width: 0;
  height: 52px;
  border: 2px solid var(--btn-on);
  border-radius: 999px;
  background: transparent;
  color: var(--btn-on);
  font-size: 15px;
  font-weight: 900;
  letter-spacing: .5px;
  cursor: pointer;
  transition: background .12s ease, color .12s ease;
  &:hover {
    background: var(--btn-hover);
    color: #fff;
    border-color: var(--btn-hover);
  }
  &.on {
    background: var(--btn-on);
    color: #fff;
    border-color: var(--btn-on);
  }
}

.st-desc{
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  color: rgba(255,255,255,.75);
  margin-bottom: 14px;
  line-height: 1.4;
}

.st-roll-all{
  display: block;
  width: 100%;
  max-width: 320px;
  margin: 0 auto 18px;
  font-size: 16px;
}

.st-grid{
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
@media (min-width: 580px){
  .st-grid{
    grid-template-columns: 1fr 1fr;
  }
}
@media (min-width: 820px){
  .st-grid{
    grid-template-columns: 1fr 1fr 1fr;
  }
}

.st-card{
  padding: 0;
  overflow: hidden;
}
.st-card-head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--header);
  padding: 12px 16px;
}
.st-card-title{
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 1px;
}
.st-roll-btn{
  width: 44px;
  height: 44px;
  min-width: 44px;
  font-size: 18px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  padding: 0;
}
.st-cols-wrap{
  display: flex;
  gap: 0;
}
.st-col{
  flex: 1;
  padding: 0 0 6px;
}
.st-col + .st-col{
  border-left: 1px solid rgba(0,0,0,.08);
}
.st-col-head{
  padding: 8px 14px 4px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .5px;
  color: var(--muted);
  text-transform: uppercase;
}
.st-cell{
  padding: 6px 14px;
  font-size: 14px;
  font-weight: 600;
  transition: background .15s ease, color .15s ease;
}
.st-cell:nth-child(even){
  background: rgba(0,0,0,.03);
}
.st-cell.st-highlight{
  background: rgba(var(--brand-red-rgb),.12);
  font-weight: 900;
  color: var(--brand-red);
}

.st-result{
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 900;
  color: var(--brand-red);
  padding: 4px 16px;
  text-align: center;
  transition: opacity .1s ease;
  &:empty {
    min-height: 0;
    padding: 0;
  }
}
.st-result-rolling{
  opacity: .5;
}
.st-result-done{
  opacity: 1;
}


@media (max-width: 520px){
  .drawer{
    padding: 14px 18px 12px;
  }

  .close-btn{
    width: 56px;
    height: 56px;
    font-size: 24px;
  }

  .nav{
    margin-top: 18px;
    gap: 14px;
  }

  .nav a{
    font-size: 15px;
  }

  .drawer-context{
    margin-top: 16px;
    gap: 6px;
  }

  .drawer-context-label{
    font-size: 10px;
  }

  .drawer-context-value{
    font-size: 12px;
  }

  .drawer-map-link,
  .drawer-auth-link{
    font-size: 16px;
  }

  .drawer-footer,
  .drawer-version{
    font-size: 11px;
    line-height: 1.25;
  }
}


/* ===========================
   Mobile stat layout fixes
=========================== */
@media (max-width: 520px){
  .k-stat-row{
    grid-template-columns: 74px 34px minmax(88px, 1fr) 34px 64px;
    gap: 6px;
    align-items: center;
  }

  .k-stat-name{
    font-size: 0;
    line-height: 1;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-width: 0;
  }

  .k-stat-abbr{
    font-size: 14px;
    font-weight: 1000;
    line-height: 1;
  }

  .k-mini{
    width: 34px;
    height: 40px;
    font-size: 20px;
  }

  .k-pill{
    min-width: 0;
    height: 40px;
    padding: 0 8px;
    font-size: 16px;
    letter-spacing: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .k-stat-mode{
    display: flex;
    gap: 4px;
    justify-content: flex-end;
  }

  .k-mode-btn{
    width: 30px;
    min-width: 30px;
    height: 40px;
    padding: 0;
    font-size: 0;
    letter-spacing: 0;
    border-width: 2px;
    position: relative;
    overflow: hidden;
  }

  .k-mode-btn::before{
    content: "";
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-size: 10px;
    font-weight: 900;
    line-height: 1;
  }

  .k-mode-btn[data-mode="cur"]::before,
  .k-mode-btn[data-smode="cur"]::before{
    content: "C";
  }

  .k-mode-btn[data-mode="max"]::before,
  .k-mode-btn[data-smode="max"]::before{
    content: "M";
  }
}

@media (max-width: 420px){
  .k-stat-row{
    grid-template-columns: 66px 30px minmax(76px, 1fr) 30px 58px;
    gap: 5px;
  }

  .k-stat-abbr{
    font-size: 13px;
  }

  .k-mini{
    width: 30px;
    height: 38px;
    font-size: 18px;
  }

  .k-pill{
    height: 38px;
    font-size: 14px;
    padding: 0 6px;
  }

  .k-mode-btn{
    width: 27px;
    min-width: 27px;
    height: 38px;
  }

  .k-mode-btn::before{
    font-size: 10px;
  }
}


/* ============================================================
   Combat page (combat.html)
   ============================================================ */

/* Combat – page title */
.cb-title-bar{
  background: var(--btn-on);
  border-radius: var(--radius);
  text-align: center;
  padding: 18px 20px;
  margin-bottom: 14px;
}
.cb-title-bar h1{
  margin: 0;
  font-size: 24px;
  font-weight: 950;
  letter-spacing: 2px;
  color: #fff;
}

/* Combat – loadout bars */
.cb-loadout{ margin-bottom: 18px; }

.cb-row-label{
  font-weight: 900;
  font-size: 14px;
  letter-spacing: .5px;
  color: rgba(255,255,255,.75);
  margin: 12px 0 6px;
}
.cb-row-label:first-child{ margin-top: 0; }

.cb-bar{
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--btn-on);
  border-radius: 10px;
  padding: 12px 16px;
  min-height: 52px;
  color: #fff;
}
.cb-bar-icon{
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  opacity: .7;
}
.cb-bar-name{
  flex: 1;
  font-weight: 700;
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cb-bar-stat{
  flex: 0 0 auto;
  font-weight: 900;
  font-size: 15px;
  letter-spacing: .5px;
  opacity: .9;
}

.cb-bar.cb-bar-empty{
  background: rgba(var(--btn-on-rgb),.35);
  color: rgba(255,255,255,.5);
  font-style: italic;
}

.cb-bar.cb-bar-disabled{
  background: rgba(var(--btn-on-rgb),.2);
  color: rgba(255,255,255,.35);
  pointer-events: none;
}

/* Select within a loadout bar */
.cb-select-wrap{
  position: relative;
  margin-bottom: 0;
}
.cb-select{
  width: 100%;
  height: 52px;
  border: 0;
  border-radius: 10px;
  padding: 0 52px 0 48px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  background-color: var(--btn-on);
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6' fill='none' stroke='%23ffffff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 18px 18px;
  cursor: pointer;
  &:focus { outline: 2px solid rgba(255,255,255,.4); outline-offset: -2px; }
}
.cb-select option{ color: var(--ink); background: #fff; font-weight: 600; }

.cb-select-icon{
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  opacity: .7;
  pointer-events: none;
}
.cb-select-stat{
  position: absolute;
  right: 40px;
  top: 50%;
  transform: translateY(-50%);
  font-weight: 900;
  font-size: 14px;
  color: #fff;
  opacity: .9;
  pointer-events: none;
  letter-spacing: .5px;
}

.cb-select[disabled]{
  background-color: rgba(var(--btn-on-rgb),.2);
  color: rgba(255,255,255,.35);
  cursor: not-allowed;
}

/* Armour checkboxes */
.cb-armour-list{
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cb-armour-item{
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--btn-on);
  border-radius: 10px;
  padding: 10px 16px;
  min-height: 46px;
  color: #fff;
  cursor: pointer;
  transition: opacity .15s;
}
.cb-armour-item.cb-armour-off{
  opacity: .35;
}
.cb-armour-check{
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  border: 2px solid rgba(255,255,255,.6);
  border-radius: 4px;
  display: grid;
  place-items: center;
}
.cb-armour-item:not(.cb-armour-off) .cb-armour-check::after{
  content: "✓";
  font-size: 14px;
  font-weight: 900;
  color: #fff;
}
.cb-armour-name{ flex: 1; font-weight: 700; font-size: 15px; }
.cb-armour-val{ font-weight: 900; font-size: 14px; opacity: .9; }

.cb-armour-total{
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  padding: 6px 16px 0;
  color: rgba(255,255,255,.75);
  font-weight: 900;
  font-size: 15px;
  letter-spacing: .5px;
}

/* Steed toggle */
.cb-steed-wrap{
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--btn-on);
  border-radius: 10px;
  padding: 12px 16px;
  min-height: 52px;
  color: #fff;
  cursor: pointer;
  transition: opacity .15s;
}
.cb-steed-wrap.cb-steed-off{ opacity: .35; }
.cb-steed-check{
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  border: 2px solid rgba(255,255,255,.6);
  border-radius: 4px;
  display: grid;
  place-items: center;
}
.cb-steed-wrap:not(.cb-steed-off) .cb-steed-check::after{
  content: "✓";
  font-size: 14px;
  font-weight: 900;
  color: #fff;
}
.cb-steed-name{ flex: 1; font-weight: 700; font-size: 16px; }
.cb-steed-stat{ font-weight: 900; font-size: 15px; opacity: .9; letter-spacing: .5px; }

/* Combat – flow steps */
.cb-flow{ margin-top: 18px; }

.cb-step{
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 20px;
  margin-bottom: 14px;
  text-align: center;
}

.cb-step-title{
  font-weight: 950;
  font-size: 18px;
  letter-spacing: 1.5px;
  margin: 0 0 6px;
}

.cb-step-desc{
  font-size: 15px;
  color: var(--muted);
  margin: 0 0 16px;
  line-height: 1.4;
  &:empty { display: none; }
}

.cb-step-btns{
  display: flex;
  gap: 12px;
}
.cb-step-btn{
  flex: 1;
  height: 52px;
  border: 0;
  border-radius: 999px;
  font-weight: 900;
  font-size: 16px;
  letter-spacing: 1px;
  color: #fff;
  cursor: pointer;
  transition: background .12s, transform .08s;
  &:active { transform: translateY(1px); }
}
.cb-btn-no{
  background: var(--brand-red);
  &:hover { background: var(--brand-red-hover); }
}
.cb-btn-yes{
  background: var(--btn-on);
  &:hover { background: var(--btn-hover); }
}
.cb-btn-ok{
  background: var(--btn-on);
  flex: 0 1 260px;
  margin: 0 auto;
  &:hover { background: var(--btn-hover); }
}

.cb-step-reset{
  display: none;
  align-items: center;
  justify-content: center;
  margin-top: 10px;
  background: none;
  border: none;
  cursor: pointer;
  opacity: .35;
  transition: opacity .15s;
  padding: 4px;
  &:hover { opacity: .6; }
}

/* Answered steps: muted with chosen answer shown */
.cb-step.cb-step-answered{
  opacity: .5;
  padding: 14px 20px;
}
.cb-step.cb-step-answered .cb-step-btns{ display: none; }
.cb-step.cb-step-answered .cb-step-reset{ display: inline-flex; }
.cb-step-answer{
  display: none;
  font-weight: 900;
  font-size: 15px;
  letter-spacing: 1px;
  margin-top: 4px;
}
.cb-step-answered .cb-step-answer{ display: block; }
.cb-step-answer.answer-yes{ color: var(--btn-on); }
.cb-step-answer.answer-no{ color: var(--brand-red); }

/* Info banner (e.g. "Surprised!" result) */
.cb-info{
  background: rgba(var(--brand-red-rgb),.12);
  border: 2px solid var(--brand-red);
  border-radius: var(--radius);
  padding: 14px 20px;
  margin-bottom: 14px;
  text-align: center;
}
.cb-info-title{
  font-weight: 950;
  font-size: 16px;
  color: var(--brand-red);
  letter-spacing: 1px;
  margin: 0 0 4px;
}
.cb-info-desc{
  font-size: 14px;
  color: var(--ink);
  margin: 0;
  line-height: 1.4;
}

/* Master reset */
.cb-reset-bar{
  text-align: center;
  padding: 8px 0 4px;
}
.cb-reset-btn{
  background: var(--brand-red);
  color: #fff;
  border: 0;
  border-radius: 999px;
  height: 48px;
  padding: 0 32px;
  font-weight: 900;
  font-size: 15px;
  letter-spacing: 1px;
  cursor: pointer;
  transition: background .12s, transform .08s;
  &:hover { background: var(--brand-red-hover); }
  &:active { transform: translateY(1px); }
}

/* Combat – input rows (stepper pills) */
.cb-input-row{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 10px 0 4px;
}
.cb-input-pill{
  min-width: 64px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--header);
  border: 2px solid var(--border-ink);
  border-radius: 10px;
  font-weight: 950;
  font-size: 20px;
  letter-spacing: 1px;
}

/* Combat – damage calculation display */
.cb-damage-calc{
  font-size: 15px;
  color: var(--muted);
  margin: 4px 0 8px;
  line-height: 1.5;
}
.cb-damage-total{
  font-size: 42px;
  font-weight: 950;
  letter-spacing: 2px;
  color: var(--brand-red);
  margin: 4px 0 2px;
}

/* Combat – result card */
.cb-result-icon{
  font-size: 40px;
  margin-bottom: 6px;
}
.cb-result-detail{
  font-size: 15px;
  color: var(--muted);
  margin-top: 8px;
  line-height: 1.5;
  &:empty { display: none; }
}

/* Result colour overrides */
.cb-step.result-evade{ border-color: var(--btn-on); border-width: 2px; }
.cb-step.result-evade .cb-step-title{ color: var(--btn-on); }

.cb-step.result-wound{ border-color: var(--brand-red); border-width: 2px; }
.cb-step.result-wound .cb-step-title{ color: var(--brand-red); }

.cb-step.result-scar{ border-color: var(--brand-red); border-width: 2px; }
.cb-step.result-scar .cb-step-title{ color: var(--brand-red); }

.cb-step.result-mortal{ border-color: var(--brand-red); border-width: 3px; background: rgba(var(--brand-red-rgb),.06); }
.cb-step.result-mortal .cb-step-title{ color: var(--brand-red); }

.cb-step.result-slain{ border-color: var(--brand-red); border-width: 3px; background: rgba(var(--brand-red-rgb),.12); }
.cb-step.result-slain .cb-step-title{ color: var(--brand-red); }
