:root {
  --bg: #0c0b0a;
  --surface: #151412;
  --surface-2: #1c1a17;
  --line: #2a2723;
  --line-soft: #211f1c;
  --text: #f2ede4;
  --muted: #8f877b;
  --faint: #5d574f;
  --gold: #d9b878;
  --gold-hi: #ecd3a0;
  --gold-ink: #1a140a;
  --danger: #e0806b;
  --ok: #8cc79a;
  --radius: 18px;
  --font: "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  --display: "Segoe UI Variable Display", "Segoe UI", -apple-system, "SF Pro Display", system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(1200px 520px at 50% -180px, rgba(217, 184, 120, 0.10), transparent 70%),
    var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }

/* Brand */
.brand { display: flex; align-items: center; gap: 10px; font: 600 19px/1 var(--display); letter-spacing: 0.02em; }
.brand-lg { font-size: 30px; gap: 14px; justify-content: center; }
.mark {
  width: 14px; height: 18px;
  background: linear-gradient(160deg, var(--gold-hi), var(--gold) 55%, #a8874c);
  border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%;
  transform: rotate(180deg);
  box-shadow: 0 0 18px rgba(217, 184, 120, 0.35);
}
.brand-lg .mark { width: 20px; height: 26px; }

/* Buttons */
.btn {
  border: 0; border-radius: 12px; padding: 0 18px; height: 44px;
  font-weight: 600; letter-spacing: 0.01em; white-space: nowrap;
  transition: transform .12s ease, filter .15s ease, opacity .15s ease;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-gold { background: linear-gradient(180deg, var(--gold-hi), var(--gold)); color: var(--gold-ink); }
.btn-gold:hover { filter: brightness(1.06); }
.link-btn { background: none; border: 0; padding: 6px 2px; color: var(--muted); font-size: 13px; }
.link-btn:hover { color: var(--text); }

/* Login */
.login { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 340px; display: grid; gap: 14px; text-align: center; }
.login-sub { margin: 0 0 14px; color: var(--muted); }
.login-card input {
  height: 50px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface);
  padding: 0 16px; font-size: 16px; outline: none; text-align: center;
}
.login-card input:focus { border-color: var(--gold); }
.login-card .btn { height: 50px; }
.login-error { min-height: 20px; margin: 0; color: var(--danger); font-size: 14px; }

/* Layout */
.app { max-width: 720px; margin: 0 auto; padding: max(14px, env(safe-area-inset-top)) 18px max(24px, env(safe-area-inset-bottom)); }
.top { display: flex; align-items: center; justify-content: space-between; padding: 10px 2px 22px; }
.status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); transition: background .3s; }
.dot.live { background: var(--ok); box-shadow: 0 0 10px rgba(140, 199, 154, .6); }

/* Composer */
.composer { display: grid; gap: 12px; }
.zone {
  position: relative; display: grid; justify-items: center; gap: 6px; padding: 34px 20px;
  border: 1px dashed #3a352e; border-radius: var(--radius); background: linear-gradient(180deg, var(--surface), #12110f);
  cursor: pointer; text-align: center; transition: border-color .2s, background .2s, transform .15s;
}
.zone:hover { border-color: var(--gold); }
.zone:active { transform: scale(0.99); }
.zone input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.zone-icon {
  width: 52px; height: 52px; display: grid; place-items: center; border-radius: 50%;
  color: var(--gold); background: rgba(217, 184, 120, .08); border: 1px solid rgba(217, 184, 120, .22); margin-bottom: 6px;
}
.zone-title { font: 600 17px/1.2 var(--display); }
.zone-sub { color: var(--muted); font-size: 13px; }

.textbar { display: flex; gap: 8px; align-items: flex-end; }
.textbar textarea {
  flex: 1; min-height: 44px; max-height: 160px; resize: none; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); padding: 11px 14px; font-size: 16px; line-height: 1.35; outline: none;
}
.textbar textarea:focus { border-color: var(--gold); }

.uploads { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.upload { background: var(--surface); border: 1px solid var(--line-soft); border-radius: 12px; padding: 10px 14px; }
.upload-row { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.upload-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-pct { color: var(--muted); font-variant-numeric: tabular-nums; }
.bar { height: 3px; background: var(--line); border-radius: 3px; margin-top: 8px; overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), var(--gold-hi)); transition: width .15s; }
.upload.failed .upload-pct { color: var(--danger); }

