:root {
  color-scheme: dark;
  --charcoal: #0a1116;
  --surface: #111b22;
  --surface-2: #17242c;
  --paper: #efe7d4;
  --track: #e35a3f;
  --track-dark: #8d3328;
  --blue: #58b7ff;
  --lime: #ddff4f;
  --white: #f7f1e4;
  --ink: #081016;
  --stage: #131d24;
  --panel: rgba(10, 17, 22, 0.92);
  --panel-2: rgba(21, 32, 39, 0.95);
  --line: rgba(247, 241, 228, 0.18);
  --muted: rgba(247, 241, 228, 0.66);
  --shadow: rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--white);
  font-family: Inter, "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  background:
    linear-gradient(118deg, rgba(227, 90, 63, 0.2) 0 16%, transparent 16% 100%),
    repeating-linear-gradient(118deg, transparent 0 34px, rgba(247, 241, 228, 0.035) 34px 36px, transparent 36px 74px),
    linear-gradient(135deg, #080d11 0%, #132029 48%, #0d1112 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(115deg, transparent 0 64%, rgba(247, 241, 228, 0.055) 64% 64.4%, transparent 64.4% 100%),
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: auto, 100% 72px;
}

button,
textarea,
input {
  font: inherit;
}

.app-shell {
  position: relative;
  width: min(1440px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  padding: 6px 0 26px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--lime);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(42px, 6vw, 92px);
  line-height: 0.86;
  letter-spacing: 0;
}

.hero-copy {
  max-width: 620px;
  margin-top: 14px;
  color: var(--muted);
  font-size: clamp(15px, 1.8vw, 18px);
  line-height: 1.55;
}

h2 {
  font-size: 17px;
}

.status-pill {
  flex: 0 0 auto;
  min-height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 14px;
  color: var(--muted);
  background: rgba(9, 15, 20, 0.72);
  font-size: 13px;
}

.status-pill.is-online {
  color: var(--ink);
  border-color: transparent;
  background: var(--lime);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(340px, 430px) minmax(0, 1fr);
  gap: 22px;
  align-items: stretch;
}

.control-panel,
.result-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 28px 80px var(--shadow);
  backdrop-filter: blur(16px);
}

.control-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px;
  overflow: hidden;
}

.control-panel > * {
  position: relative;
  z-index: 1;
}

.control-panel::before {
  content: "REGISTRATION";
  position: absolute;
  top: 18px;
  right: -44px;
  width: 190px;
  min-height: 28px;
  display: grid;
  place-items: center;
  color: rgba(8, 16, 22, 0.82);
  background: var(--lime);
  font-size: 11px;
  font-weight: 900;
  transform: rotate(34deg);
}

.panel-title,
.stage-label {
  display: flex;
  align-items: center;
  gap: 12px;
}

.panel-title > span,
.stage-label > span {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid rgba(247, 241, 228, 0.2);
  border-radius: 50%;
  color: var(--lime);
  font-size: 13px;
  font-weight: 900;
}

.panel-title p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.credential-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid rgba(247, 241, 228, 0.16);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(227, 90, 63, 0.16), transparent 48%),
    rgba(247, 241, 228, 0.06);
}

.credential-strip div {
  display: grid;
  gap: 4px;
  min-height: 66px;
  align-content: center;
  padding: 10px;
}

.credential-strip div + div {
  border-left: 1px solid rgba(247, 241, 228, 0.12);
}

.credential-strip span {
  color: rgba(247, 241, 228, 0.5);
  font-size: 11px;
  font-weight: 900;
}

.credential-strip strong {
  overflow: hidden;
  color: var(--white);
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-zone {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 315px;
  overflow: hidden;
  border: 1px solid rgba(247, 241, 228, 0.2);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(247, 241, 228, 0.08) 0 1px, transparent 1px 100%),
    linear-gradient(0deg, rgba(247, 241, 228, 0.06) 0 1px, transparent 1px 100%),
    radial-gradient(circle at 50% 38%, rgba(247, 241, 228, 0.12), transparent 28%),
    linear-gradient(145deg, rgba(88, 183, 255, 0.1), transparent 42%),
    linear-gradient(135deg, rgba(28, 44, 53, 0.98), rgba(10, 17, 22, 0.98));
  background-size: 36px 100%, 100% 36px, auto, auto, auto;
  text-align: center;
  cursor: pointer;
}

