:root {
  --paper: #e6e9e2;
  --paper-strong: #dde1d9;
  --ink: #171915;
  --ink-soft: #3f433b;
  --muted: #464c43;
  --line: rgba(23, 25, 21, 0.18);
  --signal: #b93214;
  --acid: #c9f45a;
  --white: #fff;
  --danger: #c33120;
  --shadow: 0 24px 80px rgba(23, 25, 21, 0.14);
  --display: "Songti SC", "STSong", "Noto Serif CJK SC", serif;
  --body: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: "SFMono-Regular", "Cascadia Mono", "Roboto Mono", monospace;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--body);
  background-color: var(--paper);
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

:where(button, a, input):focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 3px;
}

.site-header :where(button, a):focus-visible {
  outline-color: var(--acid);
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.site-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 82px;
  padding: 0 clamp(20px, 4vw, 64px);
  color: var(--white);
  background: var(--ink);
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: var(--ink);
  font: 700 20px/1 var(--mono);
  background: var(--acid);
  clip-path: polygon(0 0, 100% 0, 100% 73%, 76% 100%, 0 100%);
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-copy strong {
  font-size: 18px;
  font-weight: 700;
}

.brand-copy small {
  color: rgba(255, 255, 255, 0.55);
  font: 10px/1.2 var(--mono);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 24px;
}

.price-clock {
  color: rgba(255, 255, 255, 0.58);
  font: 12px/1.4 var(--mono);
}

.ghost-button,
.primary-button,
.outline-button,
.text-button,
.icon-button {
  border: 0;
  cursor: pointer;
}

.ghost-button {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 0 15px;
  color: var(--white);
  font-weight: 650;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 4px;
  transition:
    color 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.ghost-button:hover {
  color: var(--ink);
  background: var(--acid);
  border-color: var(--acid);
}

.page-shell {
  width: min(1360px, 100%);
  margin: 0 auto;
  padding: 0 clamp(20px, 4vw, 56px) 72px;
}

.masthead {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 40px;
  min-height: 310px;
  padding: 62px 0 46px;
  border-bottom: 1px solid var(--line);
  animation: rise-in 560ms cubic-bezier(0.2, 0.72, 0.2, 1) both;
}

.masthead h1 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(50px, 7.4vw, 104px);
  font-weight: 600;
  line-height: 0.93;
}

.masthead h1 span {
  color: var(--signal);
}

.masthead-note {
  display: grid;
  grid-template-columns: 10px auto;
  align-items: center;
  gap: 8px 10px;
  min-width: 180px;
  padding: 18px 0 8px;
}

.masthead-note p {
  margin: 0;
  font-weight: 700;
}

.masthead-note small {
  grid-column: 2;
  color: var(--muted);
  font: 11px/1.4 var(--mono);
}

.live-dot {
  width: 9px;
  height: 9px;
  background: var(--signal);
  border-radius: 50%;
  box-shadow: 0 0 0 5px rgba(238, 75, 34, 0.13);
}

.quote-workspace {
  display: grid;
  grid-template-columns: minmax(330px, 440px) minmax(0, 1fr);
  min-height: 520px;
  border: 1px solid var(--ink);
  border-top: 0;
  background: var(--paper);
  animation: rise-in 650ms 90ms cubic-bezier(0.2, 0.72, 0.2, 1) both;
}

.query-panel {
  display: flex;
  flex-direction: column;
  padding: clamp(28px, 4vw, 50px);
  border-right: 1px solid var(--ink);
}

.query-title {
  margin: 0 0 40px;
  font-family: var(--display);
  font-size: 28px;
  font-weight: 500;
}

.lookup-form {
  display: flex;
  flex-direction: column;
}

.field-label {
  margin: 0 0 9px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 650;
}

.input-shell {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 62px;
  margin-bottom: 24px;
  padding: 0 17px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.56);
  border: 1px solid var(--line);
  border-radius: 4px;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.input-shell:focus-within {
  color: var(--ink);
  background: var(--white);
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(201, 244, 90, 0.8);
}

.input-shell-large {
  min-height: 72px;
}

.input-shell input {
  width: 100%;
  min-width: 0;
  padding: 0;
  color: var(--ink);
  font-size: 20px;
  font-weight: 650;
  background: transparent;
  border: 0;
  outline: 0;
}

.input-shell input::placeholder {
  color: #666b62;
  font-weight: 450;
}

.form-error {
  min-height: 20px;
  margin: -8px 0 12px;
  color: var(--danger);
  font-size: 13px;
  line-height: 1.5;
}

.primary-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 62px;
  padding: 0 20px 0 24px;
  color: var(--white);
  font-weight: 700;
  background: var(--signal);
  border-radius: 4px;
  box-shadow: 0 8px 18px rgba(23, 25, 21, 0.18);
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

.primary-button:hover {
  background: #9f2b10;
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(23, 25, 21, 0.22);
}

.primary-button:active {
  transform: translateY(1px);
  box-shadow: 0 3px 10px rgba(23, 25, 21, 0.18);
}

.primary-button:disabled {
  color: #4e544b;
  cursor: not-allowed;
  background: #d5d3ca;
  box-shadow: none;
  transform: none;
}

.primary-button.is-loading span {
  opacity: 0.64;
}

.query-foot {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: auto;
  padding-top: 44px;
  color: var(--muted);
  font: 11px/1.4 var(--mono);
}

.result-panel {
  position: relative;
  min-width: 0;
  overflow: hidden;
  color: var(--white);
  background: var(--ink);
}

.result-panel::after {
  position: absolute;
  right: -64px;
  bottom: -80px;
  width: 260px;
  height: 260px;
  content: "";
  border: 1px solid rgba(201, 244, 90, 0.18);
  border-radius: 50%;
  box-shadow:
    0 0 0 44px rgba(201, 244, 90, 0.035),
    0 0 0 88px rgba(201, 244, 90, 0.025);
  pointer-events: none;
}

.result-empty,
.result-content,
.result-missing {
  min-height: 100%;
  padding: clamp(32px, 5vw, 74px);
}

.result-empty {
  display: flex;
  align-items: flex-end;
  gap: clamp(28px, 5vw, 68px);
}

.empty-index {
  color: var(--acid);
  font-family: var(--display);
  font-size: clamp(110px, 16vw, 228px);
  font-weight: 600;
  line-height: 0.68;
}

.result-empty h2,
.result-missing h2 {
  margin: 0;
  max-width: 520px;
  font-family: var(--display);
  font-size: clamp(32px, 4vw, 56px);
  font-weight: 500;
  line-height: 1.16;
  overflow-wrap: anywhere;
}

.result-content {
  display: flex;
  flex-direction: column;
  animation: result-in 320ms ease both;
}

.result-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.result-heading h2 {
  margin: 0;
  max-width: 700px;
  font-family: var(--display);
  font-size: clamp(36px, 5vw, 68px);
  font-weight: 500;
  line-height: 1;
  overflow-wrap: anywhere;
}

.memory-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  margin-top: 18px;
  padding: 0 11px;
  color: var(--ink);
  font: 700 12px/1 var(--mono);
  background: var(--paper);
  border-radius: 2px;
}

