/* Starship Ithaca character terminal — dark neon deck aesthetic */
:root {
  --bg: #07090f;
  --panel: #0d1220;
  --panel2: #111a2e;
  --line: #1f2c4a;
  --text: #d7e2f5;
  --dim: #7d8cab;
  --accent: #37d5ff;
  --accent2: #ff9d3c;
  --good: #4ade80;
  --bad: #f87171;
  --mental: #b78cff;
  --physical: #ffb44d;
  --radius: 10px;
  font-size: 15px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background:
    radial-gradient(1200px 500px at 80% -10%, rgba(55, 213, 255, 0.08), transparent),
    radial-gradient(900px 400px at 10% 110%, rgba(255, 157, 60, 0.06), transparent),
    var(--bg);
  color: var(--text);
  font-family: "Avenir Next", "Segoe UI", system-ui, sans-serif;
  min-height: 100vh;
}
h1, h2, h3, h4 { font-family: "Futura", "Avenir Next", sans-serif; letter-spacing: 0.06em; }

.topbar {
  display: flex; align-items: center; gap: 1rem;
  padding: 0.7rem 1.2rem; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(55,213,255,0.06), transparent);
  position: sticky; top: 0; z-index: 20; backdrop-filter: blur(6px);
}
.topbar .logo { font-weight: 800; letter-spacing: 0.18em; color: var(--accent); text-transform: uppercase; }
.topbar .logo small { color: var(--dim); letter-spacing: 0.08em; display: block; font-size: 0.6em; }
.topbar .spacer { flex: 1; }
.topbar .user { color: var(--dim); font-size: 0.9em; }

.wrap { max-width: 1500px; margin: 0 auto; padding: 1rem 1.2rem 4rem; }
.hidden { display: none !important; }

.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 0.9rem 1rem; margin-bottom: 0.9rem;
}
.panel h3 {
  margin: -0.9rem -1rem 0.7rem; padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--line); font-size: 0.8rem; text-transform: uppercase;
  color: var(--accent); background: rgba(55, 213, 255, 0.05);
  border-radius: var(--radius) var(--radius) 0 0;
}

