/* HTR Character Sheet CSS - Orange Neumorphic Theme */
/* "Tactical Field Medic" Aesthetic */

:root {
    /* Hunter Orange Theme → HTR primitive ramp from tokens.css */
    --htr-orange:       var(--htr-500);   /* #FF6A00 — spec base accent (bright); active = #993D00 */
    --htr-orange-dark:  var(--htr-700);   /* #993D00 */
    --htr-orange-light: var(--htr-300);   /* #FFB347 */
    --htr-caution-yellow: var(--htr-caution);   /* #FFD23F — caution-tape stripes */

    /* Ambient cursor-spotlight accent only (see .htr-glow-spotlight) —
       a black-light violet sweep, not Hunter's Flare orange. Borders,
       buttons, and the card border-glow ring stay --htr-orange. */
    --htr-spotlight: var(--blacklight-violet);   /* #8A2BE2 */

    /* Danger/Warning → shared semantic tokens */
    --danger-red:     var(--danger);      /* var(--crimson-600) = #7d3124 */
    --warning-yellow: var(--warning);     /* #FFC107 */
    --safe-green:     var(--success);     /* #1a2b1a */

    /* Base (parchment palette) */
    --bg-black:    var(--parchment-900);  /* #150f0a */
    --bg-dark:     var(--parchment-800);  /* #281e12 */
    --bg-card:     var(--parchment-700);  /* #3a2c1a */
    --text-white:  var(--text);           /* var(--parchment-300) = #c4b59c */
    --text-gray:   var(--text-muted);     /* var(--parchment-400) = #9d8d77 */
    --border-color: var(--border);        /* var(--parchment-600) = #58493a */

    /* Neumorphism — journal-warm shadows */
    --neuro-radius:       var(--radius-lg);    /* 12px */
    --neuro-bg-1:         var(--parchment-900);
    --neuro-bg-2:         var(--ink-900);      /* #0a0605 — very dark scrim */
    --neuro-shadow-glow:  color-mix(in srgb, var(--htr-500) 40%, transparent);
}

/* --neuro-shadow-dark/light derive from --accent, so they must be declared
   on [data-splat="htr"] itself rather than :root above — :root only ever
   sees the shell's default gold --accent, since [data-splat] lives on
   <body>, a descendant of :root, and custom properties resolve var()
   using the value at the declaring element, not the consuming one. */
[data-splat="htr"] {
    --neuro-shadow-dark:  color-mix(in oklch, var(--accent), black 70%);
    --neuro-shadow-light: color-mix(in oklch, var(--accent), black 40%);
}

/* The shared .hdialog-panel picks up --texture-splat (tokens.css §03), which
   under [data-splat="htr"] resolves to --texture-cyber — a repeating grid
   line pattern meant for cards/sheet chrome. On dialogs (Share, Archive
   confirm, etc.) it reads as visual noise, so drop it back to none for any
   dialog scrim nested under an HTR-flagged body. Custom properties inherit,
   so this reaches .hdialog-panel and .hdialog-panel-danger alike without
   touching the shared journal-theme.css rules. */
[data-splat="htr"] .hdialog-scrim {
    --texture-splat: none;
}

/* Sheet Container */
.htr-sheet {
    background: var(--bg-black);
    color: var(--text-white);
    padding: 2rem;
    min-height: 100vh;
}

/* Flat card experiment (was: embossed neumorphic box — dual 18px offset
   shadow + 145deg gradient fill, see git history on this file for the
   original if this doesn't work out). Cards sit flat at rest so the
   cursor-tracked border-glow/spotlight above is the only thing that
   "reacts" to presence, matching reactbits' Magic Bento reference more
   closely. This one file's cards only — nested inputs/selects/textareas
   still carry the old inset neumorphic treatment; see the "NESTED
   NEUMORPHIC — flat-look followup" comment below for the list to revisit
   if this look sticks. Revert with a plain `git revert` on this commit. */
.sheet-section {
    background: var(--neuro-bg-1);
    border: 1px solid var(--border-color);
    /* --glow-bloom (defined with the rest of the cursor-glow custom
       properties, further down this file) drives the actual neon spill;
       it's 0 0 0 0 transparent at rest so this is a no-op until the
       cursor is near. */
    border-color: color-mix(in srgb, var(--htr-orange) calc(var(--glow-intensity) * 100%), var(--border-color));
    box-shadow: var(--glow-bloom, none);
    border-radius: var(--neuro-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: transform 0.3s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    min-width: 0;
    overflow: hidden;
}

/* Magic Bento's card lift — separate from the cursor-tracked border-glow
   below, which reacts to proximity rather than a binary :hover state. */
.sheet-section:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.5), var(--glow-bloom, none);
}

/* NESTED NEUMORPHIC — flat-look followup: these still carry the
   inset 4px/-4px neuro-shadow-dark/neuro-bg-2 "pressed in" treatment
   the card-level flattening above just removed. Leaving them as-is
   for now (out of scope for the glow work) — if the flat card look
   sticks, flatten these to match in the next pass:
     .edge-selection select (+ :hover/:focus)
     .edge-select, .perk-edge-select, .perk-select (+ :hover/:focus)
     .equipment-name (+ :hover/:focus)
     .equipment-description (+ :hover/:focus)
     .advantage-flaw-input (+ :hover/:focus)
     .advantage-flaw-textarea (+ :hover/:focus)
     .touchstone-input (+ :hover/:focus)
     .touchstone-textarea (+ :hover/:focus)
     .form-group input/textarea/select (+ :hover/:focus)
     .form-group-compact input/select (+ :hover/:focus)
   */

.sheet-section h2 {
    color: var(--glow-text);
    margin: 0 0 1rem 0;
    font-size: 1.3rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    border-bottom: 2px solid var(--glow-text);
    padding-bottom: 0.5rem;
}

/* Header */
.sheet-header {
    text-align: center;
    margin-bottom: 2rem;
}

.character-title {
    color: var(--htr-orange);
    font-size: 2.5rem;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 3px;
}

.header-details {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.header-input {
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border-color);
    border-radius: 0;
    color: var(--htr-orange);
    padding: 0.4rem 0.8rem;
    text-align: center;
    min-width: 180px;
    font-size: 0.95rem;
    transition: border-color 0.2s ease;
}

.header-input::placeholder {
    color: var(--htr-orange);
    opacity: 0.5;
    font-style: normal;
}

.header-input:focus {
    outline: none;
    border-bottom-color: var(--htr-orange);
}

.header-input:not(:placeholder-shown) {
    border-bottom-color: var(--htr-orange);
}

.form-group-inline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-group-inline label {
    color: var(--text-gray);
    font-size: 0.9rem;
}

.form-group-inline input,
.form-group-inline select {
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-white);
    padding: 0.4rem 0.8rem;
    box-shadow: none;
}

.form-group-inline input:focus,
.form-group-inline select:focus {
    outline: none;
    border-color: transparent;
    box-shadow: 0 0 8px var(--neuro-shadow-glow);
}