.result-stamp {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  color: var(--acid);
  font: 700 11px/1 var(--mono);
}

.price-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin-top: auto;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.18);
}

.price-card {
  min-width: 0;
  padding: 24px 22px 26px;
  color: var(--white);
  background: var(--ink);
}

.price-card p,
.price-card small {
  margin: 0;
  color: rgba(255, 255, 255, 0.68);
  font: 11px/1.4 var(--mono);
}

.price-card h3 {
  margin: 10px 0 28px;
  font-family: var(--display);
  font-size: clamp(24px, 3vw, 36px);
  font-weight: 500;
}

.price-card strong {
  display: block;
  overflow-wrap: anywhere;
  font: 600 clamp(26px, 3vw, 42px)/1 var(--mono);
  white-space: nowrap;
}

.price-card small {
  display: block;
  margin-top: 12px;
}

.price-card-accent {
  color: var(--ink);
  background: var(--acid);
}

.price-card-accent p,
.price-card-accent small {
  color: rgba(23, 25, 21, 0.76);
}

.result-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 22px;
  color: rgba(255, 255, 255, 0.7);
  font: 11px/1.4 var(--mono);
}

.text-button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0;
  color: inherit;
  font-weight: 700;
  background: transparent;
  border-bottom: 1px solid currentColor;
}

