/* Tantu Player-HUD — responsiver D&D-Charakterbogen (Issue 559, PT1)
   NUR Theme-CSS-Variablen (--bg --surface --surface2 --amber --green --red --text --muted),
   KEINE Hex-Literale. Vanilla, Babel-frei. */

/* ===== Full-screen Overlay ===== */
#tantuHud {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  font-family: 'DM Sans', sans-serif;
  overflow: hidden;
}
#tantuHud[hidden] { display: none; }

/* ===== Header ===== */
.hud-head {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .6rem .8rem;
  background: var(--surface);
  border-bottom: 1px solid var(--surface2);
  flex-shrink: 0;
}
.hud-head .hud-portrait {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 2px solid var(--amber);
  object-fit: cover;
  background: var(--surface2);
  flex-shrink: 0;
}
.hud-head .hud-id { flex: 1; min-width: 0; }
.hud-head .hud-name {
  font-family: 'Cinzel', serif;
  color: var(--amber);
  font-size: 1.05rem;
  line-height: 1.1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hud-head .hud-meta { font-size: .8rem; color: var(--muted); }
.hud-insp {
  display: inline-flex; align-items: center; gap: .25rem;
  font-size: .72rem; color: var(--bg);
  background: var(--amber);
  border-radius: 999px;
  padding: .15rem .5rem;
  font-weight: 600;
  white-space: nowrap;
}
.hud-insp[data-on="0"] {
  background: var(--surface2);
  color: var(--muted);
}
.hud-close {
  min-width: 44px; min-height: 44px;
  border: 1px solid var(--surface2);
  border-radius: 8px;
  background: var(--surface2);
  color: var(--text);
  font-size: 1.2rem;
  cursor: pointer;
  flex-shrink: 0;
}
.hud-close:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

/* ===== Scroll-Body + Grid ===== */
.hud-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: .7rem .7rem calc(64px + 1rem);
}
.hud-grid {
  display: grid;
  grid-template-columns: 1fr;          /* Mobile <576: 1 Spalte */
  gap: .7rem;
  max-width: 1320px;
  margin: 0 auto;
}

/* ===== Panels ===== */
.hud-panel {
  background: var(--surface);
  border: 1px solid var(--surface2);
  border-radius: 12px;
  padding: .8rem;
}
.hud-panel h3 {
  font-family: 'Cinzel', serif;
  color: var(--amber);
  font-size: .95rem;
  margin: 0 0 .6rem;
}
/* Mobile: nur aktives Panel sichtbar (Tab-Steuerung) */
.hud-panel { display: none; }
.hud-panel.active { display: block; }

/* ===== Tablet >=768: 2 Spalten, alle Panels sichtbar, Tabs aus ===== */
@media (min-width: 768px) {
  .hud-grid { grid-template-columns: repeat(2, 1fr); align-items: start; }
  .hud-panel { display: block; }
  .hud-tabs { display: none; }
  .hud-body { padding-bottom: 1rem; }
  /* Combat ueber volle Breite */
  .hud-panel[data-tab="combat"] { grid-column: 1 / -1; }
}
/* ===== Desktop >=1200: 3 Spalten klassisches Bogen-Layout ===== */
@media (min-width: 1200px) {
  .hud-grid { grid-template-columns: repeat(3, 1fr); }
  .hud-panel[data-tab="combat"] { grid-column: auto; }
}