/* Save Indicator */
.save-indicator {
    position: fixed !important;
    top: 20px;
    right: 20px;
    z-index: 6500; /* persistent status toast tier — see z-index scale doc in sheet-layout.css */
    background-color: rgba(26, 26, 26, 0.95);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    border: 2px solid var(--htr-orange);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3),
                0 0 20px rgba(255, 140, 0, 0.2);
    font-size: 0.9rem;
    pointer-events: none;
    animation: slideInRight 0.3s ease-out;
    margin: 0 !important;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.save-indicator .saved {
    color: var(--safe-green);
}

.save-indicator .error {
    color: var(--danger-red);
}

/* Grid Layouts */
.sheet-grid-three-column {
    display: grid;
    grid-template-columns: 25% 40% 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Grid Column Classes */
.column-one,
.column-two,
.column-three {
    display: flex;
    flex-direction: column;
}

.column-left,
.column-middle,
.column-right {
    display: flex;
    flex-direction: column;
}

.sheet-grid-two-column {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.attributes-skills-edges-grid {
    display: grid;
    grid-template-columns: 60% 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.attributes-skills-column {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.edges-perks-column {
    display: flex;
    flex-direction: column;
}

.experience-equipment-grid {
    display: grid;
    grid-template-columns: 30% 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.experience-column {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.equipment-column {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.history-notes-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.history-section,
.notes-section {
    display: flex;
    flex-direction: column;
}

/* Portrait Grid */
.portrait-grid-htr {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    grid-template-rows: 1fr 1fr auto 2fr;
    gap: 0.5rem;
    position: relative;
    min-height: 400px;
}

.portrait-body {
    grid-row: 1 / 5;  /* Span all 4 rows */
    grid-column: 1;
}

.portrait-hobby {
    width: 100%;
    height: 100%;
    aspect-ratio: 1;
}

/* Hobby grid positioning (2x2 in columns 2-3) */
.portrait-hobby:nth-of-type(2) {  /* Hobby 1 */
    grid-row: 1;
    grid-column: 2;
}

.portrait-hobby:nth-of-type(4) {  /* Hobby 2 */
    grid-row: 1;
    grid-column: 3;
}

.portrait-hobby:nth-of-type(6) {  /* Hobby 3 */
    grid-row: 2;
    grid-column: 2;
}

.portrait-hobby:nth-of-type(8) {  /* Hobby 4 */
    grid-row: 2;
    grid-column: 3;
}

.alias-overlay {
    grid-row: 3;
    grid-column: 2 / 4;  /* Span columns 2-3 only, centered above face */
    z-index: 100;
    margin: -1rem 0;
}

.alias-input {
    width: 100%;
    background: transparent;
    border: none;
    font-family: 'Permanent Marker', cursive;
    font-size: 2rem;
    color: var(--htr-orange);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 4px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.9), 0 0 10px rgba(255,140,0,0.6);
    transform: rotate(-2deg);
}

.alias-input::placeholder {
    color: rgba(255, 140, 0, 0.3);
}

.portrait-face {
    grid-row: 4;
    grid-column: 2 / 4;  /* Span columns 2 and 3 */
    width: 100%;
    height: 100%;
}

.portrait-box {
    position: relative;  /* positioning context for .portrait-hint below */
    background-size: cover;
    background-position: center;
    background-color: transparent;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.portrait-box:hover {
    border-color: var(--htr-orange);
    box-shadow: 0 0 15px rgba(255, 140, 0, 0.3);
}

.portrait-placeholder {
    color: var(--text-gray);
    text-align: center;
}

.portrait-placeholder-small {
    color: var(--text-gray);
    font-size: 0.8rem;
    text-align: center;
}

.size-hint {
    font-size: 0.7rem;
    color: var(--text-gray);
    opacity: 0.7;
}

/* "Double tap to upload" — hidden until the box has been hovered a beat
   (same delayed-fade technique as vtm-sheet.css's .divider-tooltip, so
   it doesn't flash on every incidental pass). Wraps instead of nowrap
   so it still fits inside the small hobby-icon boxes. */
.portrait-hint {
    position: absolute;
    left: 50%;
    bottom: 6px;
    transform: translateX(-50%);
    max-width: calc(100% - 12px);
    text-align: center;
    background: var(--leather-800);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    padding: 2px 6px;
    font-family: 'Special Elite', Courier, monospace;
    font-size: 8px;
    line-height: 1.3;
    color: var(--text-gray);
    letter-spacing: 0.5px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 4;
}

.portrait-box:hover .portrait-hint {
    opacity: 1;
}

/* Trackers */
.trackers-section {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    min-height: calc(400px + 2.3rem + 3rem);
}

.trackers-section h2 {
    flex-shrink: 0;
    margin-bottom: 1rem;
}

/* Container for all tracker elements to match portrait grid height */
.trackers-section > .despair-toggle-container,
.trackers-section > .tracker-row {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.tracker-row {
    margin-bottom: 1rem;
}

.tracker-row label {
    display: block;
    color: var(--glow-text);
    font-size: 0.8rem;
    font-weight: bold;
    margin-bottom: 0.3rem;
    letter-spacing: 1px;
}

.tracker-bar {
    display: flex;
    gap: 2px;
    flex-wrap: wrap;
    justify-content: space-between;
    margin-bottom: 0.3rem;
    max-width: 100%;
}

.tracker-box {
    width: 16px;
    height: 16px;
    display: inline-block;
    cursor: pointer;
    border: 1px solid var(--border-color);
    border-radius: 2px;
    transition: all 0.2s ease;
}

.tracker-box.empty {
    background: transparent;
}

.tracker-box.filled {
    background: var(--htr-orange);
}

.tracker-box.safe {
    background: var(--safe-green);
}

.tracker-box.warning {
    background: var(--warning-yellow);
}

.tracker-box.danger {
    background: var(--danger-red);
}

/* #fossil 2026-07-19: orphaned — zero references. */
.tracker-value {
    color: var(--text-gray);
    font-size: 0.85rem;
}

/* #fossil 2026-07-19: orphaned — zero references. */
.warning-text {
    color: var(--warning-yellow);
    font-size: 0.85rem;
    font-weight: bold;
    margin-left: 0.5rem;
}

/* Health & Willpower Boxes */
.health-box,
.willpower-box,
.danger-box,
.desperation-box {
    width: 30px;
    height: 30px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: bold;
    transition: all 0.2s ease;
}

.health-box.empty,
.willpower-box.empty,
.danger-box.empty,
.desperation-box.empty {
    background: var(--bg-dark);
    border-color: var(--border-color);
}

.health-box.full {
    background: var(--safe-green);
    border-color: var(--safe-green);
}

.willpower-box.full {
    background: var(--willpower);
    border-color: var(--willpower);
}


.health-box.superficial,
.willpower-box.superficial {
    background: var(--superficial);
    color: var(--bg-black);
}

.health-box.aggravated,
.willpower-box.aggravated {
    background: var(--danger-red);
    color: var(--text-white);
}

.danger-box.filled {
    background: var(--danger-red);
    border-color: var(--danger-red);
    box-shadow: 0 0 8px color-mix(in srgb, var(--danger-red) 40%, transparent);
}

.desperation-box.filled {
    background: var(--warning-yellow);
    border-color: var(--warning-yellow);
    box-shadow: 0 0 8px color-mix(in srgb, var(--warning-yellow) 40%, transparent);
}

.health-box:hover,
.willpower-box:hover,
.danger-box:hover,
.desperation-box:hover {
    border-color: var(--htr-orange);
    box-shadow: 0 0 8px var(--neuro-shadow-glow);
}

/* Split trackers into 2 groups of 5 (nth-child(7) accounts for the <template x-for> element occupying child slot 1) */
.health-box:nth-child(7),
.willpower-box:nth-child(7),
.danger-box:nth-child(7),
.desperation-box:nth-child(7) {
    margin-left: 0.5rem;
}

/* Despair Toggle Button - Emergency Alarm Style */
.despair-toggle-container {
    text-align: center;
}

.despair-toggle-button {
    width: 100%;
    padding: 1rem 1.5rem;
    border: 3px solid var(--htr-orange);
    border-radius: 12px;
    background: repeating-linear-gradient(
        45deg,
        var(--htr-orange),
        var(--htr-orange) 10px,
        var(--bg-black) 10px,
        var(--bg-black) 20px
    );
    color: var(--warning-yellow);
    font-size: 1.1rem;
    font-weight: bold;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    box-shadow:
        0 4px 8px rgba(0, 0, 0, 0.6),
        inset 0 2px 4px rgba(255, 255, 255, 0.05);
    text-shadow:
        -2px -2px 0 var(--bg-black),
        2px -2px 0 var(--bg-black),
        -2px 2px 0 var(--bg-black),
        2px 2px 0 var(--bg-black),
        -2px 0 0 var(--bg-black),
        2px 0 0 var(--bg-black),
        0 -2px 0 var(--bg-black),
        0 2px 0 var(--bg-black),
        0 0 4px rgba(10, 10, 10, 0.9);
}

.despair-toggle-button:hover {
    border-color: var(--htr-orange-light);
    box-shadow:
        0 6px 12px rgba(255, 140, 0, 0.4),
        inset 0 2px 4px rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.despair-toggle-button.active {
    background: linear-gradient(145deg, var(--danger-red), var(--crimson-700));
    border-color: var(--danger);
    color: white;
    box-shadow:
        0 0 20px color-mix(in srgb, var(--danger) 80%, transparent),
        0 0 40px color-mix(in srgb, var(--danger) 40%, transparent),
        inset 0 2px 4px rgba(0, 0, 0, 0.3);
    animation: alarmPulse 1.5s ease-in-out infinite;
}

.despair-toggle-button.active:hover {
    background: linear-gradient(145deg, var(--crimson-400), var(--crimson-700));
}

.despair-label {
    font-family: 'Courier New', monospace;
    text-shadow:
        -2px -2px 0 var(--bg-dark),
        2px -2px 0 var(--bg-dark),
        -2px 2px 0 var(--bg-dark),
        2px 2px 0 var(--bg-dark),
        -2px 0 0 var(--bg-dark),
        2px 0 0 var(--bg-dark),
        0 -2px 0 var(--bg-dark),
        0 2px 0 var(--bg-dark),
        0 0 4px var(--bg-dark);
}

.despair-toggle-button.active .despair-label {
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

@keyframes alarmPulse {
    0%, 100% {
        box-shadow:
            0 0 20px color-mix(in srgb, var(--danger) 80%, transparent),
            0 0 40px color-mix(in srgb, var(--danger) 40%, transparent),
            inset 0 2px 4px rgba(0, 0, 0, 0.3);
    }
    50% {
        box-shadow:
            0 0 30px var(--danger),
            0 0 60px color-mix(in srgb, var(--danger) 60%, transparent),
            inset 0 2px 4px rgba(0, 0, 0, 0.3);
    }
}

/* #fossil 2026-07-19: orphaned — zero references. */
.bullet-hole-container {
    margin-top: 1rem;
    text-align: center;
}

/* #fossil 2026-07-19: orphaned — zero references. */
.bullet-hole-graphic {
    max-width: 100px;
    filter: drop-shadow(0 0 10px rgba(255, 140, 0, 0.6));
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.8; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.1); }
}

/* Despair Overlay */
.despair-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle,
        rgba(255,140,0,0.3) 0%,
        rgba(255,140,0,0.6) 50%,
        rgba(255,140,0,0.3) 100%);
    pointer-events: none;
    z-index: 5000; /* ambient/decorative tier — see z-index scale doc in sheet-layout.css */
    animation: despairPulse 3s ease-in-out infinite;
}

@keyframes despairPulse {
    0%, 100% {
        opacity: 0.3;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(1.02);
    }
}

/* Attributes */
/* column-gap narrowed from 2rem to 1rem so a divider line can sit in
   the middle of it (1rem gap + 1rem padding-left on the divided side =
   2rem total spacing between columns, same as before); row-gap (used
   only once these collapse to a single stacked column below 1200px)
   stays at 2rem. Mirrors the same fix on WTA's Attributes/Skills. */
.attributes-three-column {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2rem 1rem;
}

.attributes-three-column > .attribute-column:not(:first-child) {
    border-left: 1px solid var(--border-color);
    padding-left: 1rem;
}

.attribute-category-label {
    color: var(--glow-text);
    font-size: 0.9rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    letter-spacing: 1px;
    text-align: center;
}

.attribute-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.attribute-name {
    color: var(--text-white);
    font-size: 0.95rem;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Dots */
.dot-tracker {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Tighter spacing inside the cramped 3-column attribute/skill grids only —
   mirrors the equivalent fix already shipped for VTM's attribute grid
   (.attribute-column .dot-tracker). Other dot-trackers (advantages, flaws)
   have a full-width row and keep the roomier default gap above. */
.attributes-three-column .dot-tracker,
.skills-three-column .dot-tracker {
    gap: 0.15rem;
}

.dot {
    width: 14px;
    height: 14px;
    transform: rotate(45deg);
    border-radius: 3px;
    border: 2px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
    flex-shrink: 0;
}

.dot.filled {
    background: var(--htr-orange);
    border-color: var(--htr-orange);
}

.dot.empty {
    background: var(--bg-dark);
}

.dot:hover {
    transform: rotate(45deg) scale(1.2);
}

/* Skills */
.skills-three-column {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2rem 1rem;
}

.skills-three-column > .skills-column:not(:first-child) {
    border-left: 1px solid var(--border-color);
    padding-left: 1rem;
}

/* display:block overrides sheet-layout.css's shared .attr-row/.skill-row
   rule (display:flex; justify-content:space-between), loaded before this
   file. Without this override, .skill-main and .specialties-list are laid
   out as flex siblings of .skill-row instead of stacking: .skill-main
   shrinks to its own content width (crushing the dot-tracker inward
   instead of pushing it to the column's far edge) and .specialties-list
   ends up squeezed onto the same line instead of the row below. Same fix
   already applied to WTA's .skill-row for the same reason. */
.skill-row {
    display: block;
    margin-bottom: 0.8rem;
    padding: 0.3rem;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.skill-row.drive-boosted {
    background: linear-gradient(90deg,
        rgba(255,140,0,0.15) 0%,
        transparent 100%);
    border-left: 3px solid var(--htr-orange);
    padding-left: 0.5rem;
}

.skill-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.skill-name {
    color: var(--text-white);
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* CSS Diamond for Drive-Boosted Skills */
.skill-diamond {
    display: inline-block;
    width: 0.65rem;
    height: 0.65rem;
    background: var(--htr-orange);
    transform: rotate(45deg);
    box-shadow: 0 0 8px rgba(255, 140, 0, 0.6);
}

.skill-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-add-specialty {
    background: none;
    border: none;
    color: var(--htr-orange);
    cursor: pointer;
    font-weight: bold;
    font-size: 1.1rem;
    padding: 0;
    line-height: 1;
    transition: opacity 0.2s ease;
}

.btn-add-specialty:hover {
    opacity: 0.7;
}

.specialties-list {
    display: flex;
    gap: 0.3rem;
    flex-wrap: wrap;
    margin-top: 0;
    padding-left: 0.5rem;
    max-height: 50px;
    overflow-y: auto;
    overflow-x: hidden;
    align-content: flex-start;
}

.specialties-list::-webkit-scrollbar {
    width: 3px;
}

.specialties-list::-webkit-scrollbar-track {
    background: transparent;
}

.specialties-list::-webkit-scrollbar-thumb {
    background: var(--htr-orange);
    border-radius: 3px;
}

/* Badge (§Badge — .hbadge recipe applied in place; see journal-theme.css) */
.specialty-tag {
    background: var(--bg-dark);
    border: 1px solid var(--htr-orange);
    clip-path: polygon(3px 0%, calc(100% - 3px) 0%, 100% 3px, 100% calc(100% - 3px), calc(100% - 3px) 100%, 3px 100%, 0% calc(100% - 3px), 0% 3px);
    border-radius: 0;
    padding: 2px 10px;
    font-family: 'Special Elite', 'Courier New', monospace;
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--htr-orange);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    flex-shrink: 0;
}

.specialty-tag::before,
.specialty-tag::after {
    content: '\25C6';
    font-size: 0.48em;
    opacity: 0.55;
}

.specialty-tag button {
    background: none;
    border: none;
    color: var(--danger-red);
    cursor: pointer;
    font-size: 1rem;
    padding: 0;
    line-height: 1;
}

/* Page Break - Caution Tape. The gaps between stripes are `transparent`,
   not var(--bg-black) — they only ever looked opaque because that color
   matches the page background. Left opaque, they'd fully block anything
   layered behind the tape, including .htr-luminol-reveal below. */
.page-break-divider.htr-caution-tape {
    /* 38px top (was 3rem/48px — 10px less, per live art direction) while
       the bottom margin stays 3rem so the Advantages/Flaws/Touchstones
       grid below doesn't move; .htr-blood-reveal's mask-position was
       re-tuned to match (133px to 123px, see that rule's comment). */
    margin: 38px 0 3rem;
    padding: 1.5rem 0;
    background: repeating-linear-gradient(
        45deg,
        var(--htr-caution-yellow),
        var(--htr-caution-yellow) 20px,
        transparent 20px,
        transparent 40px
    );
    text-align: center;
    position: relative;
}

/* Blood reveal anchor — wraps the caution-tape divider and the
   Advantages/Flaws/Touchstones grid below it so the hidden blood layer
   can straddle the tape line. It's also a .sheet-section purely so
   htr-glow.js's existing per-element cursor tracking (--glow-x/--glow-y/
   --glow-intensity/--glow-radius, set in the "Cursor glow" block further
   down this file) runs on it — no second cursor-tracking system. Its
   default .sheet-section card chrome (background/border/padding/lift/
   glow-ring) is stripped below since this element is a tracking/
   positioning anchor only, not a visible card. */
.htr-blood-anchor.sheet-section {
    background: none;
    border: none;
    box-shadow: none;
    border-radius: 0;
    padding: 0;
    /* padding-top/margin-top: CSS masks always clip to their own element's
       box (verified — an overflowing absolutely-positioned child gets cut
       at the mask box's edge same as any other content), so
       .htr-blood-reveal's art layer had nowhere to go once its
       mask-position pushed content above this anchor's top edge — that's
       the "cut off above the border" bug. This grows the anchor's actual
       box upward (giving .htr-blood-reveal's inset:0 box real headroom)
       while landing the caution tape back at its original screen position:
       margin-top's -374px = -(350px headroom + 24px), the 24px undoing
       .attributes-skills-edges-grid's margin-bottom (1.5rem), which no
       longer collapses through this anchor once padding-top is non-zero.
       Re-derive both numbers if that preceding section's margin changes. */
    padding-top: 350px;
    margin-top: -374px;
    margin-bottom: 0;
    overflow: visible;
    transition: none;
    /* The 350px headroom above pulls this element's own box up over the
       bottom of the Attributes/Skills/Edges grid rendered right before it
       in the DOM. That headroom has no visible content of its own (the
       reveal art is masked, invisible at rest, and already pointer-events:
       none below) but the anchor's box still silently intercepted clicks
       meant for whatever sat underneath it -- e.g. the lower Skills rows.
       Block pointer events on the anchor itself and re-enable them on the
       one child that's actually interactive (advantages/flaws/touchstones). */
    pointer-events: none;
}

.htr-blood-anchor.sheet-section > .advantages-flaws-touchstones-grid {
    pointer-events: auto;
}

.htr-blood-anchor.sheet-section:hover {
    transform: none;
    box-shadow: none;
}

.htr-blood-anchor.sheet-section::after {
    content: none;
}

/* Hidden blood reveal — invisible at rest, colored like actual dried/wet
   blood (--blood-laser, the same HTR blood-throughline token used
   elsewhere on this sheet, not an invented glow color) inside the
   blacklight cursor's spotlight radius. htr-luminol-blood.png is a
   transparent-background glyph mask (its own color is irrelevant). Two
   mask layers are composited with intersect so a pixel shows only where
   BOTH the art shape AND the cursor-radius spotlight are true:
     layer 1 (art)      — the PNG, scaled to the anchor's full width
                            (its own dimensions are much larger than any
                            sheet width, so native size would clip most
                            of it off-canvas), positioned near the tape
     layer 2 (spotlight) — radial-gradient centered on --glow-x/--glow-y,
                            radius --glow-radius, alpha driven by
                            --glow-intensity so it's fully transparent
                            (and thus the whole layer invisible) at rest,
                            when --glow-intensity defaults to 0.
   Position/size here are a starting point for live tuning, not final. */
.htr-blood-reveal {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: color-mix(in srgb, var(--blood-laser) 65%, black 35%);
    -webkit-mask-image:
        url('/static/images/htr/htr-luminol-blood.png'),
        radial-gradient(circle var(--glow-radius) at var(--glow-x) var(--glow-y),
            color-mix(in srgb, white calc(var(--glow-intensity) * 100%), transparent) 0%,
            transparent 70%);
    mask-image:
        url('/static/images/htr/htr-luminol-blood.png'),
        radial-gradient(circle var(--glow-radius) at var(--glow-x) var(--glow-y),
            color-mix(in srgb, white calc(var(--glow-intensity) * 100%), transparent) 0%,
            transparent 70%);
    -webkit-mask-repeat: no-repeat, no-repeat;
    mask-repeat: no-repeat, no-repeat;
    /* 133px: measured against the anchor's new taller box (see the
       padding-top/margin-top headroom comment above) so the full glyph
       band — not just a sliver of it — crosses the caution tape, clear
       of the Edges/Perks card above and the Advantages/Flaws/Touchstones
       cards below. Recompute if the art asset or anchor layout changes. */
    -webkit-mask-position: center 133px, 0 0;
    mask-position: center 133px, 0 0;
    -webkit-mask-size: 100% auto, 100% 100%;
    mask-size: 100% auto, 100% 100%;
    -webkit-mask-composite: source-in;
    mask-composite: intersect;
    /* Faint wet-surface bloom, not a neon glow — blood doesn't emit its
       own light, so this stays tight and dim compared to the old luminol
       treatment; the actual "light source" read comes from the specular
       reflection below. */
    filter:
        drop-shadow(0 0 2px color-mix(in srgb, var(--blood-laser) 70%, black))
        drop-shadow(0 0 8px color-mix(in srgb, var(--blood-laser) 35%, transparent));
}

/* Reactive blacklight reflection — a tight specular hotspot that tracks
   --glow-x/--glow-y directly (the same JS-driven, per-mousemove values
   htr-glow.js already updates — genuinely dynamic, not a fixed CSS
   timer) so the glint moves exactly where the cursor is, like a UV
   flashlight beam catching a wet surface. --glow-radius is the size of
   the whole reveal spotlight; this reflection uses a much smaller,
   fixed radius so it reads as a sharp glint near the cursor rather than
   filling the entire revealed area. Tinted --blacklight-violet (this
   sheet's established black-light color) rather than the blood's own
   red, since a specular highlight reflects the light source's color,
   not the surface it's lighting. No mask of its own needed — masks
   clip an element's entire painted output including generated content
   (verified empirically), so .htr-blood-reveal's mask already confines
   this pseudo-element to the same visible strokes. */
.htr-blood-reveal::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(circle 90px at var(--glow-x) var(--glow-y),
        color-mix(in srgb, white 65%, var(--blacklight-violet)) 0%,
        color-mix(in srgb, var(--blacklight-violet) 55%, transparent) 45%,
        transparent 75%);
    mix-blend-mode: screen;
    opacity: var(--glow-intensity);
}

/* Edges & Perks */
.edges-note {
    color: var(--text-gray);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

/* Limit Note (for Advantages/Flaws) */
/* #fossil 2026-07-19: orphaned — zero references. */
.limit-note {
    color: var(--text-gray);
    font-size: 0.85rem;
    font-style: italic;
    margin-bottom: 1rem;
    padding: 0.3rem 0.6rem;
    background: rgba(255, 140, 0, 0.05);
    border-left: 3px solid var(--htr-orange);
    border-radius: 3px;
}

/* #fossil 2026-07-19: orphaned — old flat Edges/Perks structure, zero
   references. Live UI uses the nested .edge-with-perks-entry / .perks-nested
   structure (character_sheet.html). */
.edge-config {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.edge-config label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

/* #fossil 2026-07-19: orphaned — old flat Edges/Perks structure, zero
   references. Live UI uses the nested .edge-with-perks-entry / .perks-nested
   structure (character_sheet.html). */
.edge-selection {
    margin-bottom: 1rem;
}

.edge-selection label {
    display: block;
    color: var(--text-gray);
    margin-bottom: 0.3rem;
}

.edge-selection select {
    width: 100%;
    background: var(--neuro-bg-1);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-white);
    padding: 0.5rem;
    box-shadow: inset 4px 4px 8px var(--neuro-shadow-dark), inset -4px -4px 8px var(--neuro-bg-2);
}

.edge-selection select:hover,
.edge-selection select:focus {
    outline: none;
    border-color: var(--htr-orange);
    box-shadow: inset 4px 4px 8px var(--neuro-shadow-dark), inset -4px -4px 8px var(--neuro-bg-2), 0 0 8px var(--neuro-shadow-glow);
}

/* #fossil 2026-07-19: orphaned — old flat Edges/Perks structure, zero
   references. Live UI uses the nested .edge-with-perks-entry / .perks-nested
   structure (character_sheet.html). */
.perk-selection {
    margin-top: 1.5rem;
}

/* #fossil 2026-07-19: orphaned — old flat Edges/Perks structure, zero
   references. Live UI uses the nested .edge-with-perks-entry / .perks-nested
   structure (character_sheet.html). */
.perks-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* #fossil 2026-07-19: orphaned — old flat Edges/Perks structure, zero
   references. Live UI uses the nested .edge-with-perks-entry / .perks-nested
   structure (character_sheet.html). */
.perk-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.3rem;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.perk-checkbox:hover {
    background: rgba(255, 140, 0, 0.1);
}

/* NEW Edge/Perk Entry Styles */
/* #fossil 2026-07-19: orphaned — old flat Edges/Perks structure, zero
   references. Live UI uses the nested .edge-with-perks-entry / .perks-nested
   structure (character_sheet.html). */
.edge-entry,
.perk-entry {
    background: rgba(255, 140, 0, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1rem;
    width: 100%;
    box-sizing: border-box;
}

/* #fossil 2026-07-19: .perk-header half of this selector is orphaned — old
   flat Edges/Perks structure, zero references. .edge-header is still live
   (character_sheet.html); selector left intact. */
.edge-header,
.perk-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    gap: 0.5rem;
}

/* #fossil 2026-07-19: .perk-edge-select is orphaned — old flat Edges/Perks
   structure, zero references. .edge-select and .perk-select are still live
   (character_sheet.html); selector left intact. */
.edge-select,
.perk-edge-select,
.perk-select {
    flex: 1;
    background: var(--neuro-bg-1);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-white);
    padding: 0.5rem;
    box-shadow: inset 4px 4px 8px var(--neuro-shadow-dark), inset -4px -4px 8px var(--neuro-bg-2);
    box-sizing: border-box;
}

.edge-select:hover,
.perk-edge-select:hover,
.perk-select:hover,
.edge-select:focus,
.perk-edge-select:focus,
.perk-select:focus {
    outline: none;
    border-color: var(--htr-orange);
    box-shadow: inset 4px 4px 8px var(--neuro-shadow-dark), inset -4px -4px 8px var(--neuro-bg-2), 0 0 8px var(--neuro-shadow-glow);
}

.edge-description,
.perk-description {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.3);
    border-left: 3px solid var(--htr-orange);
    border-radius: 3px;
    font-size: 0.85rem;
    color: var(--text-gray);
    font-style: italic;
}

/* NESTED Edges & Perks Styles */
.edge-with-perks-entry {
    background: rgba(255, 140, 0, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    width: 100%;
    box-sizing: border-box;
}

.perks-nested {
    margin-top: 1rem;
    margin-left: 1.5rem;
    padding-left: 1rem;
    border-left: 3px solid rgba(255, 140, 0, 0.3);
}

.perks-header {
    margin-bottom: 0.5rem;
}

.perks-label {
    color: var(--glow-text);
    font-size: 0.9rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.perk-nested-entry {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 140, 0, 0.2);
    border-radius: 6px;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: flex-start;
}

.perk-nested-entry .perk-select {
    flex: 1;
    min-width: 0;
}

.perk-nested-entry button {
    flex: 0 0 auto;
    align-self: flex-start;
}

.perk-nested-entry .perk-description {
    width: 100%;
    flex-basis: 100%;
}

.btn-add-small {
    background: var(--neuro-bg-1);
    border: 1px solid var(--border-color);
    border-color: color-mix(in srgb, var(--htr-orange) calc(var(--glow-intensity) * 100%), var(--border-color));
    border-radius: 4px;
    color: var(--htr-orange);
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 0.5rem;
}

.btn-add-small:hover {
    background: color-mix(in srgb, var(--htr-orange) 8%, var(--neuro-bg-1));
}

/* Subsection titles for Edges and Perks within combined section */
/* #fossil 2026-07-19: orphaned — zero references. */
.subsection-title {
    color: var(--glow-text);
    font-size: 1.1rem;
    margin: 1.5rem 0 1rem 0;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid var(--glow-text);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: bold;
}

.subsection-title:first-of-type {
    margin-top: 0.5rem;
}

/* Equipment Entry Styles */
.equipment-entry {
    background: rgba(255, 140, 0, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
}

.equipment-row {
    display: grid;
    grid-template-columns: 200px 1fr auto;
    gap: 0.75rem;
    align-items: start;
}

.equipment-name {
    background: var(--neuro-bg-1);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-white);
    padding: 0.5rem;
    box-shadow: inset 4px 4px 8px var(--neuro-shadow-dark), inset -4px -4px 8px var(--neuro-bg-2);
}

.equipment-name:hover,
.equipment-name:focus {
    outline: none;
    border-color: var(--htr-orange);
    box-shadow: inset 4px 4px 8px var(--neuro-shadow-dark), inset -4px -4px 8px var(--neuro-bg-2), 0 0 8px var(--neuro-shadow-glow);
}

.equipment-description {
    background: var(--neuro-bg-1);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-white);
    padding: 0.5rem;
    box-shadow: inset 4px 4px 8px var(--neuro-shadow-dark), inset -4px -4px 8px var(--neuro-bg-2);
    resize: vertical;
    min-height: 60px;
}

.equipment-description:hover,
.equipment-description:focus {
    outline: none;
    border-color: var(--htr-orange);
    box-shadow: inset 4px 4px 8px var(--neuro-shadow-dark), inset -4px -4px 8px var(--neuro-bg-2), 0 0 8px var(--neuro-shadow-glow);
}

/* Touchstones, Advantages, Flaws Grid */
.advantages-flaws-touchstones-grid {
    align-items: start;
    grid-template-columns: 1fr 1fr 1fr;
}

.advantages-flaws-touchstones-grid .column-left,
.advantages-flaws-touchstones-grid .column-middle,
.advantages-flaws-touchstones-grid .column-right {
    height: 100%;
}

/* Equal height for sections by default, but allow them to grow with content */
.advantages-section,
.flaws-section,
.touchstones-section {
    min-height: 300px;
    display: flex;
    flex-direction: column;
}

/* Touchstones, Advantages, Flaws */
.touchstone-entry,
.advantage-entry,
.flaw-entry {
    background: rgba(255, 140, 0, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1rem;
    width: 100%;
    box-sizing: border-box;
}

.advantage-entry textarea,
.flaw-entry textarea,
.touchstone-entry textarea {
    width: 100%;
    box-sizing: border-box;
}

.advantage-header,
.flaw-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    gap: 0.5rem;
}

.touchstone-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 0.75rem;
}

.advantage-header .dot-tracker,
.flaw-header .dot-tracker {
    flex-shrink: 0;
}

/* Advantage and Flaw boxes - square style like Health/Willpower */
.advantage-box,
.flaw-box {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--bg-dark);
}

.advantage-box.empty,
.flaw-box.empty {
    background: var(--bg-dark);
}

.advantage-box.filled,
.flaw-box.filled {
    background: var(--htr-orange);
    border-color: var(--htr-orange);
    box-shadow: 0 0 6px rgba(255, 140, 0, 0.4);
}

.advantage-box:hover,
.flaw-box:hover {
    border-color: var(--htr-orange);
    box-shadow: 0 0 8px var(--neuro-shadow-glow);
}

/* Advantage/Flaw inputs without labels */
.advantage-flaw-input {
    width: 100%;
    background: var(--neuro-bg-1);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-white);
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    box-shadow: inset 4px 4px 8px var(--neuro-shadow-dark), inset -4px -4px 8px var(--neuro-bg-2);
    box-sizing: border-box;
}

.advantage-flaw-input:hover,
.advantage-flaw-input:focus {
    outline: none;
    border-color: var(--htr-orange);
    box-shadow: inset 4px 4px 8px var(--neuro-shadow-dark), inset -4px -4px 8px var(--neuro-bg-2), 0 0 8px var(--neuro-shadow-glow);
}

.advantage-flaw-input::placeholder {
    color: var(--text-gray);
    font-style: italic;
    opacity: 0.7;
}

.advantage-flaw-textarea {
    width: 100%;
    background: var(--neuro-bg-1);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-white);
    padding: 0.5rem;
    box-shadow: inset 4px 4px 8px var(--neuro-shadow-dark), inset -4px -4px 8px var(--neuro-bg-2);
    box-sizing: border-box;
    resize: vertical;
}

.advantage-flaw-textarea:hover,
.advantage-flaw-textarea:focus {
    outline: none;
    border-color: var(--htr-orange);
    box-shadow: inset 4px 4px 8px var(--neuro-shadow-dark), inset -4px -4px 8px var(--neuro-bg-2), 0 0 8px var(--neuro-shadow-glow);
}

.advantage-flaw-textarea::placeholder {
    color: var(--text-gray);
    font-style: italic;
    opacity: 0.7;
}

/* Touchstone inputs without labels */
.touchstone-input {
    width: 100%;
    background: var(--neuro-bg-1);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-white);
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    box-shadow: inset 4px 4px 8px var(--neuro-shadow-dark), inset -4px -4px 8px var(--neuro-bg-2);
    box-sizing: border-box;
}

.touchstone-input:hover,
.touchstone-input:focus {
    outline: none;
    border-color: var(--htr-orange);
    box-shadow: inset 4px 4px 8px var(--neuro-shadow-dark), inset -4px -4px 8px var(--neuro-bg-2), 0 0 8px var(--neuro-shadow-glow);
}

.touchstone-input::placeholder {
    color: var(--text-gray);
    font-style: italic;
    opacity: 0.7;
}

.touchstone-textarea {
    width: 100%;
    background: var(--neuro-bg-1);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-white);
    padding: 0.5rem;
    box-shadow: inset 4px 4px 8px var(--neuro-shadow-dark), inset -4px -4px 8px var(--neuro-bg-2);
    box-sizing: border-box;
    resize: vertical;
}

.touchstone-textarea:hover,
.touchstone-textarea:focus {
    outline: none;
    border-color: var(--htr-orange);
    box-shadow: inset 4px 4px 8px var(--neuro-shadow-dark), inset -4px -4px 8px var(--neuro-bg-2), 0 0 8px var(--neuro-shadow-glow);
}

.touchstone-textarea::placeholder {
    color: var(--text-gray);
    font-style: italic;
    opacity: 0.7;
}

.btn-remove-small {
    background: var(--danger-red);
    border: none;
    color: var(--text-white);
    width: 24px;
    height: 24px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s ease;
}

.btn-remove-small:hover {
    transform: scale(1.1);
    box-shadow: 0 0 8px color-mix(in srgb, var(--danger) 60%, transparent);
}

.btn-add {
    background: var(--neuro-bg-1);
    border: 1px solid var(--border-color);
    border-color: color-mix(in srgb, var(--htr-orange) calc(var(--glow-intensity) * 100%), var(--border-color));
    color: var(--htr-orange);
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s ease;
    margin-top: 1rem;
}

.btn-add:hover {
    transform: translateY(-2px);
}

.dots-total {
    margin-top: 0.5rem;
    color: var(--text-gray);
    font-size: 0.9rem;
}

/* Form Groups */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    color: var(--text-gray);
    margin-bottom: 0.3rem;
    font-size: 0.9rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    background: var(--neuro-bg-1);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-white);
    padding: 0.5rem;
    box-shadow: inset 4px 4px 8px var(--neuro-shadow-dark), inset -4px -4px 8px var(--neuro-bg-2);
}