.text-button:hover {
  color: var(--signal);
}

.result-footer .text-button {
  color: var(--white);
}

.result-missing {
  display: grid;
  align-content: center;
  justify-items: start;
}

.result-missing > .icon {
  width: 36px;
  height: 36px;
  margin-bottom: 24px;
  color: var(--signal);
}

.result-missing p {
  max-width: 560px;
  margin: 18px 0 30px;
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.7;
}

.outline-button {
  min-height: 44px;
  padding: 0 18px;
  color: currentColor;
  font-weight: 700;
  background: transparent;
  border: 1px solid currentColor;
  border-radius: 3px;
}

.outline-button:hover {
  color: var(--ink);
  background: var(--acid);
  border-color: var(--acid);
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  width: min(1360px, 100%);
  margin: 0 auto;
  padding: 22px clamp(20px, 4vw, 56px) 36px;
  color: var(--muted);
  font: 10px/1.4 var(--mono);
  border-top: 1px solid var(--line);
}

.admin-dialog {
  width: min(620px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  overflow: auto;
  color: var(--ink);
  background: var(--paper);
  border: 0;
  border-radius: 6px;
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.36);
}

.admin-dialog::backdrop {
  background: rgba(13, 15, 12, 0.78);
  backdrop-filter: blur(4px);
}

.dialog-topline {
  height: 6px;
  background: var(--signal);
}

.dialog-close {
  position: absolute;
  top: 20px;
  right: 20px;
}

.icon-button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 3px;
}

.icon-button:hover {
  background: var(--acid);
  border-color: var(--ink);
}

.login-view,
.console-view {
  padding: 52px clamp(24px, 6vw, 58px) 48px;
}

.dialog-heading h2,
.console-header h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 40px;
  font-weight: 500;
}

.dialog-heading > p:last-child {
  margin: 12px 0 32px;
  color: var(--muted);
  line-height: 1.7;
}

.login-form {
  display: flex;
  flex-direction: column;
}

.plain-input {
  width: 100%;
  min-height: 54px;
  margin-bottom: 22px;
  padding: 0 15px;
  color: var(--ink);
  font-size: 17px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid var(--line);
  border-radius: 3px;
  outline: 0;
}

.plain-input:focus {
  background: var(--white);
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(201, 244, 90, 0.8);
}

.console-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding-right: 38px;
}