/* ===== Stat-Leiste (Combat) ===== */
.hud-statbar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
  gap: .4rem;
  margin-bottom: .7rem;
}
.hud-stat {
  background: var(--surface2);
  border-radius: 10px;
  padding: .5rem .3rem;
  text-align: center;
  min-height: 44px;
  display: flex; flex-direction: column; justify-content: center;
}
.hud-stat .v {
  font-family: 'Cinzel', serif;
  font-size: 1.3rem;
  color: var(--text);
  line-height: 1.1;
}
.hud-stat .l {
  font-size: .65rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* HP-Ring farbcodiert */
.hud-hpring {
  width: 88px; height: 88px;
  border-radius: 50%;
  margin: 0 auto;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(closest-side, var(--surface) 78%, transparent 79%),
    conic-gradient(var(--ring-color, var(--green)) calc(var(--ring-pct, 100) * 1%), var(--surface2) 0);
}
.hud-hpring .hp-cur { font-family: 'Cinzel', serif; font-size: 1.3rem; color: var(--text); line-height: 1; }
.hud-hpring .hp-max { font-size: .7rem; color: var(--muted); }
.hud-hpring .hp-temp { font-size: .68rem; color: var(--amber); }
.hud-hpwrap { text-align: center; }
.hud-hpwrap .hp-label { font-size: .65rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-top: .25rem; }

/* ===== Death Saves ===== */
.hud-death {
  margin: .6rem 0;
  padding: .6rem;
  border: 1px solid var(--red);
  border-radius: 10px;
  background: var(--surface2);
}
.hud-death .dl { font-size: .75rem; color: var(--red); text-transform: uppercase; letter-spacing: .05em; margin-bottom: .35rem; font-weight: 600; }
.hud-death .row { display: flex; align-items: center; gap: .5rem; margin-bottom: .3rem; }
.hud-death .row .cap { font-size: .8rem; width: 64px; color: var(--muted); }
.hud-pip { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--muted); display: inline-block; }
.hud-pip.succ-on { background: var(--green); border-color: var(--green); }
.hud-pip.fail-on { background: var(--red); border-color: var(--red); }

/* ===== Action-Liste ===== */
.hud-actions { display: flex; flex-direction: column; gap: .4rem; }
.hud-action {
  display: flex; align-items: center; gap: .5rem;
  background: var(--surface2);
  border: 1px solid var(--surface2);
  border-radius: 10px;
  padding: .5rem .6rem;
  min-height: 44px;
}
.hud-action .a-name { flex: 1; font-size: .9rem; color: var(--text); }
.hud-action .a-tag {
  font-size: .62rem; text-transform: uppercase; letter-spacing: .03em;
  color: var(--bg); background: var(--amber);
  border-radius: 6px; padding: .12rem .4rem;
}
.hud-action .a-tag[data-t="bonus"] { background: var(--green); }
.hud-action .a-tag[data-t="reaction"] { background: var(--purple, var(--muted)); }
.hud-action .a-dmg { font-size: .8rem; color: var(--muted); white-space: nowrap; }

/* ===== Abilities ===== */
.hud-abilities {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .4rem;
}
.hud-ability {
  background: var(--surface2);
  border-radius: 10px;
  padding: .5rem .3rem;
  text-align: center;
  min-height: 44px;
}
.hud-ability .ab-mod { font-family: 'Cinzel', serif; font-size: 1.4rem; color: var(--amber); line-height: 1; }
.hud-ability .ab-score { font-size: .72rem; color: var(--muted); }
.hud-ability .ab-l { font-size: .66rem; color: var(--text); text-transform: uppercase; letter-spacing: .04em; margin-top: .15rem; }

/* ===== Saves / Skills rows ===== */
.hud-list { display: flex; flex-direction: column; gap: .15rem; }
.hud-rowitem {
  display: flex; align-items: center; gap: .5rem;
  padding: .4rem .3rem;
  min-height: 44px;
  border-bottom: 1px solid var(--surface2);
}
.hud-rowitem:last-child { border-bottom: none; }
.hud-rowitem .ri-name { flex: 1; font-size: .85rem; color: var(--text); }
.hud-rowitem .ri-gov { font-size: .65rem; color: var(--muted); text-transform: uppercase; }
.hud-rowitem .ri-val { font-family: 'Cinzel', serif; font-size: .95rem; color: var(--text); min-width: 36px; text-align: right; }
.hud-prof {
  width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid var(--muted);
  flex-shrink: 0;
}
.hud-prof.on { background: var(--amber); border-color: var(--amber); }

.hud-passives {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; margin-top: .6rem;
}

