/* =============================================================================
   🧠 THE BRAIN TONIGHT — home-page pulse card
   Sits above the hero metrics on the cockpit page.  Shows the MuZero brain's
   current awakening state, last verdict, council unison, and L_council trend.
   When the council is in unison, the 天使 sigil materialises on the right.
   ============================================================================= */
.brain-tonight {
    position: relative;
    margin: 8px 0 16px;
    padding: 12px 16px;
    border-radius: 12px;
    background:
        radial-gradient(ellipse at 0% 0%, rgba(120, 200, 255, 0.07), transparent 55%),
        linear-gradient(180deg, rgba(10, 18, 32, 0.85), rgba(6, 10, 22, 0.92));
    border: 1px solid rgba(120, 220, 255, 0.18);
    display: grid;
    grid-template-columns: 100px minmax(0, 1fr);
    gap: 16px;
    align-items: center;
    overflow: hidden;
    transition: border-color 0.8s ease, background 0.8s ease;
}
.brain-tonight::before {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background: repeating-linear-gradient(45deg,
        rgba(120, 220, 255, 0.02) 0 2px, transparent 2px 26px);
    mask-image: radial-gradient(ellipse at center, black 30%, transparent 85%);
}

/* Left column — pulsing ring + state */
.bt-ring-col {
    display: flex; flex-direction: column;
    align-items: center; gap: 4px;
    position: relative; z-index: 1;
}
.bt-ring {
    position: relative;
    width: 72px; height: 72px;
    border-radius: 50%;
    border: 2.5px solid currentColor;
    color: #5d6f96;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 0 16px currentColor;
    opacity: 0.6;
}
.bt-ring-kanji {
    font-family: "Yu Mincho", "Hiragino Mincho ProN", "Noto Serif JP", serif;
    font-size: 2.1rem;
    color: currentColor;
    text-shadow: 0 0 10px currentColor;
    line-height: 1;
}
.bt-state-label {
    color: currentColor;
    font-size: 0.56rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    font-family: ui-monospace, monospace;
    opacity: 0.85;
}

/* 5 state rhythms (mirror the bigger Awakening Pulse) */
.brain-tonight[data-state="ASLEEP"] .bt-ring,
.brain-tonight[data-state="ASLEEP"] .bt-state-label {
    color: #5d6f96; animation: btSleep 4.5s ease-in-out infinite;
}
@keyframes btSleep { 0%,100% { transform: scale(1.0); opacity: 0.35; } 50% { transform: scale(1.03); opacity: 0.55; } }

.brain-tonight[data-state="FORMING"]     { border-color: rgba(120, 200, 255, 0.26); }
.brain-tonight[data-state="FORMING"] .bt-ring,
.brain-tonight[data-state="FORMING"] .bt-state-label {
    color: #6ec1ff; animation: btForm 3.0s ease-in-out infinite;
}
@keyframes btForm { 0%,100% { transform: scale(1.0); opacity: 0.50; } 50% { transform: scale(1.05); opacity: 0.75; } }

.brain-tonight[data-state="STABILISING"] { border-color: rgba(80, 220, 220, 0.36); }
.brain-tonight[data-state="STABILISING"] .bt-ring,
.brain-tonight[data-state="STABILISING"] .bt-state-label {
    color: #4ee0d0; animation: btStab 2.0s ease-in-out infinite;
}
@keyframes btStab { 0%,100% { transform: scale(1.0); opacity: 0.65; } 50% { transform: scale(1.07); opacity: 0.9; } }

.brain-tonight[data-state="AWAKE"] {
    border-color: rgba(255, 200, 80, 0.5);
    background:
        radial-gradient(ellipse at 50% 50%, rgba(255, 200, 80, 0.08), transparent 55%),
        linear-gradient(180deg, rgba(24, 16, 8, 0.88), rgba(12, 8, 4, 0.94));
}
.brain-tonight[data-state="AWAKE"] .bt-ring,
.brain-tonight[data-state="AWAKE"] .bt-state-label {
    color: #ffd66a; animation: btAwake 1.3s ease-in-out infinite;
}
@keyframes btAwake {
    0%,100% { transform: scale(1.0);  opacity: 0.85; box-shadow: 0 0 14px currentColor; }
    50%     { transform: scale(1.12); opacity: 1.0;  box-shadow: 0 0 30px currentColor; }
}