.form-group input:hover,
.form-group textarea:hover,
.form-group select:hover,
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--htr-orange);
    box-shadow: inset 4px 4px 8px var(--neuro-shadow-dark), inset -4px -4px 8px var(--neuro-bg-2), 0 0 8px var(--neuro-shadow-glow);
}

/* Compact Form Groups (for Identity section) — fixed-width label column
   (grid, not flex) so every input's left edge lines up regardless of
   label text length. 7rem comfortably fits the longest label ("Blood
   Type:"). Mirrors the same fix on WTA's Identity container. */
.form-group-compact {
    margin-bottom: 0.8rem;
    display: grid;
    grid-template-columns: 7rem 1fr;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}

/* Any extra content after the input (e.g. the Blood Type row's rare-type
   warning badge) drops into its own row under the input rather than
   fighting the label column. */
.form-group-compact > *:nth-child(n+3) {
    grid-column: 2;
}

.form-group-compact label {
    color: var(--glow-text);
    font-size: 0.85rem;
    font-weight: bold;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.form-group-compact input,
.form-group-compact select {
    min-width: 0;
    background: var(--neuro-bg-1);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-white);
    padding: 0.4rem 0.6rem;
    font-size: 0.9rem;
    box-shadow: inset 4px 4px 8px var(--neuro-shadow-dark), inset -4px -4px 8px var(--neuro-bg-2);
    transition: all 0.2s ease;
}