.upload-zone::before {
  content: "";
  position: absolute;
  width: 54%;
  aspect-ratio: 0.72;
  border: 2px solid rgba(247, 241, 228, 0.2);
  border-radius: 999px 999px 18px 18px;
  transform: translateY(-14px);
}

.upload-zone::after {
  content: "";
  position: absolute;
  width: 36%;
  height: 22%;
  top: 57%;
  border: 2px solid rgba(247, 241, 228, 0.12);
  border-radius: 999px 999px 20px 20px;
}

.photo-tag {
  position: absolute;
  left: 14px;
  top: 14px;
  z-index: 3;
  border: 1px solid rgba(247, 241, 228, 0.18);
  border-radius: 999px;
  padding: 5px 9px;
  color: rgba(247, 241, 228, 0.64);
  background: rgba(8, 16, 22, 0.58);
  font-size: 11px;
  font-weight: 900;
}

.upload-zone.is-dragging {
  border-color: var(--lime);
}

.upload-zone.has-image {
  place-items: stretch;
  padding: 0;
  background: #0c1419;
}

.upload-zone.has-image::before {
  display: none;
  content: none;
}

.upload-button {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  border: 0;
  border-radius: 999px;
  padding: 0 18px 0 10px;
  color: var(--ink);
  background: var(--paper);
  font-weight: 900;
  cursor: pointer;
}

.upload-icon {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 50%;
  background: var(--lime);
  font-size: 23px;
  line-height: 1;
}

#upload-hint {
  position: absolute;
  z-index: 2;
  left: 18px;
  right: 18px;
  bottom: 18px;
  color: var(--muted);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#source-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 1;
}

.upload-zone.has-image::after {
  display: none;
  content: none;
}

.upload-zone.has-image .photo-tag {
  display: none;
}

.upload-zone.has-image .upload-button {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 4;
  min-height: 34px;
  border: 1px solid rgba(247, 241, 228, 0.28);
  padding: 0 10px 0 7px;
  color: var(--white);
  background: rgba(8, 16, 22, 0.74);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.upload-zone.has-image .upload-icon {
  width: 22px;
  height: 22px;
  font-size: 17px;
}

.upload-zone.has-image #upload-hint {
  display: none;
}

.upload-zone.has-image:hover .upload-button,
.upload-zone.has-image:focus-within .upload-button {
  opacity: 1;
  transform: translateY(0);
}

.sport-picker,
.sport-field,
.section-block,
.note-field {
  display: grid;
  gap: 10px;
  border-top: 1px solid rgba(247, 241, 228, 0.1);
  padding-top: 14px;
}

.sport-picker > span,
.sport-field span,
.note-field span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.sport-field input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--white);
  background: var(--panel-2);
  outline: none;
}

.sport-field input {
  min-height: 54px;
  padding: 0 14px;
  font-size: 18px;
  font-weight: 900;
}

.sport-field input:focus,
textarea:focus {
  border-color: var(--lime);
  box-shadow: 0 0 0 3px rgba(234, 255, 79, 0.14);
}

