:root {
  color-scheme: light;
  --ink: #1f1f1f;
  --muted: #4d4d4d;
  --line: #c8c8c8;
  --line-strong: #6f6f6f;
  --panel: #ffffff;
  --panel-strong: #f3f3f3;
  --accent: #005fb8;
  --accent-strong: #004a91;
  --accent-soft: #e6f1fb;
  --danger: #a31515;
  --focus: #0078d4;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family:
    "Segoe UI", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: #f7f7f7;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(340px, 0.88fr);
  gap: 16px;
  align-items: center;
  padding: 28px 0;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: none;
}

.hero-panel,
.lookup-panel {
  padding: 22px;
}

.brand-row {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--accent);
  background: #ffffff;
}

.brand-mark svg,
.icon svg,
.drop-icon svg,
.empty-state svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.12;
  letter-spacing: 0;
}

h2 {
  font-size: 21px;
  letter-spacing: 0;
}

.brand-row p,
.section-head p {
  margin-top: 7px;
  color: var(--muted);
  line-height: 1.55;
}

.mode-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  padding: 0;
  margin: 22px 0;
  border: 1px solid var(--line);
  background: #ffffff;
  border-radius: 3px;
  overflow: hidden;
}

.mode-tab {
  min-height: 44px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 700;
}

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

.mode-tab.active {
  color: #ffffff;
  background: var(--accent);
  box-shadow: none;
}

.icon {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.icon svg {
  width: 19px;
  height: 19px;
}

.share-form,
.lookup-form {
  display: grid;
  gap: 12px;
}

.field-label {
  font-size: 13px;
  font-weight: 800;
  color: #354052;
}

.text-input,
.code-input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 3px;
  outline: none;
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease;
}

.text-input,
.code-input {
  min-height: 46px;
  padding: 0 14px;
}

textarea {
  min-height: 184px;
  padding: 13px 14px;
  resize: vertical;
  line-height: 1.55;
}

.text-input:focus,
.code-input:focus,
textarea:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 1px var(--focus);
}

.upload-zone input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.drop-target {
  min-height: 184px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 22px;
  border: 1px dashed var(--line-strong);
  background: #ffffff;
  border-radius: 3px;
  text-align: center;
  transition:
    border-color 0.16s ease,
    background 0.16s ease,
    transform 0.16s ease;
}

.drop-target.dragging {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: none;
}

.drop-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 3px;
}

.drop-target strong {
  max-width: 100%;
  overflow-wrap: anywhere;
}

.drop-target small {
  color: var(--muted);
  line-height: 1.45;
}

.primary-btn,
.secondary-btn,
.copy-btn,
.download-btn {
  min-height: 46px;
  border: 0;
  border-radius: 3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 800;
  text-decoration: none;
  transition:
    background 0.15s ease;
}

.primary-btn,
.download-btn {
  color: #fff;
  background: var(--accent);
  box-shadow: none;
}

.primary-btn:hover,
.download-btn:hover {
  background: var(--accent-strong);
}

.secondary-btn,
.copy-btn {
  color: #ffffff;
  background: var(--accent);
}

.secondary-btn:hover,
.copy-btn:hover {
  background: var(--accent-strong);
}

.primary-btn[disabled],
.secondary-btn[disabled] {
  opacity: 0.62;
  cursor: wait;
}

.result,
.lookup-result {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--panel-strong);
  padding: 16px;
}

.result-card,
.item-card {
  display: grid;
  gap: 14px;
}

.code-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: #ffffff;
}

.code-value {
  font-size: 27px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.meta {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.lookup-form {
  grid-template-columns: minmax(0, 1fr) auto;
  margin-top: 18px;
}

.code-input {
  text-transform: uppercase;
  letter-spacing: 0;
  font-weight: 800;
}

.secondary-btn {
  min-width: 108px;
  padding: 0 16px;
}

.empty-state {
  min-height: 220px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  color: var(--muted);
}

.empty-state span {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.item-title {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.kind-pill {
  padding: 5px 9px;
  border-radius: 3px;
  color: #ffffff;
  background: var(--accent);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.text-preview {
  max-height: 300px;
  overflow: auto;
  white-space: pre-wrap;
  line-height: 1.6;
  padding: 14px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 3px;
}

.media-preview {
  width: 100%;
  max-height: 360px;
  border-radius: 3px;
  border: 1px solid var(--line);
  background: #ffffff;
  object-fit: contain;
}

.download-btn {
  padding: 0 16px;
}

.error {
  color: var(--danger);
  font-weight: 800;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  max-width: min(420px, calc(100% - 32px));
  padding: 12px 16px;
  color: #fff;
  background: #1f1f1f;
  border-radius: 3px;
  box-shadow: none;
}

.hidden {
  display: none !important;
}

@media (max-width: 860px) {
  .shell {
    grid-template-columns: 1fr;
    align-items: stretch;
    padding: 18px 0;
  }

  .hero-panel,
  .lookup-panel {
    padding: 20px;
  }

  h1 {
    font-size: 28px;
  }
}

@media (max-width: 520px) {
  .shell {
    width: min(100% - 20px, 1120px);
  }

  .brand-row {
    align-items: center;
  }

  .brand-mark {
    width: 46px;
    height: 46px;
  }

  .lookup-form,
  .code-box,
  .item-title {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .code-box {
    display: grid;
  }

  .copy-btn,
  .secondary-btn {
    width: 100%;
  }
}