.form-group-compact input:hover,
.form-group-compact select:hover,
.form-group-compact input:focus,
.form-group-compact select:focus {
    outline: none;
    border-color: var(--htr-orange);
    box-shadow: inset 4px 4px 8px var(--neuro-shadow-dark), inset -4px -4px 8px var(--neuro-bg-2), 0 0 8px var(--neuro-shadow-glow);
}

/* Identity box specific constraints */
.identity-box {
    overflow: hidden;
}

.identity-box .form-group-compact {
    max-width: 100%;
}

/* Blood Type Warning */
.blood-warning {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.25rem 0.5rem;
    background: color-mix(in srgb, var(--danger-red) 20%, transparent);
    border: 1px solid var(--danger-red);
    border-radius: 4px;
    color: var(--danger-red);
    font-size: 0.8rem;
    font-weight: bold;
}

/* First Encounter Section — used to stand out with a bright always-on
   border/background/textarea to flag it as important; now just a normal
   flat .sheet-section card like everything else. */
.first-encounter-prompt {
    color: var(--glow-text);
    text-align: center;
    margin-bottom: 1rem;
    font-weight: bold;
}

.first-encounter-section textarea {
    min-height: 200px;
}

/* XP Section */
.xp-display {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 1rem;
}

.xp-value {
    color: var(--glow-text);
    font-weight: bold;
}