.quick-sports {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quick-sports button {
  min-height: 36px;
  border: 1px solid rgba(246, 241, 223, 0.2);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--white);
  background: rgba(246, 241, 223, 0.08);
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.quick-sports button:hover,
.quick-sports button.is-selected {
  color: var(--ink);
  border-color: var(--lime);
  background: var(--lime);
  transform: translateY(-1px);
}

.custom-sport-button {
  border-style: dashed !important;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.segmented label {
  position: relative;
  min-height: 44px;
  display: grid;
  place-items: center;
  color: var(--muted);
  cursor: pointer;
}

.segmented label + label {
  border-left: 1px solid var(--line);
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented input:checked + span {
  color: var(--ink);
  background: linear-gradient(135deg, var(--lime), #fff29a);
}

.segmented span {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  padding: 0 8px;
}

textarea {
  min-height: 92px;
  resize: vertical;
  padding: 12px;
}

.generate-button {
  position: relative;
  align-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: min(230px, 100%);
  min-height: 48px;
  overflow: hidden;
  border: 1px solid rgba(247, 241, 228, 0.16);
  border-radius: 999px;
  color: rgba(247, 241, 228, 0.72);
  background:
    linear-gradient(90deg, rgba(247, 241, 228, 0.08), rgba(247, 241, 228, 0.12));
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
  transition: width 220ms ease, min-height 220ms ease, border-radius 220ms ease, background 180ms ease, border-color 180ms ease, color 160ms ease, box-shadow 180ms ease, transform 160ms ease;
}

.generate-button::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(105deg, rgba(255, 255, 255, 0.18) 0 8px, transparent 8px 30px);
  background-size: 120px 100%;
  opacity: 0;
  transition: opacity 140ms ease;
}

.generate-button.is-ready {
  color: var(--white);
  background:
    linear-gradient(90deg, rgba(247, 241, 228, 0.09), rgba(247, 241, 228, 0.15));
}

.generate-button.is-ready:hover,
.generate-button.is-generating {
  color: var(--white);
  border-color: rgba(255, 138, 89, 0.44);
  background: linear-gradient(90deg, var(--track-dark), var(--track), #ff8a59);
  box-shadow: 0 14px 34px rgba(227, 90, 63, 0.24), inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}

.generate-button.is-ready:hover {
  width: min(300px, 100%);
  transform: translateY(-1px);
}

.generate-button.is-generating {
  width: 100%;
  min-height: 58px;
  border-radius: 8px;
  animation: powerPulse 900ms ease-in-out infinite;
}

.generate-button.is-ready:hover::before,
.generate-button.is-generating::before {
  opacity: 1;
  animation: speedStripe 520ms linear infinite;
}

.generate-button span {
  position: relative;
}

.generate-button:disabled {
  color: rgba(246, 241, 223, 0.42);
  background: #263139;
  border-color: transparent;
  cursor: not-allowed;
}

.button-track {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background:
    linear-gradient(90deg, transparent 0 38%, #111 38% 48%, transparent 48% 100%),
    linear-gradient(#fff 0 36%, #111 36% 46%, #fff 46% 100%);
}

.generate-button.is-ready:hover .button-track,
.generate-button.is-generating .button-track {
  animation: markSpin 680ms linear infinite;
}

.result-panel {
  min-height: 720px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.stage-label {
  min-height: 76px;
  border-bottom: 1px solid var(--line);
  padding: 14px 18px;
  background: rgba(10, 17, 22, 0.56);
}

.stage-label p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.result-stage {
  position: relative;
  min-height: 560px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--stage);
}

.result-stage::before {
  content: "";
  position: absolute;
  inset: 34px;
  border: 1px solid rgba(247, 241, 228, 0.16);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(227, 90, 63, 0.16), transparent 18%),
    radial-gradient(circle at 50% 18%, rgba(247, 241, 228, 0.1), transparent 22%),
    linear-gradient(90deg, transparent 0 49%, rgba(247, 241, 228, 0.08) 49% 51%, transparent 51% 100%);
  opacity: 0;
  transition: opacity 220ms ease;
}

.result-stage::after {
  content: "PLAYER CARD";
  position: absolute;
  left: 42px;
  bottom: 34px;
  color: rgba(247, 241, 228, 0.12);
  font-size: clamp(42px, 7vw, 98px);
  font-weight: 900;
  line-height: 0.85;
  opacity: 0;
  transition: opacity 220ms ease;
}

.result-stage.is-loading {
  background:
    linear-gradient(90deg, rgba(247, 241, 228, 0.055) 0 1px, transparent 1px 100%),
    linear-gradient(0deg, rgba(247, 241, 228, 0.04) 0 1px, transparent 1px 100%),
    #18252d;
  background-size: 54px 100%, 100% 54px, auto;
}

.result-stage.is-loading::before,
.result-stage.is-loading::after {
  opacity: 1;
}

#result-image {
  width: min(100%, 540px);
  height: min(100%, 810px);
  max-height: calc(100vh - 210px);
  object-fit: contain;
  z-index: 4;
  filter: drop-shadow(0 26px 40px rgba(0, 0, 0, 0.45));
}

.loading-scene {
  position: relative;
  z-index: 5;
  display: grid;
  gap: 22px;
  place-items: center;
  width: min(460px, 88%);
  color: var(--white);
  font-weight: 900;
}

.loading-track {
  position: relative;
  width: min(390px, 82vw);
  height: 190px;
  border: 3px solid rgba(247, 241, 228, 0.22);
  border-radius: 999px;
  background:
    linear-gradient(90deg, transparent 0 48%, rgba(247, 241, 228, 0.2) 48% 50%, transparent 50% 100%),
    repeating-linear-gradient(0deg, rgba(247, 241, 228, 0.18) 0 2px, transparent 2px 42px),
    linear-gradient(135deg, var(--track-dark), var(--track));
  box-shadow: inset 0 0 0 24px rgba(125, 45, 34, 0.54);
}

.loading-track::before {
  content: "";
  position: absolute;
  inset: 38px;
  border-radius: 999px;
  background:
    linear-gradient(90deg, transparent 0 47%, rgba(247, 241, 228, 0.2) 47% 49%, transparent 49% 100%),
    #173e31;
  box-shadow: inset 0 0 0 2px rgba(247, 241, 228, 0.18);
}

.track-lane {
  position: absolute;
  left: 50%;
  top: 50%;
  border: 2px solid rgba(247, 241, 228, 0.28);
  border-radius: 999px;
  transform: translate(-50%, -50%);
}

.lane-one {
  width: calc(100% - 22px);
  height: calc(100% - 22px);
}

.lane-two {
  width: calc(100% - 58px);
  height: calc(100% - 58px);
}

.lane-three {
  width: calc(100% - 94px);
  height: calc(100% - 94px);
}

.loading-player {
  position: absolute;
  left: 72px;
  top: 58px;
  width: 42px;
  height: 64px;
  animation: playerRun 1.1s ease-in-out infinite;
}

.loading-player::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--lime);
}

.loading-player::after {
  content: "";
  position: absolute;
  left: 11px;
  top: 20px;
  width: 22px;
  height: 34px;
  border-radius: 10px 10px 5px 5px;
  background: var(--track);
  box-shadow:
    -15px 22px 0 -8px var(--white),
    18px 24px 0 -8px var(--white),
    -20px 12px 0 -9px var(--blue),
    23px 10px 0 -9px var(--blue);
}

.loading-shadow {
  position: absolute;
  left: 82px;
  top: 128px;
  width: 142px;
  height: 12px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.28);
  animation: shadowPulse 1.1s ease-in-out infinite;
}

.loading-copy {
  display: grid;
  gap: 10px;
  width: min(390px, 100%);
  justify-items: center;
  text-align: center;
}

#loading-caption {
  min-height: 44px;
  display: grid;
  place-items: center;
  color: var(--white);
  font-size: 16px;
  line-height: 1.35;
}

