/* DeckForge ASK AI private preview. DeckForge's palette (the test
   console's), dark by default with a light variant; system fonts only. */
:root {
  color-scheme: dark;
  --bg: #10151a;
  --bg-raised: #131b20;
  --surface: #182129;
  --surface2: #202c35;
  --line: #35434b;
  --text: #e8eee9;
  --strong: #f5faf4;
  --muted: #a9b8b5;
  --accent: #b8df9e;
  --accent-ink: #142017;
  --accent-soft: #283e2e;
  --link: #9fd0ff;
  --danger: #f4a2a0;
  --danger-soft: #3a2224;
  --warning: #f1d393;
  --warning-soft: #3a3322;
  --user: #1d2a24;
  --shadow: 0 12px 40px rgb(0 0 0 / 35%);
  --radius: 12px;
  --focus: 0 0 0 3px rgb(184 223 158 / 45%);
  font:
    16px/1.55 system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    sans-serif;
}
@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #f5f7f5;
    --bg-raised: #ffffff;
    --surface: #ffffff;
    --surface2: #eef2ef;
    --line: #d3dcd6;
    --text: #17211b;
    --strong: #0c150f;
    --muted: #56655f;
    --accent: #2f6f4f;
    --accent-ink: #ffffff;
    --accent-soft: #e2efe6;
    --link: #1d5fa8;
    --danger: #a3302c;
    --danger-soft: #fbe9e8;
    --warning: #7a5a0c;
    --warning-soft: #fbf3dc;
    --user: #e7f0ea;
    --shadow: 0 12px 40px rgb(20 40 30 / 14%);
    --focus: 0 0 0 3px rgb(47 111 79 / 35%);
  }
}

* {
  box-sizing: border-box;
}
html {
  scroll-padding-top: 80px;
  scroll-padding-bottom: 220px;
}
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
main {
  flex: 1;
  display: flex;
  flex-direction: column;
}
[hidden] {
  display: none !important;
}
a {
  color: var(--link);
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface2);
  padding: 8px 14px;
  line-height: 1.3;
}
button:disabled {
  cursor: default;
  opacity: 0.6;
}
:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}
button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 650;
}
button.ghost {
  background: transparent;
}
button.ghost:hover,
button.tool:hover,
.suggestion:hover {
  border-color: var(--accent);
}
button.small {
  padding: 4px 10px;
  font-size: 0.85rem;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.hint {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

/* Header and session status */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 12px max(16px, calc((100vw - 880px) / 2));
  background: color-mix(in srgb, var(--bg-raised) 92%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.brand-mark {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.4;
  stroke-linejoin: round;
}
.brand-mark-core {
  fill: var(--accent);
  stroke: none;
}
.brand-name {
  color: var(--strong);
  font-size: 1.05rem;
}
.brand-product {
  padding: 1px 7px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
}
.session {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  font-size: 0.85rem;
  color: var(--muted);
}
.badge {
  padding: 2px 9px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.78rem;
}
.session-item.soon {
  color: var(--warning);
  font-weight: 600;
}
.session-actions {
  display: flex;
  gap: 6px;
}
.session-actions button {
  padding: 4px 10px;
  font-size: 0.85rem;
}

/* Access and ended screens */
.screen-center {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 32px 16px;
}
.panel {
  width: min(460px, 100%);
  padding: 32px 28px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.panel h1 {
  margin: 0 0 10px;
  color: var(--strong);
  font-size: clamp(1.6rem, 5vw, 2rem);
  line-height: 1.15;
}
.panel h1:focus {
  box-shadow: none;
}
.lede {
  margin: 0 0 22px;
  color: var(--muted);
}
.access-form label[for] {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
}
.key-row {
  display: flex;
  gap: 8px;
}
.key-row input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9rem;
}
/* A text field masked with CSS, so password managers never offer to save the
   temporary key. */
#access-key:not(.revealed) {
  -webkit-text-security: disc;
}
.key-row input[aria-invalid="true"] {
  border-color: var(--danger);
}
.check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 0 0;
  font-size: 0.9rem;
}
.check input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}
.form-error {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-radius: 9px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 0.9rem;
}
.access-form .primary {
  width: 100%;
  margin-top: 20px;
  padding: 11px;
  font-size: 1rem;
}