.xp-separator {
    color: var(--text-gray);
    margin: 0 0.5rem;
}

.xp-total {
    color: var(--text-white);
}

.xp-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 1rem;
}

.btn-small {
    background: var(--neuro-bg-1);
    border: 1px solid var(--border-color);
    border-color: color-mix(in srgb, var(--htr-orange) calc(var(--glow-intensity) * 100%), var(--border-color));
    color: var(--htr-orange);
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.btn-small:hover {
    transform: translateY(-2px);
}

.xp-log-entries {
    max-height: 200px;
    overflow-y: auto;
}

.xp-log-entry {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 0.5rem;
    padding: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem;
}

.xp-log-entry.add .xp-amount {
    color: var(--safe-green);
}

.xp-log-entry.spend .xp-amount {
    color: var(--danger-red);
}

.xp-date {
    color: var(--text-gray);
    font-size: 0.8rem;
}

.xp-reason {
    color: var(--text-white);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Empty State */
.empty-state {
    text-align: center;
    color: var(--text-gray);
    padding: 2rem;
    font-style: italic;
}

/* Loading & Error States */
/* #fossil 2026-07-19: .error-overlay half of this selector is orphaned — zero
   references. Live error UI uses .empty-state + inline button (see
   character_sheet.html:418-423). .loading-overlay is still live; selector
   left intact. */
.loading-overlay,
.error-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9000; /* full-page block tier — see z-index scale doc in sheet-layout.css */
}

/* #fossil 2026-07-19: .error-message half of this selector is orphaned — zero
   references. Live error UI uses .empty-state + inline button (see
   character_sheet.html:418-423). .loading-spinner is still live; selector
   left intact. */
.loading-spinner,
.error-message {
    text-align: center;
    color: var(--text-white);
}

.spinner {
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--htr-orange);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* #fossil 2026-07-19: orphaned — zero references. Live error UI uses
   .empty-state + inline button (see character_sheet.html:418-423). */
.error-icon {
    font-size: 4rem;
    display: block;
    margin-bottom: 1rem;
}

/* #fossil 2026-07-19: orphaned — zero references. Live error UI uses
   .empty-state + inline button (see character_sheet.html:418-423). */
.btn-retry,
.btn-back {
    background: var(--htr-orange);
    border: none;
    color: var(--bg-black);
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    cursor: pointer;
    margin: 0.5rem;
    text-decoration: none;
    display: inline-block;
}

/* Back Link */
.back-link {
    display: flex;
    justify-content: space-between;
    margin-top: 2rem;
}

.back-link a {
    color: var(--htr-orange);
    text-decoration: none;
    transition: all 0.2s ease;
}

.back-link a:hover {
    color: var(--htr-orange-light);
    text-shadow: 0 0 10px rgba(255, 140, 0, 0.6);
}

/* ============================================================
   Cursor glow — border-glow + ambient spotlight (Magic Bento's
   border-glow/spotlight sub-effects, ported without GSAP/tilt/
   particles/magnetism). --glow-x/--glow-y/--glow-intensity are
   set per-element by htr-glow.js as the cursor moves; --glow-radius
   controls how far from the element the glow starts fading in.
   ============================================================ */
.sheet-section,
.btn-add,
.btn-small,
.btn-add-small {
    position: relative;
    --glow-x: 50%;
    --glow-y: 50%;
    --glow-intensity: 0;
    --glow-radius: 300px;
    /* Outer neon bloom — a proximity-driven box-shadow (not just the masked
       ring below) so lit cards spill light past their own edge, reactbits-
       style. calc() against the unitless --glow-intensity scales both the
       blur/spread and the color's opacity together as the cursor nears. */
    --glow-bloom: 0 0 calc(var(--glow-intensity) * 45px) calc(var(--glow-intensity) * 8px)
        color-mix(in srgb, var(--htr-orange) calc(var(--glow-intensity) * 85%), transparent);
    /* In-card headers/labels sit muted (matching the Desire/Ambition label
       treatment below) until the cursor nears, then reveal orange — same
       "black light" logic as the border-glow/spotlight, applied to text.
       Descendants inherit this already-resolved color from their nearest
       .sheet-section ancestor. */
    --glow-text: color-mix(in srgb, var(--htr-orange) calc(var(--glow-intensity) * 100%), var(--text-gray));
}

/* Gradient-border trick: a full-size pseudo-element painted with a
   cursor-centered radial-gradient, then masked down to just the
   border ring via mask-composite: exclude (content-box XOR border-box).
   Stops run hot (fully opaque core, still-strong mid stop) rather than a
   soft fade, for a harder neon-sign read instead of a gentle highlight. */
.sheet-section::after,
.btn-add::after,
.btn-small::after,
.btn-add-small::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(circle var(--glow-radius) at var(--glow-x) var(--glow-y),
        var(--htr-orange) 0%,
        color-mix(in srgb, var(--htr-orange) 70%, transparent) 45%,
        transparent 75%);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: var(--glow-intensity);
    pointer-events: none;
    transition: opacity 0.25s ease;
}

