:root {
  font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  color-scheme: dark;
  --bg: #06111d;
  --surface: #0a1928;
  --surface-deep: #071521;
  --surface-raised: #0d2132;
  --line: rgba(102, 175, 198, .2);
  --line-strong: rgba(102, 175, 198, .38);
  --text: #e9f8ff;
  --muted: #87a6b8;
  --soft: #5e8193;
  --cyan: #56f2d1;
  --blue: #55bfff;
  --amber: #f2c66d;
  --danger: #ff758c;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body { margin: 0; min-width: 320px; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }

.user-page {
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
}

.app-shell {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  padding: 28px;
  background:
    linear-gradient(rgba(66, 155, 183, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(66, 155, 183, .045) 1px, transparent 1px),
    linear-gradient(135deg, #071521 0%, #06111d 52%, #081923 100%);
  background-size: 40px 40px, 40px 40px, auto;
}

.app-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(86, 242, 209, .045), transparent 18%, transparent 82%, rgba(85, 191, 255, .035));
}

.app-frame {
  position: relative;
  width: min(1380px, 100%);
  min-height: calc(100vh - 56px);
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(5, 17, 28, .94);
  box-shadow: 0 34px 90px rgba(0, 0, 0, .46), inset 0 1px rgba(255, 255, 255, .025);
}

.app-frame::before,
.app-frame::after {
  content: "";
  position: absolute;
  z-index: 2;
  top: -1px;
  width: 110px;
  height: 2px;
}

.app-frame::before { left: 22px; background: linear-gradient(90deg, var(--cyan), transparent); }
.app-frame::after { right: 22px; background: linear-gradient(90deg, transparent, var(--blue)); }

.app-header {
  position: relative;
  z-index: 1;
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 26px;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 23, 36, .86);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #f1fcff;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .5px;
}

.brand-mark {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(86, 242, 209, .72);
  border-radius: 6px;
  color: #041319;
  background: linear-gradient(135deg, var(--cyan), #82dfff);
  box-shadow: 0 0 20px rgba(86, 242, 209, .22), inset 0 0 0 1px rgba(255, 255, 255, .35);
  font-weight: 900;
}

.header-meta { display: flex; align-items: center; }
.system-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #8fb1c1;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .4px;
}
.system-status i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 11px rgba(86, 242, 209, .76);
}
.console-grid {
  position: relative;
  z-index: 1;
  min-height: 680px;
  display: grid;
  grid-template-columns: 344px minmax(0, 1fr);
  grid-template-areas: "hero panel";
}

.hero {
  grid-area: hero;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 34px;
  padding: 38px 30px 30px;
  overflow: hidden;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(160deg, rgba(13, 39, 55, .9), rgba(6, 20, 32, .94) 58%),
    repeating-linear-gradient(90deg, transparent 0 32px, rgba(85, 191, 255, .035) 32px 33px);
}

.hero::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 2px;
  height: 150px;
  background: linear-gradient(180deg, var(--cyan), transparent);
  box-shadow: 0 0 18px rgba(86, 242, 209, .35);
}

.hero-copy,
.inventory-block,
.support-block { position: relative; z-index: 1; }

.hero h1 {
  margin: 0 0 12px;
  color: #f3fcff;
  font-size: 40px;
  font-weight: 760;
  line-height: 1.12;
  letter-spacing: .5px;
}

.hero-copy p {
  max-width: 270px;
  margin: 0;
  color: #92adbb;
  font-size: 13px;
  line-height: 1.8;
}