.progress-shell {
  width: 100%;
  height: 10px;
  overflow: hidden;
  border: 1px solid rgba(247, 241, 228, 0.2);
  border-radius: 999px;
  background: rgba(247, 241, 228, 0.1);
}

.progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--lime), var(--blue), var(--track));
  transition: width 420ms ease;
}

#progress-text {
  color: var(--muted);
  font-size: 13px;
}

.empty-state {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 10px;
  width: min(410px, 82%);
  border: 1px dashed rgba(247, 241, 228, 0.2);
  border-radius: 8px;
  padding: 28px;
  text-align: center;
  color: var(--muted);
  background: rgba(247, 241, 228, 0.045);
}

.empty-bib {
  justify-self: center;
  border: 1px solid rgba(247, 241, 228, 0.22);
  border-radius: 8px;
  padding: 8px 14px;
  color: var(--ink);
  background: var(--paper);
  font-size: 20px;
  font-weight: 900;
}

.empty-state strong {
  color: var(--white);
  font-size: clamp(22px, 3vw, 32px);
  line-height: 1.18;
}

.result-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 96px;
  border-top: 1px solid var(--line);
  padding: 18px 20px;
  background: rgba(8, 13, 17, 0.94);
}

.result-title {
  font-size: 18px;
  font-weight: 900;
}

