/* Terminals (#/terminals): a sci-fi "arms dealer" screen with up to 5 offers */
.term-page {
  --term: #3de0c6;
  --term-hi: #8ff5e4;
  --term-dim: rgba(61, 224, 198, .35);
  --term-faint: rgba(61, 224, 198, .08);
  --term-bg: #07100f;
  --term-mono: ui-monospace, 'Cascadia Mono', 'SFMono-Regular', Menlo, Consolas, monospace;
}

/* ------------------------------------------------------------------ screen frame */
.term-screen { margin-bottom: 18px; }
.term-frame {
  position: relative; overflow: hidden; border-radius: 16px; padding: 0 20px 20px;
  border: 1px solid var(--term-dim);
  background:
    radial-gradient(120% 70% at 50% 0%, rgba(61, 224, 198, .10), transparent 60%),
    radial-gradient(90% 60% at 50% 110%, rgba(61, 224, 198, .06), transparent 70%),
    var(--term-bg);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .6) inset, 0 0 40px -18px rgba(61, 224, 198, .55), 0 24px 50px -30px rgba(0, 0, 0, .9);
}
/* corner brackets */
.term-frame::before, .term-frame::after {
  content: ''; position: absolute; width: 26px; height: 26px; pointer-events: none; z-index: 3;
  border: 2px solid var(--term); opacity: .7;
}
.term-frame::before { top: 8px; left: 8px; border-right: 0; border-bottom: 0; border-top-left-radius: 8px; }
.term-frame::after { bottom: 8px; right: 8px; border-left: 0; border-top: 0; border-bottom-right-radius: 8px; }
/* scanlines + slow sweep */
.term-scan {
  position: absolute; inset: 0; pointer-events: none; z-index: 2;
  background: repeating-linear-gradient(180deg, rgba(255, 255, 255, .025) 0 1px, transparent 1px 3px);
}
.term-scan::after {
  content: ''; position: absolute; left: 0; right: 0; top: -30%; height: 30%;
  background: linear-gradient(180deg, transparent, rgba(61, 224, 198, .06), transparent);
  animation: term-sweep 6s linear infinite;
}
@keyframes term-sweep { to { transform: translateY(440%); } }

