:root {
  color-scheme: light;
  --orange: #f36b22;
  --orange-dark: #cf4f0d;
  --orange-soft: #fff1e7;
  --ink: #17221e;
  --muted: #64716b;
  --line: #dfe4e1;
  --line-strong: #cbd3cf;
  --surface: #ffffff;
  --canvas: #f4f6f5;
  --subtle: #f0f3f1;
  --green: #278258;
  --green-soft: #e9f6ef;
  --danger: #b43b32;
  --danger-soft: #fff0ee;
  --shadow: 0 16px 40px rgba(23, 34, 30, 0.08);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", Arial, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 0;
  overflow-x: hidden;
  background: var(--canvas);
}

body {
  min-width: 0;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea {
  min-width: 0;
  margin: 0;
  color: inherit;
  font: inherit;
  letter-spacing: 0;
}

button,
a,
label {
  -webkit-tap-highlight-color: transparent;
}

button {
  touch-action: manipulation;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

a {
  color: inherit;
  text-decoration: none;
}

svg,
img {
  display: block;
  flex: none;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.icon {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.site-header {
  position: relative;
  z-index: 10;
  width: 100%;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(calc(100% - 40px), 1060px);
  min-width: 0;
  min-height: 72px;
  margin: 0 auto;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
  border-radius: 6px;
}

.brand img {
  width: 42px;
  height: 42px;
}

.brand-copy {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.brand-copy strong {
  font-size: 1.18rem;
  line-height: 1.25;
  white-space: nowrap;
}

.brand-copy span {
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.25;
  text-transform: uppercase;
}

.mode-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-width: 0;
  padding: 5px;
  gap: 4px;
  background: var(--subtle);
  border: 1px solid #e8ebe9;
  border-radius: 8px;
}

.mode-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 40px;
  padding: 0 14px;
  gap: 7px;
  border-radius: 6px;
  color: #58645f;
  background: transparent;
  font-size: 0.88rem;
  font-weight: 700;
  white-space: nowrap;
  transition: color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.mode-tab:hover:not(:disabled) {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.62);
}

.mode-tab.is-active {
  color: var(--orange-dark);
  background: var(--surface);
  box-shadow: 0 2px 8px rgba(23, 34, 30, 0.08);
}

.mode-tab:disabled {
  opacity: 0.55;
}

.page-shell {
  width: min(calc(100% - 32px), 760px);
  min-width: 0;
  margin: 0 auto;
  padding: 30px 0 42px;
}

.intro {
  min-width: 0;
  margin: 0 auto 22px;
  text-align: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  margin: 0 0 8px;
  gap: 7px;
  color: var(--green);
  font-size: 0.8rem;
  font-weight: 750;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px var(--green-soft);
}

.intro h1 {
  margin: 0;
  font-size: 2rem;
  line-height: 1.22;
  letter-spacing: 0;
}

.intro > p:last-child {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.6;
}

.tool-card {
  width: 100%;
  min-width: 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel,
.success-view {
  min-width: 0;
  padding: 28px;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  min-width: 0;
  margin-bottom: 18px;
  gap: 16px;
}

.panel-heading > div,
.result-heading > span:last-child,
.file-copy {
  min-width: 0;
}

.section-label {
  margin: 0 0 3px;
  color: var(--orange-dark);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.4;
  text-transform: uppercase;
}

.panel-heading h2,
.success-view h2 {
  margin: 0;
  font-size: 1.22rem;
  line-height: 1.35;
  letter-spacing: 0;
}

.limit-label {
  flex: none;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
  line-height: 1.4;
  white-space: nowrap;
}

.composer {
  position: relative;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  background: #fafbfa;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.composer:focus-within,
.composer.is-dragging {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px var(--orange-soft);
}

.composer.is-dragging::after {
  position: absolute;
  z-index: 2;
  display: grid;
  inset: 8px;
  place-items: center;
  content: "松开以添加文件";
  color: var(--orange-dark);
  background: rgba(255, 241, 231, 0.94);
  border: 1.5px dashed var(--orange);
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 800;
  pointer-events: none;
}

.composer.has-file textarea {
  color: var(--muted);
  background: var(--subtle);
  cursor: not-allowed;
}

.composer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  padding: 10px 12px;
  gap: 12px;
  border-top: 1px solid var(--line);
}

.attach-button {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  gap: 7px;
  color: var(--orange-dark);
  background: var(--orange-soft);
  border: 1px solid #f4c8a9;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 750;
}

.attach-button:hover:not(:disabled) {
  background: #ffe5d2;
  border-color: #efa875;
}

.composer-hint {
  min-width: 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.4;
  text-align: right;
}

.selected-file,
.received-file {
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
  min-height: 68px;
  padding: 10px 0;
  gap: 11px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.selected-file {
  margin-top: 16px;
}

.file-icon-wrap {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: var(--orange-dark);
  background: var(--orange-soft);
  border-radius: 6px;
}

.file-copy {
  display: grid;
  flex: 1;
  gap: 2px;
}

.file-copy strong,
.file-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-copy strong {
  font-size: 0.9rem;
  line-height: 1.4;
}

.file-copy span {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.4;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  color: var(--muted);
  background: transparent;
  border-radius: 6px;
}

.icon-button:hover {
  color: var(--danger);
  background: var(--danger-soft);
}

.form-message {
  width: 100%;
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 0.82rem;
  line-height: 1.5;
}

.form-message.is-error {
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid #f0cbc7;
}

.progress-block {
  width: 100%;
  min-width: 0;
  margin-top: 16px;
}

.progress-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7px;
  gap: 12px;
  color: var(--muted);
  font-size: 0.8rem;
}

.progress-label strong {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.progress-track {
  width: 100%;
  height: 7px;
  overflow: hidden;
  background: var(--subtle);
  border-radius: 5px;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--orange);
  border-radius: inherit;
  transition: width 120ms linear;
}

.progress-block > .text-button {
  margin: 8px 0 0 auto;
}

.transfer-options {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  width: 100%;
  min-width: 0;
  margin-top: 20px;
  padding-top: 18px;
  gap: 20px;
  border-top: 1px solid var(--line);
}

.ttl-fieldset {
  min-width: 0;
  padding: 0;
  margin: 0;
  border: 0;
}

.ttl-fieldset legend {
  padding: 0;
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.ttl-control {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  min-width: 0;
  padding: 3px;
  gap: 2px;
  background: var(--subtle);
  border-radius: 7px;
}

.ttl-control input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.ttl-control label {
  display: grid;
  place-items: center;
  min-width: 72px;
  min-height: 32px;
  padding: 0 8px;
  border-radius: 5px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.ttl-control input:checked + label {
  color: var(--orange-dark);
  background: var(--surface);
  box-shadow: 0 1px 5px rgba(23, 34, 30, 0.08);
}

.burn-option {
  display: flex;
  align-items: center;
  min-width: 0;
  padding-bottom: 1px;
  gap: 11px;
  cursor: pointer;
}

.burn-option > span:first-child {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.burn-option strong {
  font-size: 0.82rem;
  line-height: 1.35;
  white-space: nowrap;
}

.burn-option small {
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.35;
  white-space: nowrap;
}

.burn-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.switch-track {
  position: relative;
  width: 42px;
  height: 24px;
  flex: none;
  background: #bdc6c1;
  border-radius: 12px;
  transition: background-color 160ms ease;
}

.switch-track span {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: var(--surface);
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(23, 34, 30, 0.2);
  transition: transform 160ms ease;
}

.burn-option input:checked + .switch-track {
  background: var(--orange);
}

.burn-option input:checked + .switch-track span {
  transform: translateX(18px);
}

.primary-button,
.secondary-button,
.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  gap: 8px;
  border-radius: 6px;
  font-weight: 750;
  line-height: 1.25;
}

.primary-button {
  width: 100%;
  min-height: 48px;
  padding: 0 18px;
  margin-top: 20px;
  color: #ffffff;
  background: var(--orange);
  font-size: 0.9rem;
  box-shadow: 0 7px 18px rgba(207, 79, 13, 0.18);
  transition: background-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.primary-button:hover:not(:disabled) {
  background: var(--orange-dark);
  box-shadow: 0 9px 22px rgba(207, 79, 13, 0.24);
  transform: translateY(-1px);
}

.primary-button:disabled {
  color: #8e9893;
  background: #e4e8e6;
  box-shadow: none;
}

a.primary-button {
  text-decoration: none;
}

.secondary-button {
  min-height: 44px;
  padding: 0 16px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  font-size: 0.84rem;
}

.secondary-button:hover:not(:disabled) {
  color: var(--orange-dark);
  background: var(--orange-soft);
  border-color: #f4b58e;
}

.secondary-button:disabled {
  opacity: 0.52;
  color: var(--muted);
  background: var(--subtle);
}

.text-button {
  min-height: 34px;
  padding: 0 6px;
  color: var(--muted);
  background: transparent;
  font-size: 0.78rem;
}

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

.code-input {
  width: 100%;
  max-width: 100%;
  color: var(--ink);
  background: #fafbfa;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.composer textarea {
  width: 100%;
  max-width: 100%;
  min-height: 166px;
  padding: 15px 16px;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: 0;
  outline: none;
  resize: vertical;
  font-size: 0.93rem;
  line-height: 1.7;
}

.composer textarea::placeholder,
.code-input::placeholder {
  color: #9ba49f;
}

.code-input:focus {
  background: var(--surface);
  border-color: var(--orange);
  box-shadow: 0 0 0 3px var(--orange-soft);
}

.composer textarea:focus {
  background: transparent;
}

.code-input {
  height: 68px;
  padding: 0 18px;
  text-align: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.75rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

.input-hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.45;
  text-align: center;
}

.receive-panel > form,
.receive-result,
.empty-state,
.loading-state {
  width: min(100%, 530px);
  min-width: 0;
  margin-right: auto;
  margin-left: auto;
}

.empty-state,
.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 74px;
  margin-top: 18px;
  gap: 9px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 0.8rem;
}

.empty-state .icon {
  color: #8d9993;
}

.loading-state strong {
  font-size: 0.82rem;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid #dfe4e1;
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.receive-result {
  margin-top: 4px;
}

.result-heading {
  display: flex;
  align-items: center;
  min-width: 0;
  margin-bottom: 18px;
  gap: 11px;
}

.result-heading > span:last-child {
  display: grid;
  gap: 1px;
}

.result-heading small {
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 800;
}

.result-heading strong {
  overflow-wrap: anywhere;
  font-size: 1rem;
  line-height: 1.4;
}

.success-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  color: var(--green);
  background: var(--green-soft);
  border-radius: 50%;
}

.success-mark.large {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
}

.success-mark.large .icon {
  width: 23px;
  height: 23px;
}

#received-text {
  width: 100%;
  max-height: 290px;
  min-height: 124px;
  padding: 15px;
  margin: 0 0 14px;
  overflow: auto;
  color: var(--ink);
  background: #f7f9f8;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.84rem;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

#text-result .secondary-button {
  width: 100%;
}

#file-result .received-file {
  margin-bottom: 2px;
}

#file-result .primary-button {
  margin-top: 16px;
}

.result-reset {
  margin: 14px auto 0;
}

.success-view {
  text-align: center;
}

.success-view > .section-label {
  margin-bottom: 4px;
}

.pickup-code {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  width: min(100%, 414px);
  min-width: 0;
  margin: 24px auto 16px;
  gap: 8px;
}

.pickup-code span {
  display: grid;
  place-items: center;
  min-width: 0;
  height: 62px;
  color: var(--ink);
  background: #faf8f5;
  border: 1px solid #e8ded5;
  border-radius: 7px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.65rem;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.expiry-line {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  gap: 7px;
  color: var(--muted);
  font-size: 0.79rem;
}

.expiry-line .icon {
  width: 16px;
  height: 16px;
}

.expiry-line strong {
  color: var(--green);
  font-variant-numeric: tabular-nums;
}

.expiry-line.is-expired strong {
  color: var(--danger);
}

.success-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: min(100%, 414px);
  min-width: 0;
  margin: 22px auto 0;
  gap: 10px;
}

.continue-button {
  width: min(100%, 414px);
  margin: 12px auto 0;
}

.toast {
  position: fixed;
  z-index: 100;
  right: 20px;
  bottom: 20px;
  max-width: min(320px, calc(100% - 32px));
  padding: 11px 14px;
  color: #ffffff;
  background: var(--ink);
  border-radius: 7px;
  box-shadow: 0 10px 28px rgba(23, 34, 30, 0.2);
  font-size: 0.82rem;
  line-height: 1.45;
}

button:focus-visible,
a:focus-visible,
textarea:focus-visible,
input:focus-visible,
.ttl-control input:focus-visible + label,
.burn-option input:focus-visible + .switch-track {
  outline: 3px solid rgba(243, 107, 34, 0.28);
  outline-offset: 2px;
}

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

@media (max-width: 720px) {
  .header-inner {
    align-items: stretch;
    width: min(calc(100% - 24px), 640px);
    padding: 12px 0;
    flex-direction: column;
    gap: 10px;
  }

  .brand {
    align-self: flex-start;
  }

  .brand img {
    width: 38px;
    height: 38px;
  }

  .mode-switch {
    width: 100%;
  }

  .mode-tab {
    min-height: 40px;
    padding: 0 9px;
    gap: 6px;
    font-size: 0.8rem;
  }

  .mode-tab .icon {
    width: 17px;
    height: 17px;
  }

  .page-shell {
    width: min(calc(100% - 24px), 640px);
    padding-top: 24px;
  }

  .intro h1 {
    font-size: 1.7rem;
  }
}

@media (max-width: 560px) {
  .panel,
  .success-view {
    padding: 22px 18px;
  }

  .panel-heading {
    margin-bottom: 15px;
  }

  .composer textarea {
    min-height: 148px;
  }

  .transfer-options {
    align-items: stretch;
    flex-direction: column;
    gap: 17px;
  }

  .ttl-control {
    width: 100%;
  }

  .ttl-control label {
    min-width: 0;
  }

  .burn-option {
    justify-content: space-between;
    width: 100%;
  }

  .success-actions {
    gap: 8px;
  }

  .success-actions .secondary-button {
    padding: 0 9px;
    gap: 6px;
    font-size: 0.78rem;
  }

  .pickup-code {
    gap: 6px;
  }

  .pickup-code span {
    height: 56px;
    font-size: 1.4rem;
  }
}

@media (max-width: 390px) {
  .brand-copy strong {
    font-size: 1.06rem;
  }

  .brand-copy span {
    font-size: 0.62rem;
  }

  .mode-switch {
    padding: 4px;
    gap: 2px;
  }

  .mode-tab {
    min-height: 38px;
    padding: 0 5px;
    gap: 4px;
    font-size: 0.73rem;
  }

  .mode-tab .icon {
    width: 15px;
    height: 15px;
  }

  .page-shell {
    width: calc(100% - 20px);
    padding-top: 20px;
  }

  .intro {
    margin-bottom: 18px;
  }

  .intro h1 {
    font-size: 1.52rem;
  }

  .intro > p:last-child {
    font-size: 0.86rem;
  }

  .panel-heading {
    gap: 10px;
  }

  .panel-heading h2,
  .success-view h2 {
    font-size: 1.08rem;
  }

  .limit-label {
    font-size: 0.7rem;
  }

  .composer-toolbar {
    padding: 9px 10px;
    gap: 8px;
  }

  .pickup-code span {
    height: 50px;
    font-size: 1.24rem;
  }

  .success-actions {
    grid-template-columns: 1fr;
  }

  .toast {
    right: 10px;
    bottom: 10px;
  }
}

@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;
  }
}
