:root {
  --ink: #171713;
  --muted: #74736a;
  --paper: #f5f3eb;
  --surface: #fffefa;
  --line: #d9d6ca;
  --orange: #ff5b35;
  --purple: #6e5de7;
}

* { box-sizing: border-box; }
html { background: var(--paper); }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 2px 2px, rgba(23, 23, 19, .055) 1px, transparent 0) 0 0 / 22px 22px,
    var(--paper);
  font-family: var(--font-geist-sans), "PingFang SC", "Microsoft YaHei", sans-serif;
}
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }

.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  height: 76px; padding: 0 4vw; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(245, 243, 235, .88); backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 20;
}
.brand { color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 720; letter-spacing: -.04em; }
.brand-mark { width: 36px; height: 36px; border-radius: 50%; background: var(--ink); color: white; display: grid; place-items: center; font-size: 15px; transform: rotate(-5deg); }
.connection-pill { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 8px 13px; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.live-dot { width: 7px; height: 7px; background: #38a86d; border-radius: 50%; box-shadow: 0 0 0 4px #38a86d1c; }

.welcome { flex: 1; width: min(940px, 92vw); margin: 0 auto; padding: clamp(72px, 11vh, 130px) 0 70px; text-align: center; }
.eyebrow, .label { font-family: var(--font-geist-mono), monospace; font-size: 11px; font-weight: 700; letter-spacing: .16em; color: var(--orange); text-transform: uppercase; }
.welcome h1 { font-size: clamp(46px, 7.3vw, 92px); letter-spacing: -.073em; line-height: .98; margin: 22px 0 26px; font-weight: 700; }
.welcome-copy { max-width: 610px; margin: 0 auto; color: var(--muted); font-size: clamp(16px, 2vw, 19px); line-height: 1.75; }
.join-card { width: min(480px, 100%); margin: 45px auto 28px; padding: 12px; border: 1px solid var(--line); background: rgba(255,254,250,.9); box-shadow: 0 22px 70px rgba(39,36,24,.08); border-radius: 22px; }
.primary-button { width: 100%; border: 0; background: var(--orange); color: white; padding: 17px 20px; border-radius: 14px; font-weight: 700; cursor: pointer; display: flex; justify-content: center; gap: 12px; transition: .2s; }
.primary-button:hover { transform: translateY(-1px); background: #ef4c28; }
.primary-button.large { font-size: 16px; }
.divider { height: 52px; display: flex; align-items: center; gap: 12px; color: #969489; font-size: 11px; }
.divider::before, .divider::after { content:""; height: 1px; flex: 1; background: var(--line); }
.join-form { display: flex; gap: 8px; }
.join-form input { min-width: 0; flex: 1; padding: 14px 15px; border: 1px solid var(--line); background: #f8f7f1; border-radius: 12px; outline: 0; text-transform: uppercase; letter-spacing: .11em; font-family: var(--font-geist-mono), monospace; }
.join-form input:focus { border-color: var(--purple); box-shadow: 0 0 0 3px #6e5de713; }
.join-form button { border: 0; border-radius: 12px; padding: 0 21px; background: var(--ink); color: white; cursor: pointer; }
.inline-notice { color: var(--orange); font-size: 12px; margin: 11px 0 2px; }
.auth-card { padding: 8px 12px 14px; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin-bottom: 12px; background: #efede5; border-radius: 12px; }
.auth-tabs button { border: 0; background: transparent; border-radius: 9px; padding: 10px; color: var(--muted); font-size: 13px; font-weight: 700; cursor: pointer; }
.auth-tabs button.active { background: var(--surface); color: var(--ink); box-shadow: 0 2px 9px rgba(31,29,21,.07); }
.auth-form { display: grid; gap: 12px; }
.auth-form label { display: grid; gap: 7px; text-align: left; }
.auth-form label > span { color: var(--muted); font-size: 11px; font-weight: 700; }
.auth-form input { width: 100%; padding: 14px 15px; border: 1px solid var(--line); background: #f8f7f1; border-radius: 12px; outline: 0; }
.auth-form input:focus { border-color: var(--purple); box-shadow: 0 0 0 3px #6e5de713; }
.auth-form .primary-button { margin-top: 2px; }
.feature-row { display: flex; justify-content: center; gap: 32px; color: var(--muted); font-size: 12px; }
.feature-row span::before { content: "✓"; color: var(--orange); margin-right: 7px; font-weight: 800; }

.workspace { flex: 1; display: grid; grid-template-columns: 230px minmax(340px, 1.1fr) minmax(350px, .9fr); min-height: calc(100vh - 76px); }
.space-panel { border-right: 1px solid var(--line); padding: 42px 28px 30px; display: flex; flex-direction: column; background: rgba(239,237,228,.62); }
.space-heading { display: flex; align-items: center; justify-content: space-between; }
.space-heading > div { display: flex; flex-direction: column; gap: 8px; }
.space-heading strong { font-family: var(--font-geist-mono), monospace; font-size: 20px; letter-spacing: .06em; }
.icon-button, .refresh-button { border: 1px solid var(--line); border-radius: 50%; background: var(--surface); width: 36px; height: 36px; cursor: pointer; }
.space-tip { color: var(--muted); font-size: 12px; line-height: 1.65; margin: 20px 0; }
.share-button { border: 0; border-radius: 10px; padding: 11px 10px; background: var(--ink); color: white; font-size: 12px; cursor: pointer; }
.panel-divider { border-top: 1px solid var(--line); margin: 32px 0; }
.summary { display: grid; gap: 18px; }
.summary > div { display: flex; align-items: baseline; justify-content: space-between; }
.summary > div strong { font-size: 24px; }
.summary > div span { color: var(--muted); font-size: 12px; }
.switch-space { margin-top: auto; border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 10px; font-size: 12px; text-decoration: underline; text-underline-offset: 4px; }

.transfer-column, .history-column { padding: clamp(32px, 4vw, 58px); }
.transfer-column { border-right: 1px solid var(--line); }
.section-head, .history-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 28px; }
.section-head h1, .history-head h2 { margin: 7px 0 0; font-size: clamp(32px, 4vw, 52px); line-height: 1; letter-spacing: -.055em; }
.history-head h2 { font-size: 31px; }
.device-copy { color: var(--muted); font-size: 11px; max-width: 150px; line-height: 1.5; text-align: right; }
.composer { background: var(--surface); border: 1px solid var(--line); border-radius: 17px; overflow: hidden; box-shadow: 0 13px 42px rgba(31,29,21,.06); }
.mode-tabs { padding: 8px; display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.mode-tabs button { flex: 1; padding: 10px; border: 0; background: transparent; color: var(--muted); border-radius: 9px; cursor: pointer; font-weight: 650; font-size: 13px; }
.mode-tabs button.active { background: var(--ink); color: white; }
.composer textarea { width: 100%; resize: vertical; border: 0; outline: 0; background: transparent; padding: 24px; font-size: 16px; line-height: 1.7; min-height: 210px; }
.composer textarea::placeholder { color: #aaa89f; }
.composer-footer { min-height: 65px; padding: 10px 12px 10px 24px; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); }
.composer-footer > span { color: var(--muted); font-size: 11px; }
.send-button { border: 0; border-radius: 11px; padding: 12px 17px; background: var(--orange); color: white; font-size: 12px; font-weight: 700; cursor: pointer; }
.send-button:disabled { opacity: .6; cursor: wait; }
.dropzone { min-height: 210px; padding: 30px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; margin: 20px; border: 1px dashed #bbb8ac; background: #f8f7f1; border-radius: 12px; cursor: pointer; text-align: center; transition: .2s; }
.dropzone.dragging { border-color: var(--orange); background: #fff5ef; }
.dropzone small { color: var(--muted); }
.upload-mark { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; background: var(--orange); color: white; font-size: 23px; margin-bottom: 5px; }
.toast { margin-top: 14px; display: inline-block; background: var(--ink); color: white; border-radius: 99px; padding: 8px 13px; font-size: 11px; }

.history-column { background: rgba(255,254,250,.48); min-width: 0; }
.search-box { display: flex; align-items: center; gap: 9px; padding: 0 14px; height: 43px; border: 1px solid var(--line); background: var(--surface); border-radius: 11px; margin-bottom: 18px; color: var(--muted); }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; font-size: 12px; }
.history-list { display: flex; flex-direction: column; gap: 10px; max-height: calc(100vh - 245px); overflow: auto; padding-right: 4px; }
.history-card { display: grid; grid-template-columns: 44px minmax(0,1fr) auto; align-items: center; gap: 13px; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.item-icon { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; font-size: 11px; font-family: var(--font-geist-mono), monospace; font-weight: 800; background: #f0eee6; }
.item-icon.text { background: #e8e5ff; color: #5a49d0; }
.item-content { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.item-content p { margin: 0; line-height: 1.45; font-size: 13px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-wrap; word-break: break-word; }
.item-content strong { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-content small, .item-content time { font-size: 10px; color: var(--muted); }
.item-actions { display: flex; align-items: center; gap: 6px; }
.item-actions button, .item-actions a { border: 0; background: #f0eee6; border-radius: 7px; padding: 7px 9px; font-size: 10px; color: var(--ink); text-decoration: none; cursor: pointer; }
.item-actions .delete-button { background: transparent; color: #aaa79d; font-size: 17px; padding: 3px; }
.empty-state { min-height: 260px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); text-align: center; }
.empty-state > span { font-size: 32px; color: var(--orange); }
.empty-state strong { color: var(--ink); margin-top: 13px; }
.empty-state p { font-size: 12px; }

footer { display: none; }

@media (max-width: 1050px) {
  .workspace { grid-template-columns: 190px 1fr 1fr; }
  .space-panel { padding: 34px 20px 24px; }
  .transfer-column, .history-column { padding: 34px 26px; }
  .device-copy { display: none; }
}

@media (max-width: 790px) {
  .topbar { height: 64px; padding: 0 18px; }
  .brand-mark { width: 32px; height: 32px; }
  .connection-pill { font-size: 10px; }
  .welcome { padding-top: 60px; }
  .welcome h1 { font-size: clamp(43px, 13vw, 68px); }
  .feature-row { gap: 10px; flex-wrap: wrap; }
  .workspace { display: flex; flex-direction: column; }
  .space-panel { border-right: 0; border-bottom: 1px solid var(--line); padding: 20px 18px; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; }
  .space-tip, .panel-divider, .summary, .switch-space { display: none; }
  #logoutButton { display: block; margin: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); text-decoration: none; }
  .share-button { padding: 11px 13px; }
  .space-heading { gap: 15px; }
  .transfer-column { border-right: 0; border-bottom: 1px solid var(--line); padding: 38px 18px 46px; }
  .history-column { padding: 38px 18px 55px; }
  .section-head h1 { font-size: 43px; }
  .composer textarea { min-height: 170px; }
  .history-list { max-height: none; }
  .history-card { grid-template-columns: 40px minmax(0,1fr); }
  .item-icon { width: 40px; height: 40px; }
  .item-actions { grid-column: 2; justify-content: flex-start; }
  .item-actions button, .item-actions a { padding: 7px 12px; }
  footer { display: flex; border-top: 1px solid var(--line); padding: 26px 18px; justify-content: space-between; color: var(--muted); font-size: 9px; font-family: var(--font-geist-mono), monospace; }
}

@media (max-width: 430px) {
  .welcome { width: calc(100% - 32px); }
  .welcome-copy { font-size: 15px; }
  .join-card { margin-top: 33px; }
  .feature-row span { width: 100%; }
  .space-heading .icon-button { display: none; }
  .composer-footer { padding-left: 14px; }
}

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