.term-bar {
  display: flex; align-items: center; gap: 10px; margin: 0 -20px 14px; padding: 11px 20px 11px 44px;
  border-bottom: 1px solid var(--term-dim); background: rgba(61, 224, 198, .05);
  font-family: var(--term-mono); font-size: 12.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--term-hi);
}
.term-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.term-title i { font-style: normal; color: var(--term-dim); }
.term-status { margin-left: auto; color: var(--muted); white-space: nowrap; }
.term-online { color: var(--term); }
.term-led { width: 9px; height: 9px; border-radius: 50%; background: #5c4a50; flex: none; }
.is-live .term-led { background: var(--term); box-shadow: 0 0 10px var(--term); animation: term-blink 1.6s ease-in-out infinite; }
@keyframes term-blink { 50% { opacity: .35; } }

/* ------------------------------------------------------------------ offer steps */
.term-pips { list-style: none; display: flex; gap: 8px; justify-content: center; margin: 0 0 16px; padding: 0; }
.term-pip {
  width: 38px; height: 30px; display: grid; place-items: center; border-radius: 8px; position: relative;
  border: 1px solid var(--term-dim); background: var(--term-faint);
  font-family: var(--term-mono); font-weight: 700; font-size: 13px; color: var(--muted);
}
.term-pip.is-now { color: #061412; background: var(--term); border-color: var(--term); box-shadow: 0 0 16px -2px var(--term); animation: term-pulse 1.8s ease-in-out infinite; }
.term-pip.is-gone { color: var(--dim); border-color: var(--line2); background: transparent; opacity: .55; }
.term-pip.is-bought { color: #231703; background: var(--gold); border-color: var(--gold); box-shadow: 0 0 16px -4px var(--gold); }
@keyframes term-pulse { 50% { box-shadow: 0 0 4px -2px var(--term); } }

/* ------------------------------------------------------------------ offer */
.term-body { display: grid; grid-template-columns: minmax(0, 260px) minmax(0, 1fr); gap: 22px; align-items: center; position: relative; z-index: 1; }
.term-card { position: relative; }
.term-card .item.term-item { padding: 14px 14px 16px; border-color: color-mix(in srgb, var(--c) 45%, var(--line)); box-shadow: 0 0 34px -14px var(--c); }
.term-card .term-item .item-skin { font-size: 15px; }
.term-card .term-item .float { font-family: var(--term-mono); }
.term-card.is-rare .term-item { box-shadow: 0 0 44px -8px var(--gold); }
.term-card.is-enter { animation: term-materialize .65s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes term-materialize {
  0% { opacity: 0; transform: translateY(8px) scale(.96); filter: brightness(2.2) saturate(0) blur(3px); clip-path: inset(0 0 100% 0); }
  45% { opacity: 1; clip-path: inset(0 0 0 0); }
  100% { opacity: 1; transform: none; filter: none; clip-path: inset(0 0 0 0); }
}
.term-card.is-declined { animation: term-reject .5s ease-in both; }
@keyframes term-reject {
  0% { transform: none; }
  20% { transform: translateX(-6px); filter: hue-rotate(-40deg) saturate(2); }
  40% { transform: translateX(5px); }
  100% { transform: translateX(-24px) scale(.94); opacity: 0; filter: grayscale(1) brightness(.6); }
}
.term-card.is-bought .term-item { animation: term-bought 1s ease-out both; }
@keyframes term-bought {
  0% { box-shadow: 0 0 0 0 rgba(228, 174, 57, .9); }
  40% { transform: scale(1.04); box-shadow: 0 0 60px 6px rgba(228, 174, 57, .55); border-color: var(--gold); }
  100% { transform: none; box-shadow: 0 0 40px -10px var(--gold); border-color: var(--gold); }
}
.term-stamp {
  position: absolute; top: 42%; left: 50%; z-index: 4; pointer-events: none; transform: translate(-50%, -50%) rotate(-12deg) scale(1.6);
  padding: 4px 12px; border: 3px solid currentColor; border-radius: 8px; opacity: 0;
  font-family: var(--display); font-size: 22px; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap;
}
.term-card.is-declined .term-stamp, .term-card.is-bought .term-stamp { animation: term-stamp .28s ease-out forwards; }
.term-card.is-declined .term-stamp { color: var(--accent-hi); }
.term-card.is-bought .term-stamp { color: var(--gold); background: rgba(13, 10, 11, .65); }
@keyframes term-stamp { to { opacity: 1; transform: translate(-50%, -50%) rotate(-12deg) scale(1); } }

/* deal panel */
.term-deal { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.term-deal-badge {
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 14px; align-items: center;
  padding: 12px 16px; border-radius: 12px; border: 1px solid var(--line2); background: rgba(255, 255, 255, .02);
}
.term-deal-badge small { grid-column: 2; font-family: var(--term-mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.term-deal-badge b { grid-row: 1 / span 2; font-family: var(--display); font-weight: 400; font-size: 38px; line-height: 1; font-variant-numeric: tabular-nums; }
.term-deal-badge span { grid-column: 2; font-weight: 600; }
.term-deal.is-good .term-deal-badge { border-color: rgba(52, 211, 153, .45); background: rgba(52, 211, 153, .07); }
.term-deal.is-good .term-deal-badge b, .term-deal.is-good .term-deal-badge span { color: var(--green); }
.term-deal.is-bad .term-deal-badge { border-color: rgba(255, 92, 92, .4); background: rgba(255, 92, 92, .06); }
.term-deal.is-bad .term-deal-badge b, .term-deal.is-bad .term-deal-badge span { color: var(--red); }

.term-deal-rows { display: flex; flex-direction: column; gap: 6px; margin: 0; }
.term-deal-rows > div { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 12px; border-radius: 9px; background: rgba(255, 255, 255, .025); }
.term-deal-rows dt { color: var(--muted); font-size: 14px; }
.term-deal-rows dd { margin: 0; }
.term-deal-rows .price { font-size: 16px; }
.term-deal-offer { border: 1px solid var(--term-dim); }
.term-deal-offer .price { font-size: 19px; color: var(--term-hi); }
.term-deal-diff dd .price { font-size: 15px; }
.term-deal.is-good .term-deal-diff dd { color: var(--green); }
.term-deal.is-bad .term-deal-diff dd { color: var(--red); }

.term-meter { position: relative; height: 8px; border-radius: 99px; background: linear-gradient(90deg, var(--green), #8a8f86 50%, var(--red)); opacity: .85; }
.term-meter i {
  position: absolute; top: 50%; left: var(--x); width: 16px; height: 16px; border-radius: 50%; transform: translate(-50%, -50%);
  background: var(--text); border: 3px solid var(--term-bg); box-shadow: 0 0 0 2px var(--term), 0 0 12px var(--term);
}
.term-meter-scale { display: flex; justify-content: space-between; font-family: var(--term-mono); font-size: 11px; color: var(--dim); margin-top: -6px; }

/* dealer line */
.term-say {
  position: relative; z-index: 1; min-height: 1.6em; margin: 16px 0 12px; font-family: var(--term-mono); font-size: 14px; color: var(--term-hi);
  text-shadow: 0 0 8px rgba(61, 224, 198, .45);
}
.term-say::before { content: '> '; color: var(--term); }

.term-actions { position: relative; z-index: 1; display: flex; gap: 10px; flex-wrap: wrap; }
.term-actions .btn-lg { flex: 1 1 200px; }
.term-decline { border-color: rgba(255, 107, 107, .45); color: #ff9a9a; }
.term-decline:hover:not(:disabled) { background: rgba(239, 59, 59, .12); }
.term-accept { box-shadow: 0 8px 26px -10px rgba(228, 174, 57, .75), inset 0 -2px 0 rgba(0, 0, 0, .15); }
.term-accept .price { font-size: 16px; }

.term-foot {
  position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 14px;
  font-family: var(--term-mono); font-size: 12px; color: var(--muted);
}
.term-foot .price { font-size: 12px; }

/* offers so far */
.term-log { position: relative; z-index: 1; list-style: none; margin: 16px 0 0; padding: 12px 0 0; border-top: 1px dashed var(--term-dim); display: flex; flex-direction: column; gap: 6px; }
.term-log li { display: grid; grid-template-columns: 22px 48px minmax(0, 1fr) auto auto; gap: 10px; align-items: center; font-size: 13px; }
.term-log img { width: 48px; height: 36px; object-fit: contain; }
.term-log-k { font-family: var(--term-mono); color: var(--dim); text-align: center; }
.term-log-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.term-log-name em { font-style: normal; font-size: 11px; font-weight: 700; color: #cf6a32; }
.term-log-act { font-family: var(--term-mono); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.term-log li.is-gone { color: var(--muted); }
.term-log li.is-gone img { filter: grayscale(1) opacity(.6); }
.term-log li.is-gone .term-log-act { color: var(--accent-hi); }
.term-log li.is-bought .term-log-act { color: var(--gold); }

/* ------------------------------------------------------------------ idle, boot, result */
.term-idle { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; text-align: center; padding: 18px 0 8px; gap: 6px; }
.term-idle-art { display: flex; gap: 12px; justify-content: center; }
.term-idle-art img { width: 180px; max-width: 40vw; aspect-ratio: 4 / 3; object-fit: contain; filter: drop-shadow(0 12px 22px rgba(0, 0, 0, .7)) drop-shadow(0 0 18px rgba(61, 224, 198, .25)); animation: term-float 5s ease-in-out infinite; }
.term-idle-art img:nth-child(2) { animation-delay: -2.5s; }
@keyframes term-float { 50% { transform: translateY(-6px); } }

.term-boot { position: relative; z-index: 1; padding: 30px 6px 40px; font-family: var(--term-mono); color: var(--term-hi); font-size: 15px; }
.term-boot p { margin: 0 0 8px; opacity: 0; animation: term-line .2s ease-out forwards; }
.term-boot p:nth-child(2) { animation-delay: .4s; }
.term-boot p:nth-child(3) { animation-delay: .8s; }
@keyframes term-line { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: none; } }
.term-caret { display: inline-block; width: 9px; height: 1.1em; margin-left: 4px; vertical-align: -2px; background: var(--term); animation: term-blink .8s steps(1) infinite; }

.term-result { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(0, 240px) minmax(0, 1fr); gap: 22px; align-items: center; }
.term-result.is-empty { grid-template-columns: minmax(0, 1fr); }
.term-result .term-card.is-done .term-item { border-color: var(--gold); box-shadow: 0 0 40px -10px var(--gold); }
.term-result .term-say { margin-top: 0; }
.term-result .term-actions { margin-top: 14px; }

/* ------------------------------------------------------------------ how it works */
.term-how { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.term-how .panel { display: flex; gap: 12px; padding: 14px 16px; }
.term-how b {
  flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--term-faint); border: 1px solid var(--term-dim); color: var(--term); font-family: var(--display); font-weight: 400;
}
.term-how h3 { margin: 2px 0 4px; font-size: 15px; }
.term-how p { margin: 0; font-size: 13px; }

/* ------------------------------------------------------------------ sealed terminals list */
.term-units { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr)); gap: 14px; }
.term-unit { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 14px; padding: 14px; align-items: center; transition: border-color .15s, box-shadow .15s; }
.term-unit.is-selected { border-color: var(--term-dim); box-shadow: 0 0 26px -16px var(--term); }
.term-unit-img { aspect-ratio: 4 / 3; display: grid; place-items: center; border-radius: 10px; background: radial-gradient(closest-side, rgba(61, 224, 198, .14), transparent); }
.term-unit-img img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 10px 16px rgba(0, 0, 0, .6)); }
.term-unit h3 { margin: 0 0 6px; font-size: 17px; }
.term-unit-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; color: var(--muted); font-size: 13px; }
.term-unit-rtp { margin: 6px 0 12px; font-size: 12.5px; color: var(--term); font-family: var(--term-mono); }
.term-unit-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.term-unit-actions .price { font-size: 15px; }
.term-contents-note { margin: -4px 0 12px; font-size: 13px; }

/* accept confirmation */
.term-confirm .item { max-width: 220px; margin: 4px auto 12px; }
.term-confirm p { margin: 6px 0; }
.term-confirm .price { vertical-align: -2px; }

/* ------------------------------------------------------------------ phones */
@media (max-width: 720px) {
  .term-frame { padding: 0 14px 16px; }
  .term-bar { margin: 0 -14px 12px; padding: 10px 14px 10px 38px; font-size: 11px; }
  .term-body, .term-result { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .term-card { max-width: 260px; width: 100%; margin: 0 auto; }
  .term-result .term-card { max-width: 220px; }
  .term-deal-badge b { font-size: 32px; }
  .term-actions .btn-lg { flex: none; width: 100%; height: 48px; }
  .term-actions { flex-direction: column-reverse; }
  .term-pip { width: 34px; height: 28px; }
  .term-how { grid-template-columns: minmax(0, 1fr); }
  .term-log li { grid-template-columns: 18px 40px minmax(0, 1fr) auto; }
  .term-log-act { display: none; }
  .term-unit { grid-template-columns: 110px minmax(0, 1fr); }
}
@media (max-width: 400px) {
  .term-unit { grid-template-columns: minmax(0, 1fr); }
  .term-unit-img { max-width: 200px; margin: 0 auto; }
}

/* ------------------------------------------------------------------ one terminal (#/terminal/<id>): a case-page head */
.term-head { align-items: center; }
.term-head-img {
  width: 200px; flex: none; aspect-ratio: 4 / 3; display: grid; place-items: center; border-radius: 14px;
  background: radial-gradient(closest-side, rgba(61, 224, 198, .18), transparent);
}
.term-head-img img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 16px 20px rgba(0, 0, 0, .6)); }
.term-head-main { min-width: 0; }
.term-head-main h1 { margin-top: 8px; }
.term-head-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
@media (max-width: 860px) {
  .term-head-img { width: 170px; }
  .term-head-actions { justify-content: center; }
}

/* Buttons with a price in them ("Unseal for 3.24") get long in some languages: they wrap instead of leaving the box */
.term-unit-actions .btn, .term-head-actions .btn, .term-actions .btn, .term-idle .btn {
  max-width: 100%; height: auto; min-height: 40px; padding-top: 8px; padding-bottom: 8px; white-space: normal; text-align: center;
}
.term-unit-actions .btn-sm { min-height: 32px; padding-top: 5px; padding-bottom: 5px; }
.term-unit-body { min-width: 0; }

/* ------------------------------------------------------------------ reduced motion */
@media (prefers-reduced-motion: reduce) {
  .term-scan::after, .is-live .term-led, .term-pip.is-now, .term-idle-art img, .term-caret { animation: none; }
  .term-card.is-enter, .term-card.is-declined, .term-card.is-bought .term-item, .term-boot p { animation: none; opacity: 1; }
  .term-card.is-declined .term-stamp, .term-card.is-bought .term-stamp { animation: none; opacity: 1; transform: translate(-50%, -50%) rotate(-12deg); }
}