/* Conversation */
.screen-chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: min(880px, 100%);
  margin: 0 auto;
  padding: 0 16px;
}
.log {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 24px 0 16px;
}
.welcome {
  padding: 24px 0 8px;
}
/* The key's messages and time window; never spend or usage internals. */
.preview-status {
  margin: 0 0 22px;
  padding: 12px 16px;
  border: 1px solid var(--accent-soft);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent-soft) 45%, var(--surface));
}
.welcome .preview-status p {
  margin: 0;
  color: var(--text);
}
.welcome .preview-status .preview-status-messages {
  color: var(--strong);
  font-weight: 650;
}
.welcome h2 {
  margin: 0 0 6px;
  color: var(--strong);
  font-size: 1.4rem;
}
.welcome p {
  margin: 0 0 16px;
  color: var(--muted);
}
.examples {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.example {
  width: 100%;
  height: 100%;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--surface);
  text-align: left;
}
.example:hover {
  border-color: var(--accent);
}
.message {
  max-width: 100%;
  scroll-margin-top: 80px;
}
.message-user {
  align-self: flex-end;
  max-width: min(85%, 640px);
  padding: 10px 14px;
  border-radius: var(--radius) var(--radius) 4px var(--radius);
  background: var(--user);
  border: 1px solid var(--line);
}
.message-text {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.message-ai {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.message-author {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.provisional {
  color: var(--muted);
}
.typing {
  display: inline-block;
  width: 36px;
  height: 10px;
  background: radial-gradient(circle, var(--muted) 45%, transparent 50%) 0 50% /
    12px 10px repeat-x;
  animation: typing 1.2s linear infinite;
  opacity: 0.7;
}
@keyframes typing {
  50% {
    opacity: 0.25;
  }
}
@media (prefers-reduced-motion: reduce) {
  .typing {
    animation: none;
  }
}

/* Answer Markdown */
.md {
  overflow-wrap: anywhere;
}
.md > :first-child {
  margin-top: 0;
}
.md > :last-child {
  margin-bottom: 0;
}
.md p {
  margin: 0 0 12px;
}
.md h3 {
  margin: 20px 0 6px;
  color: var(--strong);
  font-size: 1.02rem;
}
.md ul,
.md ol {
  margin: 0 0 12px;
  padding-left: 22px;
}
.md li {
  margin: 3px 0;
}
.md blockquote {
  margin: 0 0 12px;
  padding: 8px 14px;
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  background: var(--surface2);
}
.md strong {
  color: var(--strong);
}
.md code {
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--surface2);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
}
.card-chip {
  display: inline;
  margin: 0;
  padding: 0 5px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--strong);
  font: inherit;
  font-weight: 550;
  line-height: inherit;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
button.card-chip:hover,
button.card-chip[aria-expanded="true"] {
  border-color: var(--accent);
}
.card-chip-plain {
  background: var(--surface2);
  font-weight: 500;
}

/* Mana pips, drawn (the page loads no third-party images) */
.mana {
  display: inline-block;
  width: 1.15em;
  height: 1.15em;
  margin: 0 0.06em;
  border-radius: 50%;
  background: var(--pip, #cac5c0);
  color: #151515;
  font-size: 0.8em;
  font-weight: 700;
  line-height: 1.15em;
  text-align: center;
  vertical-align: -0.12em;
  box-shadow: -0.06em 0.08em 0 rgb(0 0 0 / 45%);
}
.mana-white {
  --pip: #f8f6d8;
}
.mana-blue {
  --pip: #aae0fa;
}
.mana-black {
  --pip: #cbc2bf;
}
.mana-red {
  --pip: #f9aa8f;
}
.mana-green {
  --pip: #9bd3ae;
}
.mana-colorless,
.mana-generic {
  --pip: #ccc2c0;
}
.mana-a-white {
  --a: #f8f6d8;
}
.mana-a-blue {
  --a: #aae0fa;
}
.mana-a-black {
  --a: #cbc2bf;
}
.mana-a-red {
  --a: #f9aa8f;
}
.mana-a-green {
  --a: #9bd3ae;
}
.mana-a-colorless,
.mana-a-generic {
  --a: #ccc2c0;
}
.mana-b-white {
  --b: #f8f6d8;
}
.mana-b-blue {
  --b: #aae0fa;
}
.mana-b-black {
  --b: #cbc2bf;
}
.mana-b-red {
  --b: #f9aa8f;
}
.mana-b-green {
  --b: #9bd3ae;
}
.mana-b-colorless,
.mana-b-generic {
  --b: #ccc2c0;
}
.mana-hybrid {
  background: linear-gradient(135deg, var(--a) 50%, var(--b) 50%);
}
.mana-phyrexian {
  box-shadow:
    inset 0 0 0 0.14em rgb(0 0 0 / 35%),
    -0.06em 0.08em 0 rgb(0 0 0 / 45%);
}

/* Deck changes, notes, sources and actions under an answer */
.proposal {
  margin: 16px 0 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
}
.proposal-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 10px;
}
.proposal h3 {
  margin: 0;
  color: var(--strong);
  font-size: 1rem;
}
.pill {
  padding: 1px 9px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}
.pill-ok {
  background: var(--accent-soft);
  color: var(--accent);
}
.pill-bad {
  background: var(--danger-soft);
  color: var(--danger);
}
.pill-warn {
  background: var(--warning-soft);
  color: var(--warning);
}
.change-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px 20px;
}
.change-column h4 {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.change-list {
  margin: 0;
  padding: 0;
  list-style: none;
}
.change-list li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 3px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 0.93rem;
}
.change-qty {
  min-width: 2.2em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.change-name {
  flex: 1;
}
.change-price {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.proposal-totals {
  margin: 10px 0 0;
  font-weight: 600;
  font-size: 0.92rem;
}
.fine {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}
.warnings {
  margin: 12px 0 0;
  padding: 10px 12px 10px 30px;
  border-radius: 9px;
  background: var(--warning-soft);
  color: var(--warning);
  font-size: 0.88rem;
}
.sources {
  margin: 14px 0 0;
  font-size: 0.88rem;
}
.sources summary {
  width: fit-content;
  cursor: pointer;
  color: var(--muted);
  border-radius: 6px;
}
.sources summary:hover {
  color: var(--text);
}
.sources ul {
  margin: 8px 0 0;
  padding-left: 20px;
  color: var(--muted);
}
.sources strong {
  color: var(--text);
  font-weight: 600;
}
.message-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.suggestion {
  padding: 5px 12px;
  border-radius: 999px;
  background: transparent;
  font-size: 0.88rem;
  text-align: left;
}

/* Composer dock */
.dock {
  position: sticky;
  bottom: 0;
  z-index: 10;
  padding: 4px 0 14px;
  background: var(--bg);
}
.dock::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  height: 24px;
  background: linear-gradient(transparent, var(--bg));
  pointer-events: none;
}
.activity {
  min-height: 1.3em;
  margin: 0 4px 6px;
  color: var(--muted);
  font-size: 0.85rem;
}
.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--warning-soft);
  color: var(--warning);
  font-size: 0.92rem;
}
.notice-body {
  flex: 1;
}
.notice-title {
  display: block;
  margin-bottom: 2px;
}
.notice-close {
  padding: 0 8px;
  border: 0;
  background: transparent;
  font-size: 1.2rem;
  line-height: 1.2;
}
/* The session ended with a conversation on screen: it stays readable. */
.closing {
  margin-bottom: 8px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.closing h2 {
  margin: 0 0 6px;
  color: var(--strong);
  font-size: 1.2rem;
}
.closing h2:focus {
  box-shadow: none;
}
.closing p:not(.eyebrow) {
  margin: 0 0 14px;
  color: var(--muted);
}
.attach-panel {
  margin-bottom: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.attach-panel > label {
  display: block;
  font-weight: 600;
}
.attach-panel textarea {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
  resize: vertical;
}
.pool-kind {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 0 0 12px;
  padding: 0;
  border: 0;
}
.pool-kind legend {
  margin-bottom: 6px;
  padding: 0;
  font-weight: 600;
}
.pool-kind label {
  display: flex;
  align-items: center;
  gap: 6px;
}
.pool-kind input {
  accent-color: var(--accent);
}
.panel-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}
.composer {
  padding: 10px 10px 8px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.composer:focus-within {
  border-color: var(--accent);
}
.composer textarea#question {
  display: block;
  width: 100%;
  min-height: 44px;
  max-height: 220px;
  padding: 8px 6px;
  border: 0;
  background: transparent;
  resize: none;
}
.composer textarea#question:focus-visible {
  box-shadow: none;
}
.composer-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}
.composer-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-right: auto;
}
.tool {
  padding: 5px 11px;
  border-radius: 999px;
  background: transparent;
  font-size: 0.85rem;
}
.tool[aria-expanded="true"] {
  border-color: var(--accent);
  color: var(--accent);
}
.count {
  color: var(--muted);
  font-size: 0.8rem;
}
.attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 6px;
  padding: 0;
  list-style: none;
}
.attach-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 4px 3px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
}
.attach-deck {
  background: var(--accent-soft);
  color: var(--accent);
}
.attach-pool {
  background: var(--warning-soft);
  color: var(--warning);
}
.attach-chip::before {
  content: "";
  width: 0.75em;
  height: 0.95em;
  margin-right: 2px;
  border: 2px solid currentColor;
  border-radius: 3px;
}
.attach-pool::before {
  width: 0.95em;
  border-radius: 50%;
}
.attachments-sent {
  margin: 8px 0 0;
}
.attachments-sent .attach-chip {
  padding-right: 10px;
}
.attach-edit,
.attach-remove {
  padding: 0 7px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font-size: 0.8rem;
}
.attach-remove {
  font-size: 1.05rem;
  line-height: 1.2;
}
.attach-edit:hover,
.attach-remove:hover {
  background: rgb(127 127 127 / 20%);
}
.more {
  margin-top: 6px;
  font-size: 0.88rem;
}
.more summary {
  width: fit-content;
  cursor: pointer;
  color: var(--muted);
  border-radius: 6px;
}
.more-grid {
  display: grid;
  grid-template-columns: auto minmax(0, 220px);
  align-items: center;
  gap: 8px 12px;
  margin-top: 10px;
}
.more select,
.more input {
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
}

