:root {
  /* Gold family — single source of truth for the whole app. */
  --tl-shell-gold: #d4a65e;         /* primary accent (borders, sigils) */
  --tl-shell-gold-bright: #f6d391;  /* headings / emphasis */
  --tl-shell-gold-nav: #d8b878;     /* header title, active nav */
  --tl-shell-gold-soft: #cbb185;    /* secondary labels / muted actions */
  --tl-shell-line: rgba(212, 166, 94, 0.18);
  --tl-shell-line-strong: rgba(242, 199, 119, 0.4);
  --tl-shell-muted: rgba(220, 199, 158, 0.72);  /* body-muted (raised for contrast) */
  --tl-shell-faint: rgba(220, 199, 158, 0.6);   /* smallest labels floor */
  /* Semantic accents (unify the per-page --good/--bad, --red/--green sets). */
  --tl-shell-good: #7ee0a6;
  --tl-shell-bad: #ff9d84;
  --tl-shell-warn: #f2c777;
  --tl-shell-blue: #72a9ff;
  /* Radius scale. */
  --tl-r-sm: 8px;
  --tl-r-md: 10px;
  --tl-r-lg: 13px;
  --tl-r-pill: 999px;
}

.tl-skip-link {
  position: fixed;
  z-index: 2000;
  left: 14px;
  top: 10px;
  padding: 10px 14px;
  border-radius: var(--tl-r-sm);
  color: #0b0805;
  background: var(--tl-shell-gold-bright);
  transform: translateY(-160%);
  transition: transform 0.15s ease;
}

.tl-skip-link:focus { transform: translateY(0); }

.tl-visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.tl-app-header {
  position: relative;
  z-index: 5;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: minmax(190px, auto) minmax(0, 1fr) auto;
  align-items: center;
  column-gap: clamp(16px, 2.4vw, 42px);
  min-height: 64px;
  width: 100%;
  padding: 10px clamp(16px, 2.2vw, 34px);
  border-bottom: 1px solid var(--tl-shell-line);
  background: linear-gradient(180deg, rgba(20, 15, 9, 0.9), rgba(12, 9, 6, 0.72));
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(14px);
  view-transition-name: tl-app-header;
}

::view-transition-group(tl-app-header) { animation-duration: 120ms; }
::view-transition-old(root),
::view-transition-new(root) { animation-duration: 140ms; animation-timing-function: ease-out; }

.tl-app-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.tl-app-brand:hover,
.tl-app-brand:focus-visible {
  color: inherit;
  outline: none;
  text-decoration: none !important;
}

.tl-app-logo,
.tl-app-brand-mark {
  position: relative;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: url("./tl-logo.png") center / contain no-repeat;
  box-shadow: 0 0 18px rgba(214, 138, 58, 0.22);
  view-transition-name: tl-app-logo;
}

::view-transition-group(tl-app-logo),
::view-transition-old(tl-app-logo),
::view-transition-new(tl-app-logo) { animation: none; }
::view-transition-old(tl-app-logo) { opacity: 1; }
::view-transition-new(tl-app-logo) { opacity: 0; }

.tl-app-logo > span,
.tl-app-brand-mark > span {
  display: none;
}

.tl-app-brand-copy {
  min-width: 0;
  line-height: 1.05;
}

.tl-app-title,
.tl-app-brand-title {
  display: block;
  color: var(--tl-shell-gold-nav);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.18em;
  white-space: nowrap;
}

.tl-app-subtitle,
.tl-app-brand-subtitle {
  display: block;
  margin-top: 4px;
  color: var(--tl-shell-muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  white-space: nowrap;
}

.tl-app-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
}

.tl-app-nav-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: var(--tl-r-pill);
  color: var(--tl-shell-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-decoration: none;
  text-transform: uppercase;
  white-space: nowrap;
}