button, .btn {
  background: var(--panel2); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 0.45rem 0.9rem; cursor: pointer; font: inherit;
  transition: border-color 0.15s, background 0.15s;
}
button:hover, .btn:hover { border-color: var(--accent); }
button.primary { background: linear-gradient(135deg, #0a4b63, #0c2b52); border-color: var(--accent); color: #d8f6ff; }
button.danger:hover { border-color: var(--bad); color: var(--bad); }
button.small { padding: 0.2rem 0.55rem; font-size: 0.8em; }

input, select, textarea {
  background: #0a0f1c; color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 0.4rem 0.6rem; font: inherit; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
label { font-size: 0.72rem; text-transform: uppercase; color: var(--dim); letter-spacing: 0.08em; }
.field { display: flex; flex-direction: column; gap: 0.25rem; }

/* Auth */
.auth-card { max-width: 420px; margin: 8vh auto; }
.auth-card .tabs { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.auth-card form { display: flex; flex-direction: column; gap: 0.8rem; }
.error { color: var(--bad); font-size: 0.85rem; min-height: 1.2em; }
.notice { color: var(--good); font-size: 0.85rem; }

/* Character roster */
.roster { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0.9rem; }
.roster .card { cursor: pointer; transition: transform 0.1s, border-color 0.15s; }
.roster .card:hover { border-color: var(--accent); transform: translateY(-2px); }
.roster .card h4 { margin: 0 0 0.3rem; font-size: 1.1rem; color: var(--accent); }
.roster .card .meta { color: var(--dim); font-size: 0.85rem; }

/* Sheet layout */
.sheet-grid { display: grid; grid-template-columns: 330px 1fr 320px; gap: 0.9rem; align-items: start; }
@media (max-width: 1100px) { .sheet-grid { grid-template-columns: 1fr; } }

.sheet-tabs { display: flex; gap: 0.4rem; margin-bottom: 0.9rem; flex-wrap: wrap; }
.sheet-tabs button.active { border-color: var(--accent); color: var(--accent); background: rgba(55, 213, 255, 0.08); }
.savebar { margin-left: auto; display: flex; gap: 0.5rem; align-items: center; }
#save-status { color: var(--dim); font-size: 0.8rem; }

.identity-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.identity-grid .full { grid-column: 1 / -1; }

/* Abilities */
.abilities { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
.ability {
  background: var(--panel2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 0.5rem 0.4rem; text-align: center; cursor: pointer; position: relative;
}
.ability:hover { border-color: var(--accent); }
.ability .abbr { font-size: 0.62rem; text-transform: uppercase; color: var(--dim); letter-spacing: 0.05em; }
.ability .mod { font-size: 1.5rem; font-weight: 800; color: var(--accent); }
.ability input {
  width: 3.2em; margin: 0.2rem auto 0; text-align: center; padding: 0.15rem;
}
.ability .bonus-chip { position: absolute; top: 4px; right: 5px; font-size: 0.62rem; color: var(--accent2); }
.ability.assign-target { border-color: var(--accent2); cursor: copy; box-shadow: 0 0 8px rgba(255, 157, 60, 0.25); }
.stat-roll-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin: 0 0 0.6rem; }
.stat-roll-row .full { flex-basis: 100%; margin: 0.1rem 0 0; }
.stat-chip {
  min-width: 2.6em; font-size: 1.05rem; font-weight: 800; color: var(--accent);
  border: 1px solid var(--accent); background: rgba(55, 213, 255, 0.08); border-radius: var(--radius);
}
.stat-chip.selected { color: #081018; background: var(--accent2); border-color: var(--accent2); }
.stat-chip.used { color: var(--dim); border-color: var(--line); background: transparent; text-decoration: line-through; opacity: 0.55; }

/* Skills */
.skills { display: flex; flex-direction: column; }
.skill-row {
  display: flex; align-items: center; gap: 0.5rem; padding: 0.22rem 0.3rem;
  border-radius: 6px; cursor: pointer; font-size: 0.92rem;
}
.skill-row:hover { background: rgba(55, 213, 255, 0.07); }
.skill-row input[type="checkbox"] { width: auto; accent-color: var(--accent); }
.skill-row .sk-ability { color: var(--dim); font-size: 0.68rem; width: 2.6em; text-transform: uppercase; }
.skill-row .sk-name { flex: 1; }
.skill-row .sk-bonus { font-weight: 700; color: var(--accent); width: 2.4em; text-align: right; }
.skill-row.granted .sk-name::after { content: " \25CF"; color: var(--accent2); font-size: 0.7em; }

/* Stat blocks */
.statline { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; text-align: center; }
.stat { background: var(--panel2); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.5rem; }
.stat .num { font-size: 1.6rem; font-weight: 800; color: var(--accent); }
.stat .lbl { font-size: 0.65rem; text-transform: uppercase; color: var(--dim); letter-spacing: 0.07em; }
.stat small { color: var(--dim); display: block; font-size: 0.68rem; margin-top: 2px; }

/* Health pools */
.pool { border: 1px solid var(--line); border-radius: var(--radius); padding: 0.6rem; margin-bottom: 0.6rem; background: var(--panel2); }
.pool.physical { border-left: 3px solid var(--physical); }
.pool.mental { border-left: 3px solid var(--mental); }
.pool .pool-head { display: flex; align-items: center; gap: 0.6rem; }
.pool .pool-head h4 { margin: 0; flex: 1; font-size: 0.8rem; text-transform: uppercase; }
.pool .dice-tag { font-weight: 700; color: var(--accent2); }
.pool .hp-track { display: flex; gap: 0.4rem; align-items: center; margin-top: 0.5rem; }
.pool .hp-track input { width: 4.5em; text-align: center; }
.pool .hp-track .sep { color: var(--dim); }

/* Features */
.feature-level { margin-bottom: 0.8rem; }
.feature-level h4 { margin: 0 0 0.3rem; color: var(--accent2); font-size: 0.8rem; text-transform: uppercase; }
.feature-level .picks-note { color: var(--dim); font-size: 0.78rem; margin-left: 0.4rem; text-transform: none; }
.feature-opt { padding: 0.45rem 0.55rem; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 0.35rem; background: var(--panel2); }
.feature-opt label.opt-label { display: flex; gap: 0.5rem; align-items: baseline; cursor: pointer; text-transform: none; font-size: 0.95rem; color: var(--text); }
.feature-opt input { width: auto; accent-color: var(--accent2); }
.feature-opt .tag { font-size: 0.65rem; padding: 0.05rem 0.4rem; border-radius: 99px; border: 1px solid; }
.feature-opt .tag.Mental { color: var(--mental); border-color: var(--mental); }
.feature-opt .tag.Physical { color: var(--physical); border-color: var(--physical); }
.feature-opt .opt-text { color: var(--dim); font-size: 0.82rem; margin: 0.25rem 0 0 1.6rem; display: none; }
.feature-opt.open .opt-text { display: block; }
.feature-opt.chosen { border-color: var(--accent2); background: rgba(255, 157, 60, 0.06); }

/* Dice panel */
.dice-panel { position: sticky; top: 4.4rem; }
.adv-toggle { display: flex; gap: 0.3rem; margin-bottom: 0.6rem; }
.adv-toggle button { flex: 1; font-size: 0.78rem; padding: 0.3rem; }
.adv-toggle button.active-adv { border-color: var(--good); color: var(--good); }
.adv-toggle button.active-normal { border-color: var(--accent); color: var(--accent); }
.adv-toggle button.active-dis { border-color: var(--bad); color: var(--bad); }
.quick-dice { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.3rem; margin-bottom: 0.6rem; }
.custom-roll { display: flex; gap: 0.4rem; margin-bottom: 0.6rem; }
.roll-log { max-height: 46vh; overflow-y: auto; display: flex; flex-direction: column; gap: 0.4rem; }
.roll-entry { border: 1px solid var(--line); border-radius: 8px; padding: 0.4rem 0.55rem; background: var(--panel2); animation: pop 0.18s ease-out; }
.roll-entry .r-head { display: flex; align-items: baseline; gap: 0.5rem; }
.roll-entry .r-label { flex: 1; font-size: 0.85rem; }
.roll-entry .r-total { font-size: 1.3rem; font-weight: 800; color: var(--accent); }
.roll-entry .r-detail { color: var(--dim); font-size: 0.75rem; }
.roll-entry .r-time { color: var(--dim); font-size: 0.65rem; }
.roll-entry.crit .r-total { color: var(--good); }
.roll-entry.fumble .r-total { color: var(--bad); }
.roll-entry.overload { border-color: var(--mental); }
@keyframes pop { from { transform: scale(0.96); opacity: 0.4; } to { transform: scale(1); opacity: 1; } }

/* Reference / build */
.ref-block { margin-bottom: 1rem; }
.ref-block h4 { color: var(--accent2); margin: 0.6rem 0 0.2rem; }
.ref-block p, .ref-block li { color: var(--dim); font-size: 0.88rem; line-height: 1.45; }
.pick-desc { color: var(--dim); font-size: 0.85rem; line-height: 1.5; margin-top: 0.5rem; }
.trait { margin-bottom: 0.5rem; }
.trait b { color: var(--text); }
table.simple { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
table.simple th, table.simple td { text-align: left; padding: 0.3rem 0.45rem; border-bottom: 1px solid var(--line); }
table.simple th { color: var(--accent); text-transform: uppercase; font-size: 0.68rem; }
.weapon-row button { margin-left: 0.4rem; }

/* Source artwork */
.hero { width: 100%; border-radius: var(--radius); border: 1px solid var(--line); margin-bottom: 1rem; }
.deck-image { width: 100%; max-height: 260px; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--line); margin: 0.3rem 0 0.5rem; }

/* Species artwork */
.species-portrait {
  float: right; max-width: 220px; max-height: 300px; margin: 0 0 0.6rem 0.8rem;
  border-radius: var(--radius); border: 1px solid var(--line);
}
.species-avatar {
  display: block; max-height: 170px; margin: 0 auto 0.7rem;
  border-radius: var(--radius); border: 1px solid var(--line);
}

.muted { color: var(--dim); font-size: 0.85rem; }
.pill { display: inline-block; border: 1px solid var(--line); border-radius: 99px; padding: 0.1rem 0.6rem; font-size: 0.75rem; color: var(--dim); margin: 0 0.25rem 0.25rem 0; }
.warn { color: var(--accent2); font-size: 0.82rem; }