/* Cards get a thicker glowing ring than buttons — proportional to size,
   and closer to reactbits' Magic Bento reference border treatment. */
.sheet-section::after {
    padding: 4px;
}

.btn-add::after,
.btn-small::after,
.btn-add-small::after {
    padding: 2px;
}

/* Ambient spotlight — fixed, follows the cursor across the whole sheet
   (not just the hovered card), div injected by htr-glow.js. Black-light
   violet (--htr-spotlight) rather than Hunter's Flare orange, and dialed
   down from the card/button glow's strength — reads as a UV flashlight
   sweep revealing the sheet rather than another hot accent light. */
.htr-glow-spotlight {
    position: fixed;
    top: 0;
    left: 0;
    width: 800px;
    height: 800px;
    margin: -400px 0 0 -400px;
    border-radius: 50%;
    background: radial-gradient(circle,
        color-mix(in srgb, var(--htr-spotlight) 10%, transparent) 0%,
        color-mix(in srgb, var(--htr-spotlight) 5%, transparent) 30%,
        color-mix(in srgb, var(--htr-spotlight) 2%, transparent) 50%,
        transparent 70%);
    mix-blend-mode: screen;
    pointer-events: none;
    z-index: 5000; /* ambient/decorative tier — see z-index scale doc in sheet-layout.css */
    opacity: 0;
    transition: opacity 0.2s ease;
    transform: translate(-9999px, -9999px);
    will-change: transform;
}