.tl-first-run {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 28px;
  align-items: center;
  padding: 22px 24px;
  border: 1px solid rgba(114, 169, 255, 0.3);
  border-radius: 14px;
  background: radial-gradient(600px 180px at 10% 0%, rgba(114, 169, 255, 0.12), transparent 70%), linear-gradient(135deg, rgba(24, 25, 27, 0.92), rgba(14, 11, 7, 0.94));
  box-shadow: 0 18px 50px rgba(0,0,0,.24);
}
.tl-first-run-kicker { color: var(--tl-shell-blue); font-size: 10px; font-weight: 700; letter-spacing: .17em; text-transform: uppercase; }
.tl-first-run h2 { margin: 5px 0 0; color: var(--tl-shell-gold-bright); font: 400 clamp(24px, 3vw, 36px)/1.12 Marcellus, serif; }
.tl-first-run p { max-width: 700px; margin: 9px 0 0; color: #b9a98c; font-size: 13px; line-height: 1.55; }
.tl-first-run-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; max-width: 430px; }
.tl-first-run-actions button { min-height: 42px; padding: 0 16px; border: 1px solid rgba(114,169,255,.55); border-radius: 9px; color: #eaf2ff; background: rgba(114,169,255,.14); cursor: pointer; }
.tl-first-run-actions button.secondary { border-color: rgba(212,166,94,.28); color: #cbb185; background: rgba(212,166,94,.06); }
.tl-first-run-actions small { flex-basis: 100%; color: #7f8fa8; text-align: right; }

.tl-app-nav-item:hover,
.tl-app-nav-item:focus-visible {
  color: var(--tl-shell-gold-nav);
  border-color: rgba(212, 166, 94, 0.24);
  outline: none;
  text-decoration: none !important;
}

.tl-app-nav-item:focus-visible { outline: 2px solid var(--tl-shell-gold-bright); outline-offset: 2px; }

.tl-app-nav-item.is-active {
  color: var(--tl-shell-gold-nav);
  border-color: rgba(212, 166, 94, 0.45);
  background: rgba(212, 166, 94, 0.09);
}

.tl-app-header-end {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
}

.tl-armory-identity {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.tl-app-status-group {
  display: flex;
  align-items: stretch;
}

.tl-app-status {
  min-width: 90px;
  padding: 0 14px;
  border-left: 1px solid var(--tl-shell-line);
  text-align: center;
}

.tl-app-status-label {
  color: var(--tl-shell-faint);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
}

.tl-app-status-value {
  display: block;
  margin-top: 3px;
  color: var(--tl-shell-gold-nav);
  font-family: Marcellus, serif;
  font-size: 15px;
  white-space: nowrap;
}

.tl-app-status-value-muted { color: var(--tl-shell-muted); }

.tl-toolbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  white-space: nowrap;
}

/* Armory carries editable build identity plus creation actions. Keep those
   controls on a deliberate second row instead of allowing them to overflow. */
.tl-armory-header {
  grid-template-columns: minmax(190px, auto) minmax(330px, 1fr) auto;
  row-gap: 8px;
}

.tl-armory-header .tl-toolbar-actions {
  grid-column: 1 / -1;
  justify-content: flex-end;
  flex-wrap: wrap;
}

@media (max-width: 1400px) {
  .tl-app-header { column-gap: 14px; }
  .tl-app-nav { gap: 3px; }
  .tl-app-nav-item { padding-inline: 9px; font-size: 9px; }
}

@media (max-width: 1000px) {
  .tl-app-header {
    grid-template-columns: auto minmax(0, 1fr);
    row-gap: 8px;
  }

  .tl-app-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .tl-app-nav::-webkit-scrollbar { display: none; }

  .tl-app-header-end {
    grid-column: 2;
    grid-row: 1;
    justify-content: flex-end;
  }

  .tl-armory-header { grid-template-columns: auto minmax(0, 1fr); }
  .tl-armory-header .tl-armory-identity { grid-column: 2; grid-row: 1; justify-content: flex-end; }
  .tl-armory-header .tl-app-nav { grid-row: 2; }
  .tl-armory-header .tl-toolbar-actions { grid-row: 3; }

  .tl-toolbar-actions { flex: 0 0 auto; flex-wrap: wrap; }
  .tl-first-run { grid-template-columns: 1fr; gap: 16px; }
  .tl-first-run-actions { justify-content: flex-start; max-width: none; }
  .tl-first-run-actions small { text-align: left; }

  [data-screen-label="Item Picker"] { padding: 12px !important; }
  [data-screen-label="Item Picker"] > div > div { grid-template-columns: 1fr !important; }
  [data-screen-label="Item Picker"] > div > header { flex-wrap: wrap !important; gap: 8px !important; padding: 12px !important; }
}

@media (max-width: 620px) {
  .tl-app-header {
    grid-template-columns: 1fr;
    padding-inline: 14px;
  }

  .tl-app-brand-mark { width: 38px; height: 38px; flex-basis: 38px; }
  .tl-app-header-end { grid-column: 1; grid-row: 2; justify-content: flex-start; }
  .tl-app-nav { grid-column: 1; grid-row: 3; }
  .tl-armory-header .tl-armory-identity { grid-column: 1; grid-row: 2; justify-content: flex-start; }
  .tl-armory-header .tl-app-nav { grid-row: 3; }
  .tl-armory-header .tl-toolbar-actions { grid-row: 4; }
  .tl-app-status:first-child { padding-left: 0; border-left: 0; }

  .tl-toolbar-actions { justify-content: flex-start; white-space: normal; }
  .tl-app-nav-item { min-height: 42px; padding-inline: 14px; font-size: 11px; }
  .tl-app-nav-item.is-active { order: -1; }
  .tl-first-run { padding: 18px 16px; }
  [data-screen-label="Item Picker"] { padding: 8px !important; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation-duration: .01ms !important; }
}