/* Card details */
.card-popover {
  position: fixed;
  z-index: 40;
  width: min(340px, calc(100vw - 16px));
  max-height: min(70vh, 520px);
  overflow: auto;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.card-popover-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.card-popover h2 {
  margin: 0 0 8px;
  color: var(--strong);
  font-size: 1.05rem;
}
.card-popover h2:focus {
  box-shadow: none;
}
.card-face + .card-face {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.card-face-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.card-type {
  margin: 4px 0 8px;
  color: var(--muted);
  font-size: 0.88rem;
}
.card-oracle {
  margin: 0 0 6px;
  font-size: 0.92rem;
}
.card-stats {
  margin: 6px 0 0;
  text-align: right;
  font-weight: 700;
}
.card-popover-credit {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.75rem;
}

/* Footer */
.footer {
  padding: 18px max(16px, calc((100vw - 880px) / 2)) 24px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.78rem;
}
.footer p {
  margin: 0 0 6px;
}
.footer strong {
  color: var(--text);
}

@media (max-width: 699px) {
  .topbar {
    position: static;
    padding-block: 10px;
  }
  .session {
    width: 100%;
  }
  .session-actions {
    margin-left: auto;
  }
  .panel {
    padding: 26px 20px;
  }
  .message-user {
    max-width: 92%;
  }
  .message-ai {
    padding: 14px;
  }
  .card-popover {
    left: 8px !important;
    right: 8px;
    top: auto !important;
    bottom: 8px;
    width: auto;
  }
  .more-grid {
    grid-template-columns: 1fr;
  }
}