.htr-glow-spotlight.active {
    opacity: 0.8;
}

@media (prefers-reduced-motion: reduce) {
    .sheet-section::after,
    .btn-add::after,
    .btn-small::after,
    .btn-add-small::after,
    .htr-glow-spotlight {
        display: none;
    }

    .sheet-section:hover {
        transform: none;
    }
}

/* Responsive Design */
@media (max-width: 1200px) {
    .sheet-grid-three-column {
        grid-template-columns: 1fr;
    }

    .attributes-three-column,
    .skills-three-column {
        grid-template-columns: 1fr;
    }

    /* Divider only makes sense between side-by-side columns — reset it
       once these stack full-width below this breakpoint. */
    .attributes-three-column > .attribute-column:not(:first-child),
    .skills-three-column > .skills-column:not(:first-child) {
        border-left: none;
        padding-left: 0;
    }

    /* Single-column layout has room to spare and dots grow for touch below
       (see .dot in the 768px block) — restore the roomier default gap so
       larger touch targets don't end up packed together. */
    .attributes-three-column .dot-tracker,
    .skills-three-column .dot-tracker {
        gap: 8px;
    }

    .attributes-skills-edges-grid {
        grid-template-columns: 1fr;
    }

    .experience-equipment-grid {
        grid-template-columns: 1fr;
    }

    .history-notes-grid {
        grid-template-columns: 1fr;
    }

    /* Adjust portrait grid for medium screens */
    .portrait-grid-htr {
        min-height: 350px;
    }

    .alias-input {
        font-size: 1.5rem;
        letter-spacing: 2px;
    }
}