.result-meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.download-button {
  display: inline-grid;
  min-width: 104px;
  min-height: 44px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--white);
  text-decoration: none;
  font-weight: 900;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}

.download-button:not([aria-disabled="true"]):hover,
.history-download:hover,
.ghost-button:hover {
  color: var(--ink);
  border-color: var(--lime);
  background: var(--lime);
}

.download-button[aria-disabled="true"] {
  color: rgba(246, 241, 223, 0.35);
  pointer-events: none;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 20;
  max-width: min(520px, calc(100vw - 32px));
  transform: translateX(-50%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 16px;
  color: var(--white);
  background: #102817;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.38);
}

.history-panel {
  margin-top: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(247, 241, 228, 0.045) 0 1px, transparent 1px 100%),
    rgba(10, 17, 22, 0.84);
  background-size: 64px 100%, auto;
  box-shadow: 0 28px 80px var(--shadow);
  overflow: hidden;
}

.history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding: 18px 20px;
}

.ghost-button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--white);
  background: rgba(247, 241, 228, 0.06);
  font-weight: 900;
  cursor: pointer;
}

.history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px;
  padding: 18px;
}

.history-empty {
  grid-column: 1 / -1;
  color: var(--muted);
  min-height: 72px;
  display: grid;
  place-items: center;
  text-align: center;
}

.history-card {
  display: grid;
  grid-template-rows: auto minmax(54px, auto) auto;
  overflow: hidden;
  border: 1px solid rgba(247, 241, 228, 0.14);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(239, 231, 212, 0.08), transparent 34%),
    rgba(247, 241, 228, 0.055);
}

.history-preview {
  display: block;
  width: 100%;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border: 0;
  padding: 0;
  background: #0c1419;
  cursor: pointer;
}

.history-preview img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform 220ms ease;
}

.history-preview:hover img {
  transform: scale(1.035);
}

.history-info {
  display: grid;
  gap: 4px;
  padding: 10px;
}

.history-info strong {
  overflow: hidden;
  color: var(--white);
  font-size: 14px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-info span {
  color: var(--muted);
  font-size: 12px;
}

.history-download {
  display: grid;
  min-height: 38px;
  place-items: center;
  border-top: 1px solid rgba(247, 241, 228, 0.12);
  color: var(--white);
  text-decoration: none;
  font-size: 13px;
  font-weight: 900;
}

@keyframes playerRun {
  0%, 100% {
    transform: translateX(0) rotate(-8deg);
  }
  50% {
    transform: translateX(42px) rotate(6deg);
  }
}

@keyframes shadowPulse {
  0%, 100% {
    transform: scaleX(0.82);
    opacity: 0.32;
  }
  50% {
    transform: scaleX(1);
    opacity: 0.22;
  }
}

@keyframes speedStripe {
  from {
    background-position: 0 0;
  }
  to {
    background-position: 120px 0;
  }
}

@keyframes markSpin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes powerPulse {
  0%, 100% {
    box-shadow: 0 14px 34px rgba(227, 90, 63, 0.24), inset 0 0 0 1px rgba(255, 255, 255, 0.16);
  }
  50% {
    box-shadow: 0 20px 46px rgba(227, 90, 63, 0.38), inset 0 0 0 1px rgba(255, 255, 255, 0.24);
  }
}

@media (max-width: 960px) {
  .app-shell {
    padding: 18px;
  }

  .topbar {
    align-items: start;
    flex-direction: column;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .result-panel {
    min-height: 620px;
  }

  .result-stage {
    min-height: 510px;
  }

  .history-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
}

@media (max-width: 540px) {
  .app-shell {
    padding: 14px;
  }

  .segmented {
    grid-template-columns: 1fr;
  }

  .segmented label + label {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .result-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .history-head {
    align-items: stretch;
    flex-direction: column;
  }

  .download-button {
    width: 100%;
  }

  .ghost-button {
    width: 100%;
  }
}