/* ===== Card-Grids (Spells/Inventory) ===== */
.hud-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: .5rem;
}
.hud-card {
  background: var(--surface2);
  border: 1px solid var(--surface2);
  border-radius: 10px;
  padding: .6rem;
  min-height: 44px;
  cursor: pointer;
  text-align: left;
  color: var(--text);
  width: 100%;
  font: inherit;
}
.hud-card:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.hud-card .c-name { font-size: .9rem; color: var(--text); font-weight: 600; }
.hud-card .c-sub { font-size: .75rem; color: var(--muted); margin-top: .2rem; }
.hud-badge {
  display: inline-block;
  font-size: .62rem; text-transform: uppercase; letter-spacing: .03em;
  border-radius: 6px; padding: .12rem .4rem;
  margin-left: .3rem;
}
.hud-badge.equipped { background: var(--green); color: var(--bg); }
.hud-badge.attuned { background: var(--amber); color: var(--bg); }

/* ===== Spell-Akkordeon ===== */
.hud-acc { display: flex; flex-direction: column; gap: .4rem; }
.hud-acc-head {
  display: flex; align-items: center; gap: .5rem;
  width: 100%;
  min-height: 44px;
  background: var(--surface2);
  border: 1px solid var(--surface2);
  border-radius: 10px;
  padding: .5rem .6rem;
  cursor: pointer;
  color: var(--text);
  font: inherit;
}
.hud-acc-head:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.hud-acc-head .ah-lvl { flex: 1; text-align: left; font-family: 'Cinzel', serif; color: var(--amber); font-size: .9rem; }
.hud-acc-head .ah-slots { font-size: .75rem; color: var(--muted); }
.hud-acc-body { padding: .3rem 0 .5rem; }
.hud-acc-body[hidden] { display: none; }

/* ===== Bio / Currency ===== */
.hud-bio-block { margin-bottom: .7rem; }
.hud-bio-block .bb-l { font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: .2rem; }
.hud-bio-block .bb-v { font-size: .85rem; white-space: pre-wrap; line-height: 1.5; }
.hud-coins { display: grid; grid-template-columns: repeat(5, 1fr); gap: .3rem; }
.hud-coin { background: var(--surface2); border-radius: 8px; padding: .4rem .2rem; text-align: center; min-height: 44px; display: flex; flex-direction: column; justify-content: center; }
.hud-coin .v { font-family: 'Cinzel', serif; font-size: 1rem; color: var(--text); }
.hud-coin .l { font-size: .62rem; color: var(--muted); text-transform: uppercase; }

.hud-empty { color: var(--muted); font-size: .85rem; padding: .4rem 0; }

/* ===== Bottom-Tab-Bar (Mobile, Daumenzone) ===== */
.hud-tabs {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--surface2);
  z-index: 2;
}
.hud-tab {
  flex: 1;
  min-height: 56px;
  min-width: 44px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: .65rem;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .15rem;
  cursor: pointer;
  padding: .3rem .1rem;
}
.hud-tab .ti { font-size: 1.1rem; line-height: 1; }
.hud-tab.active { color: var(--amber); }
.hud-tab.active .ti { transform: translateY(-1px); }
.hud-tab:focus-visible { outline: 2px solid var(--amber); outline-offset: -2px; }

/* ===== Non-modales Bottom-Sheet (Progressive Disclosure) ===== */
.hud-sheet {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  max-height: 55%;
  background: var(--surface);
  border-top: 2px solid var(--amber);
  border-radius: 16px 16px 0 0;
  padding: .8rem .8rem 1rem;
  overflow-y: auto;
  z-index: 5;
  box-shadow: 0 -6px 20px rgba(0,0,0,.4);
  transform: translateY(0);
}
.hud-sheet[hidden] { display: none; }
.hud-sheet .sh-head {
  display: flex; align-items: center; gap: .5rem; margin-bottom: .5rem;
}
.hud-sheet .sh-title { flex: 1; font-family: 'Cinzel', serif; color: var(--amber); font-size: 1rem; }
.hud-sheet .sh-close {
  min-width: 44px; min-height: 44px;
  border: 1px solid var(--surface2);
  border-radius: 8px;
  background: var(--surface2);
  color: var(--text);
  font-size: 1.1rem;
  cursor: pointer;
}
.hud-sheet .sh-close:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.hud-sheet .sh-row { font-size: .82rem; margin-bottom: .35rem; }
.hud-sheet .sh-row .k { color: var(--muted); margin-right: .3rem; }
.hud-sheet .sh-desc { font-size: .85rem; line-height: 1.5; white-space: pre-wrap; margin-top: .4rem; }