@media (max-width: 768px) {
    .htr-sheet {
        padding: 1rem;
    }

    /* Fixed 200px name column has no room to share with the description
       field once the screen narrows below ~600px — stack instead of
       squeezing the description into an unreadable sliver. */
    .equipment-row {
        grid-template-columns: 1fr;
    }

    .character-title {
        font-size: 1.8rem;
    }

    .header-details {
        flex-direction: column;
        gap: 0.5rem;
    }

    .sheet-grid-two-column {
        grid-template-columns: 1fr;
    }

    /* Compact portrait grid for mobile */
    .portrait-grid-htr {
        min-height: 300px;
        gap: 0.3rem;
    }

    .alias-input {
        font-size: 1.2rem;
        letter-spacing: 1px;
    }

    .portrait-placeholder {
        font-size: 0.8rem;
    }

    .size-hint {
        font-size: 0.6rem;
    }

    /* Adjust tracker boxes for touch */
    .health-box,
    .willpower-box,
    .danger-box,
    .desperation-box {
        width: 28px;
        height: 28px;
        font-size: 1rem;
    }

    /* Larger dots for touch screens */
    .dot {
        width: 20px;
        height: 20px;
    }

    /* Make Despair button more touch-friendly */
    .despair-toggle-button {
        padding: 1.2rem 1.5rem;
        font-size: 1rem;
    }
}