/* Feed */
.feed { margin-top: 30px; }
.feed-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.feed-head h2 { margin: 0; font: 600 12px/1 var(--font); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.items { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.item {
  display: grid; grid-template-columns: 56px 1fr; gap: 14px; align-items: center;
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: 16px; padding: 12px;
  animation: rise .35s ease both;
}
.item.fresh { border-color: rgba(217, 184, 120, .55); box-shadow: 0 0 0 3px rgba(217, 184, 120, .08); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.thumb {
  width: 56px; height: 56px; border-radius: 12px; overflow: hidden; display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--line);
  font: 700 11px/1 var(--font); letter-spacing: .06em; color: var(--gold);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.t-text { color: var(--muted); }
.thumb.t-link { color: #9cc3e6; }
.meta { min-width: 0; display: grid; gap: 3px; }
.title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.title.note { white-space: pre-wrap; word-break: break-word; font-weight: 500; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; }
.title.url { color: #b9d5ee; word-break: break-all; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.sub { color: var(--muted); font-size: 12.5px; }
.actions { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; }
.act {
  flex: 1 1 auto; min-width: 84px; height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
  font-size: 13.5px; font-weight: 600; text-decoration: none; transition: border-color .15s, background .15s;
}
.act:hover { border-color: var(--gold); }
.act.primary { background: rgba(217, 184, 120, .12); border-color: rgba(217, 184, 120, .35); color: var(--gold-hi); }
.act.del { flex: 0 0 38px; min-width: 38px; color: var(--muted); }
.act.del:hover { color: var(--danger); border-color: var(--danger); }

.empty { text-align: center; padding: 36px 12px; border: 1px solid var(--line-soft); border-radius: var(--radius); }
.empty p { margin: 4px 0; }
.muted { color: var(--muted); font-size: 13.5px; }

.foot { display: flex; justify-content: space-between; align-items: center; margin-top: 26px; color: var(--faint); font-size: 12.5px; }

.foot-actions { display: flex; gap: 16px; }

/* Shortcuts sheet */
.sheet {
  width: min(640px, calc(100% - 24px)); max-height: calc(100dvh - 40px); padding: 0; border: 1px solid var(--line);
  border-radius: 20px; background: var(--surface); color: var(--text); overflow: auto;
}
.sheet::backdrop { background: rgba(12, 11, 10, .72); backdrop-filter: blur(4px); }
.sheet-head { position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center; padding: 16px 18px 10px; background: var(--surface); }
.sheet-head h2 { margin: 0; font: 600 20px/1 var(--display); }
.sheet-sec { padding: 4px 18px 18px; }
.sheet-sec + .sheet-sec { border-top: 1px solid var(--line-soft); padding-top: 16px; }
.sheet h3 { margin: 6px 0 6px; font: 600 15px/1.3 var(--display); color: var(--gold-hi); }
.sheet h4 { margin: 18px 0 6px; font-size: 14px; }
.sheet p { margin: 6px 0; }
.copies { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 4px; }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 7px; font-size: 14px; color: #ddd6ca; }
.steps b { color: var(--text); }
.sheet code { font: 12.5px/1 ui-monospace, "Cascadia Mono", Menlo, monospace; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 2px 5px; color: var(--gold-hi); white-space: nowrap; }
.warn { color: var(--danger); font-size: 13.5px; }

/* Drag overlay + toast */
.overlay { position: fixed; inset: 0; z-index: 20; background: rgba(12, 11, 10, .82); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 24px; pointer-events: none; }
.overlay-inner {
  width: min(680px, 100%); height: min(380px, 70vh); display: grid; place-items: center;
  border: 2px dashed var(--gold); border-radius: 24px; font: 600 24px/1 var(--display); color: var(--gold-hi);
}
.toast {
  position: fixed; left: 50%; bottom: max(22px, env(safe-area-inset-bottom)); z-index: 30;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: #26231f; border: 1px solid var(--line); color: var(--text);
  padding: 10px 16px; border-radius: 999px; font-size: 14px; transition: opacity .2s, transform .2s; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { border-color: var(--danger); }

@media (min-width: 640px) {
  .zone { padding: 52px 24px; }
  .item { grid-template-columns: 56px 1fr auto; }
  .actions { grid-column: auto; flex-wrap: nowrap; }
  .act { flex: 0 0 auto; padding: 0 14px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
