/* Layout, header, panels, buttons, forms. */

.app {
  max-width: 1280px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 20px 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.brand { display: flex; align-items: center; gap: 12px; }
.logo { font-family: var(--font-head); font-weight: 700; font-size: 22px; letter-spacing: 0.14em; }
.stage-tag {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.06em;
  transition: background-color 0.6s ease, color 0.6s ease;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; flex-grow: 1; }
.chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.chip strong { font-variant-numeric: tabular-nums; }

.controls { display: flex; flex-wrap: wrap; gap: 8px; }
.seg { display: flex; gap: 4px; }
.seg button {
  min-height: 44px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-weight: 600;
}
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.layout { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; flex-grow: 1; }
.left { flex: 1 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.right { flex: 1 1 440px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.card[hidden] { display: none; }
.card p { margin: 0; }

.event {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
}
.event .bar { height: 8px; }
.event .bar > span { background: var(--accent); transition: width 0.2s linear; }

.queue-list { display: flex; flex-direction: column; gap: 6px; }
.queue-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--inset);
}

.aube-gain { font-family: var(--font-head); font-weight: 600; font-size: 16px; }
.perks-title { margin: 4px 0 0; font-size: 14px; }
.perks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; color: var(--ink2); }
.perks li.done { color: var(--ink); font-weight: 600; }
#btn-ascend[data-armed="true"] { background: var(--danger); color: var(--paper); }

.panel { display: flex; flex-direction: column; gap: 12px; }
.panel[hidden] { display: none; }
.gens { display: flex; flex-direction: column; gap: 12px; }
.gen-list { display: flex; flex-direction: column; }
.gen-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  padding: 8px 0;
  border-top: 1px solid var(--track);
}
.gen-info { flex: 1 1 160px; min-width: 0; }
.gen-name { font-weight: 600; }
.gen-count { font-weight: 400; margin-left: 6px; font-variant-numeric: tabular-nums; }
.gen-meta { font-size: 12px; }
.gen-buy { background: var(--accent); color: var(--on-accent); border-color: transparent; font-variant-numeric: tabular-nums; }
.gen-buy:disabled { background: var(--track); color: var(--ink2); cursor: not-allowed; }
.gen-buy:not(:disabled):hover { filter: brightness(1.08); }

.grind-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 4px; }
.grind-wrap { position: relative; display: inline-block; }
.btn-grind { padding: 0 22px; font-size: 15px; }
.floats { position: absolute; left: 0; right: 0; bottom: 100%; height: 0; pointer-events: none; }
.float {
  position: absolute;
  bottom: 4px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  animation: float-up 1s ease-out forwards;
}
@keyframes float-up {
  from { transform: translateY(0); opacity: 1; }
  to { transform: translateY(-36px); opacity: 0; }
}

.stage-tag.pop { animation: pop 0.6s ease-out; }
@keyframes pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.25); }
  100% { transform: scale(1); }
}

.gain-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 16px; }
.gain-list li { display: flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; flex: none; }

.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.craft-note:empty { display: none; }

.slot {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--inset);
}
.slot.empty { border-style: dashed; }
.slot-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.slot-label { display: flex; align-items: center; gap: 6px; font-weight: 600; flex-wrap: wrap; }
.slot-time { font-variant-numeric: tabular-nums; }
.slot-harvest[hidden] { display: none; }
.slot .bar > span { transition: width 0.2s linear; }

.pill {
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  border: 2px solid var(--border);
  background: var(--inset);
  font-weight: 600;
}
.pill[aria-pressed="true"] { background: var(--pill-color); color: var(--pill-on); border-color: var(--pill-color); }

.branches { display: flex; flex-direction: column; gap: 12px; }
.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opt {
  flex: 1 1 150px;
  text-align: left;
  padding: 10px 12px;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.opt-name { font-weight: 600; }
.opt-text { font-size: 12px; color: var(--ink2); }
.opt[aria-pressed="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 18%, var(--surface)); }
.opt[aria-pressed="true"] .opt-text { color: var(--ink); }
.opt:disabled { opacity: 0.6; cursor: not-allowed; }
.opt:not(:disabled):not([aria-pressed="true"]):hover { border-color: var(--ink2); }

.next-row { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.next .bar { height: 10px; border-radius: 6px; }
.next .bar > span { background: var(--accent); }
.journal { font-style: italic; font-size: 13px; }

.tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.tab {
  min-height: 44px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-weight: 600;
}
.tab[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.row { display: flex; flex-wrap: wrap; gap: 8px; }
.btn {
  min-height: 44px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--inset);
  font-weight: 600;
}
.btn:hover { border-color: var(--ink2); }
.btn-primary { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.btn-danger { color: var(--danger); }
.btn-danger[data-armed="true"] { background: var(--danger); color: var(--paper); border-color: transparent; }

.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--ink2); }
textarea {
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--inset);
  color: var(--ink);
  font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  resize: vertical;
}

.msg { min-height: 1.4em; font-size: 12px; }

.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0; }
.stats div { display: flex; flex-direction: column; gap: 2px; }
.stats dt { font-size: 12px; color: var(--ink2); }
.stats dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }

footer { font-size: 12px; }

@media (max-width: 720px) {
  .app { padding: 16px; }
}

/* Particles */
.fx { position: fixed; inset: 0; pointer-events: none; z-index: 50; overflow: hidden; }
.particle {
  position: absolute;
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  border-radius: 50%;
  opacity: 0.9;
  animation: particle 0.9s ease-out forwards;
}
@keyframes particle {
  from { transform: translate(0, 0) scale(1); opacity: 0.95; }
  to { transform: translate(var(--dx), var(--dy)) scale(0.25); opacity: 0; }
}