/* ===== Print-Button ===== */
.hud-print-btn {
  min-width: 44px; min-height: 44px;
  border: 1px solid var(--surface2);
  border-radius: 8px;
  background: var(--surface2);
  color: var(--text);
  font-size: 1.1rem;
  cursor: pointer;
  flex-shrink: 0;
}
.hud-print-btn:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

/* ===== @media print — A4-Bogen-Layout (Issue 561) ===== */
@media print {
  @page { size: A4; margin: 1.5cm; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

  /* Wenn HUD offen: alle anderen Body-Kinder ausblenden */
  body:has(#tantuHud) > *:not(#tantuHud) { display: none !important; }

  /* Fixed-Overlay auflösen; dunkle Theme-Farben → helles Papier */
  #tantuHud {
    position: static !important;
    inset: auto !important;
    overflow: visible !important;
    height: auto !important;
    max-height: none !important;
    z-index: auto !important;
    display: flex !important;
    flex-direction: column !important;
    --bg: #ffffff;
    --surface: #f5f5f8;
    --surface2: #e4e4ee;
    --text: #1a1a2e;
    --muted: #555570;
  }

  /* UI-Elemente die nicht gedruckt werden */
  .hud-tabs, .hud-close, .hud-sheet, .hud-roll-sheet, .hud-modal,
  .hud-hpctl, .hud-rests, .hud-roll-btn, .hud-featctl, #hudToast,
  .hud-craft-open, .hud-print-btn { display: none !important; }

  /* Scroll-Container aufheben */
  .hud-body { overflow: visible !important; padding: 0 !important; flex: none !important; }

  /* 2-Spalten A4-Raster */
  .hud-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: .6rem !important;
    align-items: start;
  }

  /* Alle Panels entfaltet anzeigen */
  .hud-panel { display: block !important; }

  /* Druckreihenfolge + Seitenumbrüche (CSS order re-sortiert DOM-Reihenfolge):
     Seite 1: Combat | Skills (Abilities/Saves)
     Seite 2: Bio (voll) + Features | Inventory
     Seite 3: Spells (voll)  */
  .hud-panel[data-tab="combat"]    { order: 1; }
  .hud-panel[data-tab="skills"]    { order: 2; }
  .hud-panel[data-tab="bio"]       { order: 3; grid-column: 1 / -1; break-before: page; page-break-before: always; }
  .hud-panel[data-tab="features"]  { order: 4; }
  .hud-panel[data-tab="inventory"] { order: 5; }
  .hud-panel[data-tab="spells"]    { order: 6; grid-column: 1 / -1; break-before: page; page-break-before: always; }

  /* Kein Zerreißen von Content-Einheiten an Seitenrändern */
  .hud-stat, .hud-ability, .hud-action, .hud-action-wrap,
  .hud-rowitem, .hud-bio-block, .hud-card, .hud-card-wrap,
  .hud-acc-head, .hud-acc-body, .hud-death, .hud-coin, .hud-panel,
  table, tr { break-inside: avoid; page-break-inside: avoid; }

  /* Akkordeon-Körper immer aufgeklappt (Spells-Slots sichtbar) */
  .hud-acc-body[hidden] { display: block !important; }
}

/* ===== Interaktion (Issue 560): Tap-to-Roll + Live-Mutationen ===== */
/* Button-Resets fuer rollbar gewordene Elemente */
button.hud-ability, button.hud-rowitem, button.hud-stat {
  font: inherit; color: inherit; cursor: pointer;
  -webkit-appearance: none; appearance: none; width: 100%;
  border: none; text-align: left;
}
button.hud-stat { background: var(--surface2); }
button.hud-rowitem { background: transparent; border-bottom: 1px solid var(--surface2); }
.hud-roll { position: relative; }
.hud-roll:active { filter: brightness(1.15); }
.hud-roll:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