.admin-identity {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.summary-strip {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  align-items: center;
  gap: 20px;
  margin: 32px 0 24px;
  padding: 18px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.summary-strip div {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.summary-strip small {
  color: var(--muted);
  font: 10px/1.2 var(--mono);
}

.summary-strip strong {
  font: 700 17px/1.2 var(--mono);
}

.upload-zone {
  display: grid;
  justify-items: center;
  min-height: 230px;
  padding: 34px 24px;
  text-align: center;
  background:
    linear-gradient(90deg, var(--line) 50%, transparent 50%) repeat-x,
    linear-gradient(90deg, var(--line) 50%, transparent 50%) repeat-x,
    linear-gradient(0deg, var(--line) 50%, transparent 50%) repeat-y,
    linear-gradient(0deg, var(--line) 50%, transparent 50%) repeat-y;
  background-position:
    left top,
    left bottom,
    left top,
    right top;
  background-size:
    12px 1px,
    12px 1px,
    1px 12px,
    1px 12px;
  background-repeat: repeat-x, repeat-x, repeat-y, repeat-y;
  border-radius: 3px;
  transition: background-color 160ms ease;
}

.upload-zone.is-dragging {
  background-color: rgba(201, 244, 90, 0.35);
}

.upload-zone > .icon {
  width: 30px;
  height: 30px;
  margin-bottom: 16px;
  color: var(--signal);
}

.upload-zone h3 {
  margin: 0;
  font-family: var(--display);
  font-size: 28px;
  font-weight: 500;
}

.upload-zone p {
  margin: 9px 0 20px;
  color: var(--muted);
  font-size: 13px;
}

.template-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 18px 0 24px;
  color: var(--muted);
  font-size: 12px;
}

.template-row > div {
  display: flex;
  align-items: center;
  gap: 9px;
}

.template-row .icon {
  width: 17px;
  height: 17px;
}

.console-error {
  margin: 0 0 12px;
}

.import-button {
  width: 100%;
}

.import-note {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.toast {
  position: fixed;
  z-index: 10;
  right: 24px;
  bottom: 24px;
  max-width: min(420px, calc(100vw - 48px));
  padding: 14px 18px;
  color: var(--white);
  font-size: 13px;
  line-height: 1.5;
  background: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 3px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

[hidden] {
  display: none !important;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(22px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes result-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 920px) {
  .masthead {
    min-height: 260px;
  }

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

  .query-panel {
    border-right: 0;
    border-bottom: 1px solid var(--ink);
  }

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

@media (max-width: 640px) {
  .site-header {
    min-height: 72px;
    padding: 0 18px;
  }

  .brand-copy small,
  .price-clock,
  .ghost-button span {
    display: none;
  }

  .ghost-button {
    width: 44px;
    justify-content: center;
    padding: 0;
  }

  .page-shell {
    padding: 0 14px 52px;
  }

  .masthead {
    min-height: 220px;
    padding: 44px 4px 32px;
  }

  .masthead h1 {
    font-size: clamp(52px, 18vw, 78px);
  }

  .masthead-note {
    display: none;
  }

  .query-panel {
    padding: 28px 22px 30px;
  }

  .query-title {
    margin-bottom: 30px;
  }

  .result-heading {
    flex-direction: column;
  }

  .result-stamp {
    align-self: flex-start;
  }

  .price-grid {
    grid-template-columns: 1fr;
    margin-top: 34px;
  }

  .price-card {
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr);
    align-items: end;
    min-height: 110px;
    padding: 19px 20px;
  }

  .price-card p {
    grid-column: 1;
  }

  .price-card h3 {
    grid-column: 1;
    margin: 5px 0 0;
  }

  .price-card strong {
    grid-row: 1 / span 2;
    grid-column: 2;
    justify-self: end;
    text-align: right;
  }

  .price-card small {
    display: none;
  }

  .result-empty,
  .result-content,
  .result-missing {
    padding: 34px 24px;
  }

  .result-empty {
    align-items: flex-start;
    flex-direction: column;
    gap: 34px;
  }

  .empty-index {
    font-size: 112px;
  }

  .site-footer {
    padding-right: 18px;
    padding-left: 18px;
  }

  .site-footer span:last-child {
    display: none;
  }

  .admin-dialog {
    width: calc(100vw - 18px);
    max-height: calc(100vh - 18px);
  }

  .login-view,
  .console-view {
    padding: 50px 22px 34px;
  }

  .summary-strip {
    grid-template-columns: 1fr 1fr;
  }

  .summary-strip .text-button {
    grid-column: 1 / -1;
    justify-self: start;
  }

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

  .admin-identity #admin-name {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