.inventory-block { margin-top: auto; }
.block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  color: #678b9d;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .2px;
}
.block-head span:last-child { color: #87a6b8; letter-spacing: .3px; }

.inventory { display: grid; gap: 7px; }
.stock {
  min-height: 72px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(102, 175, 198, .15);
  border-radius: 6px;
  background: rgba(4, 16, 27, .58);
}
.stock-name {
  grid-column: 1;
  grid-row: 1;
  overflow: hidden;
  color: #9bb8c7;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 1px;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}
.stock-number {
  grid-column: 2;
  grid-row: 1 / 3;
  color: #edfbff;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
}
.stock-caption { grid-column: 1; grid-row: 2; color: #557f91; font-size: 11px; }

.support-block {
  display: grid;
  gap: 6px;
  padding-top: 18px;
  border-top: 1px solid rgba(102, 175, 198, .12);
}
.support-label {
  margin-bottom: 2px;
  color: #557f91;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .2px;
}
.support-qq { color: #7e9dad; font-size: 11px; line-height: 1.35; }

.panel {
  grid-area: panel;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 38px 42px 34px;
  background: rgba(8, 23, 36, .76);
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}
.panel-title { max-width: 650px; }
.section-label {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--cyan);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .2px;
}
.panel h2 {
  margin: 13px 0 8px;
  color: #f2fbff;
  font-size: 26px;
  font-weight: 730;
  line-height: 1.35;
}
.panel-title p { margin: 0; color: #8aa6b5; font-size: 13px; line-height: 1.7; }
.pills { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.pill {
  padding: 7px 9px;
  border: 1px solid rgba(86, 242, 209, .18);
  border-radius: 4px;
  color: #87ddcd;
  background: rgba(30, 89, 84, .2);
  font-family: ui-monospace, Consolas, monospace;
  font-size: 9px;
  font-weight: 700;
  white-space: nowrap;
}

#extract-form {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding-top: 24px;
}
.field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 9px;
}
label { display: block; color: #d5edf4; font-size: 13px; font-weight: 700; }
.field-limit {
  color: #608899;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 10px;
  letter-spacing: .2px;
}

.input-shell {
  overflow: hidden;
  border: 1px solid rgba(102, 175, 198, .27);
  border-radius: 6px;
  background: #040e18;
  box-shadow: inset 0 1px 12px rgba(0, 0, 0, .3);
  transition: border-color .16s ease, box-shadow .16s ease;
}
.input-shell:focus-within {
  border-color: rgba(86, 242, 209, .68);
  box-shadow: 0 0 0 3px rgba(86, 242, 209, .08), inset 0 1px 12px rgba(0, 0, 0, .3);
}
.textarea {
  width: 100%;
  min-height: 270px;
  display: block;
  resize: vertical;
  padding: 18px 18px 12px;
  border: 0;
  outline: 0;
  color: #dff9ff;
  caret-color: var(--cyan);
  background:
    linear-gradient(rgba(85, 191, 255, .025) 1px, transparent 1px),
    transparent;
  background-size: 100% 29px;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 13px;
  line-height: 1.82;
}
.textarea::placeholder { color: #4f7486; }
.action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  margin-top: 17px;
}
.action-note { min-width: 0; }
.check {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #91adb9;
  font-size: 11px;
}
.check::before {
  content: "";
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 10px rgba(86, 242, 209, .7);
}
.action-buttons { display: flex; align-items: center; justify-content: flex-end; gap: 9px; }

.primary,
.download {
  min-height: 43px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .5px;
  text-decoration: none;
  transition: border-color .16s ease, background .16s ease, box-shadow .16s ease, transform .16s ease;
}
.primary {
  min-width: 154px;
  padding: 0 22px;
  border: 1px solid rgba(139, 255, 232, .4);
  color: #031417;
  background: linear-gradient(135deg, #68f7da, #62cfff);
  box-shadow: 0 9px 26px rgba(47, 213, 207, .18), inset 0 1px rgba(255, 255, 255, .5);
}
.primary:hover { transform: translateY(-1px); box-shadow: 0 12px 30px rgba(47, 213, 207, .25), inset 0 1px rgba(255, 255, 255, .55); }
.primary:disabled { opacity: .58; cursor: not-allowed; transform: none; }
.download {
  padding: 0 16px;
  border: 1px solid rgba(86, 242, 209, .32);
  color: #b9f7eb;
  background: rgba(26, 89, 82, .22);
}
.download:hover { border-color: rgba(86, 242, 209, .65); background: rgba(30, 114, 103, .3); }
.primary:focus-visible,
.download:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }

.results {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.result-row {
  display: grid;
  grid-template-columns: minmax(150px, .85fr) auto minmax(220px, 1.2fr);
  align-items: center;
  gap: 14px;
  margin-top: 8px;
  padding: 11px 13px;
  border: 1px solid rgba(102, 175, 198, .11);
  border-radius: 5px;
  background: rgba(3, 14, 23, .64);
  color: #91adba;
  font-size: 12px;
}
.result-key { overflow: hidden; color: #b6dbe8; font-family: ui-monospace, Consolas, monospace; text-overflow: ellipsis; }
.status {
  padding: 4px 7px;
  border-radius: 3px;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 9px;
  font-weight: 800;
  white-space: nowrap;
}
.success {
  color: #7ff2d0;
  background: rgba(32, 137, 106, .2);
  box-shadow: inset 0 0 0 1px rgba(86, 242, 209, .16);
}
.invalid,
.used,
.expired,
.empty {
  color: #ff9cac;
  background: rgba(157, 48, 70, .18);
  box-shadow: inset 0 0 0 1px rgba(255, 117, 140, .15);
}

.extract-progress {
  margin-top: 16px;
  padding: 13px 14px 12px;
  border: 1px solid rgba(102, 175, 198, .14);
  border-radius: 5px;
  background: rgba(4, 16, 27, .7);
}
.progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #7697a7;
  font: 700 10px/1.4 ui-monospace, Consolas, monospace;
}
.progress-meta span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress-meta strong { flex: none; color: #dff9ff; }
.progress-track {
  height: 5px;
  margin-top: 9px;
  overflow: hidden;
  border-radius: 2px;
  background: #0c2939;
}
.progress-fill {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--blue));
  box-shadow: 0 0 12px rgba(86, 242, 209, .55);
  transition: width .22s ease;
}

.toast {
  position: fixed;
  z-index: 20;
  right: 24px;
  bottom: 24px;
  max-width: min(380px, calc(100vw - 32px));
  padding: 12px 15px;
  border: 1px solid rgba(85, 191, 255, .3);
  border-radius: 5px;
  color: #e4faff;
  background: #0b2233;
  box-shadow: 0 18px 44px rgba(0, 0, 0, .42);
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  opacity: 0;
  transform: translateY(18px);
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.toast.show { opacity: 1; transform: none; }
.toast.error { border-color: rgba(255, 117, 140, .38); background: #32141e; }

@media (max-width: 1050px) {
  .console-grid { grid-template-columns: 300px minmax(0, 1fr); }
  .hero { padding: 32px 24px 26px; }
  .panel { padding: 32px 30px 30px; }
  .panel-head { flex-direction: column; gap: 16px; }
  .pills { justify-content: flex-start; }
}

@media (max-width: 760px) {
  .app-shell { padding: 0; overflow: visible; background-size: 32px 32px, 32px 32px, auto; }
  .app-frame {
    width: 100%;
    min-height: 100vh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .app-header { min-height: 62px; padding: 0 18px; }
  .system-status { font-size: 9px; }
  .console-grid { min-height: 0; grid-template-columns: 1fr; grid-template-areas: "hero" "panel"; }
  .hero {
    gap: 24px;
    padding: 28px 20px 22px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .hero h1 { margin-top: 10px; font-size: 34px; }
  .hero-copy p { max-width: 430px; }
  .inventory-block { margin-top: 0; }
  .inventory { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .stock {
    min-width: 0;
    min-height: 94px;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    align-content: center;
    gap: 4px;
    padding: 11px 10px;
  }
  .stock-name,
  .stock-number,
  .stock-caption { grid-column: 1; grid-row: auto; }
  .stock-name { font-size: 9px; }
  .stock-number { margin-top: 3px; font-size: 24px; }
  .stock-caption { font-size: 10px; }
  .support-block { grid-template-columns: 1fr 1fr; }
  .support-label { grid-column: 1 / -1; }
  .panel { padding: 27px 20px 24px; }
  .panel h2 { font-size: 23px; }
  .textarea { min-height: 230px; }
  .action-row { align-items: stretch; flex-direction: column; gap: 14px; }
  .action-buttons { width: 100%; flex-direction: column-reverse; align-items: stretch; }
  .primary,
  .download { width: 100%; }
  .result-row { grid-template-columns: 1fr auto; }
  .result-row > :last-child { grid-column: 1 / -1; }
}

@media (max-width: 430px) {
  .brand { gap: 9px; font-size: 12px; letter-spacing: 1.8px; }
  .brand-mark { width: 30px; height: 30px; }
  .system-status { letter-spacing: .7px; }
  .hero { padding-inline: 16px; }
  .hero h1 { font-size: 31px; }
  .inventory { gap: 4px; }
  .stock { padding-inline: 7px; }
  .stock-number { font-size: 22px; }
  .support-block { grid-template-columns: 1fr; }
  .support-label { grid-column: auto; }
  .panel { padding-inline: 16px; }
  .panel-head { gap: 14px; }
  .field-head { align-items: flex-start; }
  .field-limit { max-width: 145px; text-align: right; }
  .result-row { grid-template-columns: 1fr auto; gap: 9px; padding: 10px; }
  .result-key { max-width: 210px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