/* HP-Steuerung */
.hud-hpctl {
  display: flex; align-items: center; justify-content: center;
  gap: .4rem; flex-wrap: wrap; margin: .5rem 0;
}
.hud-step {
  min-width: 44px; min-height: 44px;
  border-radius: 10px; border: 1px solid var(--surface2);
  background: var(--surface2); color: var(--text);
  font-size: 1.3rem; font-weight: 700; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.hud-step.plus { color: var(--green); }
.hud-step.minus { color: var(--red); }
.hud-step:active { filter: brightness(1.2); }
.hud-step:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.hud-step-l { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; min-width: 48px; text-align: center; }

/* Action-Zeile mit Roll-Button */
.hud-action-wrap { display: flex; align-items: stretch; gap: .35rem; }
.hud-action-wrap .hud-action { flex: 1; }
.hud-roll-btn {
  min-width: 44px; min-height: 44px;
  border-radius: 10px; border: 1px solid var(--amber);
  background: var(--surface2); color: var(--amber);
  font-size: 1.1rem; cursor: pointer;
}
.hud-roll-btn:active { filter: brightness(1.2); }
.hud-roll-btn:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

/* Rest-Buttons (Daumenzone) */
.hud-rests { display: flex; gap: .5rem; margin-top: .8rem; }
.hud-rest {
  flex: 1; min-height: 44px;
  border-radius: 10px; border: 1px solid var(--amber);
  background: var(--surface2); color: var(--amber);
  font-size: .95rem; font-weight: 600; cursor: pointer;
  padding: .5rem .6rem;
}
.hud-rest.danger { border-color: var(--red); color: var(--red); }
.hud-rest:active { filter: brightness(1.2); }
.hud-rest:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.hud-death .hud-rest { width: 100%; margin-top: .5rem; }

/* Pips als 44px-Tap-Targets mit 22px-Punkt */
button.hud-pip {
  width: 44px; height: 44px; min-width: 44px; min-height: 44px;
  padding: 0; background: transparent; border: none; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
button.hud-pip::before {
  content: ''; width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--muted); box-sizing: border-box;
}
button.hud-pip.succ-on::before { background: var(--green); border-color: var(--green); }
button.hud-pip.fail-on::before { background: var(--red); border-color: var(--red); }
button.hud-pip.slot::before { border-color: var(--amber); }
button.hud-pip.slot.used::before { background: var(--amber); border-color: var(--amber); }
button.hud-pip:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; border-radius: 50%; }
.hud-slotpips { display: flex; flex-wrap: wrap; gap: .1rem; margin-bottom: .4rem; }

/* Feat-Karte mit Use-Controls */
.hud-card-wrap { display: flex; align-items: stretch; gap: .35rem; }
.hud-card-wrap .hud-card { flex: 1; }
.hud-featctl { display: flex; flex-direction: column; gap: .2rem; }
.hud-featctl .hud-step { min-height: 21px; height: 21px; font-size: 1rem; min-width: 44px; }

/* Roll-Chooser Bottom-Sheet */
.hud-roll-sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 100020;
  background: var(--surface); border-top: 2px solid var(--amber);
  border-radius: 16px 16px 0 0; padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -6px 24px rgba(0, 0, 0, .4);
}
.hud-roll-sheet[hidden] { display: none; }
.hud-roll-sheet .sh-head { display: flex; align-items: center; margin-bottom: .6rem; }
.hud-roll-sheet .hr-title { flex: 1; font-family: 'Cinzel', serif; color: var(--amber); font-size: 1.05rem; }
.hud-roll-sheet .sh-close {
  min-width: 44px; min-height: 44px; background: var(--surface2);
  border: none; color: var(--text); border-radius: 10px; font-size: 1.1rem; cursor: pointer;
}
.hr-choices { display: flex; flex-direction: column; gap: .6rem; }
.hr-real-wrap { display: flex; gap: .5rem; }
.hr-real {
  flex: 0 0 84px; min-height: 44px; text-align: center;
  background: var(--surface2); border: 1px solid var(--surface2);
  border-radius: 10px; color: var(--text); font-size: 1.1rem;
}
.hr-real-wrap .hud-rest { flex: 1; }
.hr-result { text-align: center; }
.hr-total { font-family: 'Cinzel', serif; font-size: 2.6rem; color: var(--amber); line-height: 1.1; }
.hr-total.crit { color: var(--green); }
.hr-total.fumble { color: var(--red); }
.hr-bd { font-size: .85rem; color: var(--muted); margin-bottom: .4rem; }