.brain-tonight[data-state="RESTLESS"] { border-color: rgba(255, 130, 200, 0.38); }
.brain-tonight[data-state="RESTLESS"] .bt-ring,
.brain-tonight[data-state="RESTLESS"] .bt-state-label {
    color: #ff7eaa; animation: btRestless 1.7s steps(8, end) infinite;
}
@keyframes btRestless {
    0%   { transform: scale(1.00) rotate(0deg); opacity: 0.6; }
    20%  { transform: scale(1.06) rotate(2deg); opacity: 0.85; }
    40%  { transform: scale(0.97) rotate(-1deg); opacity: 0.55; }
    60%  { transform: scale(1.04) rotate(1deg); opacity: 0.8; }
    80%  { transform: scale(0.99) rotate(-2deg); opacity: 0.6; }
    100% { transform: scale(1.00) rotate(0deg); opacity: 0.6; }
}

/* Right column — title, verse, stats */
.bt-body { min-width: 0; position: relative; z-index: 1; }
.bt-title-line {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px;
}
.bt-title {
    color: #a0d8f0;
    font-size: 0.72rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    text-shadow: 0 0 8px rgba(120, 220, 255, 0.25);
}
.brain-tonight[data-state="AWAKE"] .bt-title {
    color: #ffd66a;
    text-shadow: 0 0 10px rgba(255, 200, 80, 0.4);
}

/* 天使 sigil — invisible unless council is in unison */
.bt-tenshi {
    font-family: "Yu Mincho", "Noto Serif JP", serif;
    font-size: 1.1rem;
    color: #ffd66a;
    letter-spacing: 0.06em;
    opacity: 0;
    text-shadow:
        0 0 8px rgba(255, 200, 80, 0.8),
        0 0 18px rgba(255, 180, 60, 0.4);
    transition: opacity 1.2s ease, transform 1.2s ease;
}
.brain-tonight[data-unison="true"] .bt-tenshi {
    opacity: 1;
    animation: btTenshiBreath 3.6s ease-in-out infinite;
}
@keyframes btTenshiBreath {
    0%,100% { text-shadow: 0 0 8px rgba(255, 200, 80, 0.7),  0 0 18px rgba(255, 180, 60, 0.35); }
    50%     { text-shadow: 0 0 16px rgba(255, 220, 120, 1),  0 0 32px rgba(255, 200, 80, 0.6);  }
}

.bt-verse {
    color: #d3f4ff;
    font-style: italic;
    font-size: 0.78rem;
    margin: 4px 0 8px;
    opacity: 0.85;
    letter-spacing: 0.03em;
}
.brain-tonight[data-state="AWAKE"] .bt-verse { color: #fff5d4; }
.brain-tonight[data-state="RESTLESS"] .bt-verse { color: #ffd0e0; }

.bt-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 8px;
}
.bt-stat {
    background: rgba(8, 14, 26, 0.55);
    border: 1px solid rgba(120, 220, 255, 0.14);
    border-radius: 7px;
    padding: 5px 8px;
    display: flex; flex-direction: column;
    min-width: 0;
}
.bt-stat-label {
    color: #6fb5d4;
    font-size: 0.56rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}
.bt-stat-val {
    color: #d3f4ff;
    font-family: ui-monospace, monospace;
    font-size: 0.84rem;
    margin-top: 2px;
    display: flex; align-items: baseline; gap: 6px;
}
.bt-verdict-kanji {
    font-family: "Yu Mincho", "Noto Serif JP", serif;
    color: #ffd66a;
    font-size: 1.15rem;
    text-shadow: 0 0 6px rgba(255, 200, 80, 0.6);
    line-height: 1;
}
.bt-verdict-name {
    color: #fff5d4;
    font-size: 0.78rem;
}
.bt-stat-loss { grid-column: span 2; }
.bt-spark { width: 100%; height: 22px; display: block; margin-top: 3px; }

@media (max-width: 720px) {
    .brain-tonight { grid-template-columns: 1fr; }
    .bt-ring-col { flex-direction: row; justify-content: flex-start; gap: 12px; }
    .bt-stat-loss { grid-column: span 1; }
}