/* Long-Rest Confirm Modal */
.hud-modal {
  position: fixed; inset: 0; z-index: 100030;
  background: rgba(0, 0, 0, .55);
  display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.hud-modal[hidden] { display: none; }
.hud-modal .hm-card {
  background: var(--surface); border: 1px solid var(--amber);
  border-radius: 16px; padding: 1.2rem; max-width: 360px; width: 100%;
}
.hud-modal .hm-title { font-family: 'Cinzel', serif; color: var(--amber); font-size: 1.2rem; margin-bottom: .5rem; }
.hud-modal .hm-body { font-size: .9rem; color: var(--text); line-height: 1.5; margin-bottom: 1rem; }
.hud-modal .hm-actions { display: flex; gap: .6rem; }

/* Toast (Reconcile-Fehler etc.) */
.hud-toast {
  position: fixed; left: 50%; bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%) translateY(20px);
  background: var(--surface2); color: var(--text);
  border: 1px solid var(--amber); border-radius: 10px;
  padding: .6rem 1rem; font-size: .85rem; z-index: 100040;
  opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease;
  max-width: 90vw; text-align: center;
}
.hud-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Crafting (Issue 562): Material -> Ticks -> place_clock vorrücken */
.hud-craft-open { width: 100%; margin-bottom: .6rem; }
.hud-craft-card { max-width: 380px; max-height: 88vh; overflow-y: auto; position: relative; }
.hud-craft-x {
  position: absolute; top: .6rem; right: .6rem;
  width: 44px; height: 44px; min-width: 44px; min-height: 44px;
  background: none; border: none; color: var(--muted); font-size: 1.1rem; cursor: pointer;
}
.hud-craft-x:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.hud-craft-go { background: var(--amber); color: var(--bg); border-color: var(--amber); }
.craft-sec-l {
  font-size: .7rem; color: var(--muted); text-transform: uppercase;
  letter-spacing: .04em; margin: .8rem 0 .35rem;
}
.craft-mats, .craft-clocks { display: flex; flex-direction: column; gap: .4rem; }
.craft-mat, .craft-clock {
  display: flex; align-items: center; gap: .5rem;
  min-height: 44px; width: 100%; text-align: left;
  border-radius: 10px; border: 1px solid var(--surface2);
  background: var(--surface2); color: var(--text);
  font-size: .9rem; padding: .4rem .6rem; cursor: pointer;
}
.craft-mat.on, .craft-clock.on { border-color: var(--amber); color: var(--amber); }
.craft-mat:focus-visible, .craft-clock:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.craft-mat .cm-check { font-size: 1.1rem; }
.craft-mat .cm-name { flex: 1; }
.craft-clock { justify-content: space-between; }
.craft-clock .cc-prog { color: var(--amber); font-size: .8rem; font-variant-numeric: tabular-nums; }
.craft-ticks { display: flex; align-items: center; gap: .8rem; }
.craft-tickval { font-size: 1.1rem; font-weight: 600; color: var(--amber); min-width: 32px; text-align: center; }
.craft-rest {
  margin-top: .6rem; padding: .5rem .6rem; border-radius: 8px;
  background: var(--surface2); color: var(--text); font-size: .85rem;
  border-left: 3px solid var(--amber);
}
.craft-name {
  width: 100%; min-height: 44px; box-sizing: border-box;
  border-radius: 10px; border: 1px solid var(--surface2);
  background: var(--bg); color: var(--text); font-size: .95rem; padding: .5rem .7rem;
}
.craft-name:focus-visible { outline: 2px solid var(--amber); outline-offset: 1px; }
