:root {
  color-scheme: light;
  --bg: #f6f3ed;
  --surface: #fffdf8;
  --surface-soft: #eee8dc;
  --ink: #252621;
  --muted: #746f66;
  --line: #ded6c9;
  --accent: #d95c2b;
  --accent-dark: #9e3e1b;
  --forest: #213c34;
  --teal: #176b78;
  --danger: #b43b31;
  --shadow: 0 12px 30px rgba(65, 48, 29, 0.07);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); }
button, input, select { font: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
.app-shell { width: min(100%, 720px); min-height: 100vh; margin: 0 auto; background: var(--bg); }
.hidden { display: none !important; }
.eyebrow { margin-bottom: 4px; color: var(--accent-dark); font-size: 11px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
h1 { font-size: 26px; line-height: 1.2; }
h2 { font-size: 20px; line-height: 1.3; }
.auth-view { display: grid; align-content: center; min-height: 100vh; gap: 18px; padding: 24px 18px; background: radial-gradient(circle at 85% 8%, rgba(217, 92, 43, .16), transparent 260px), var(--bg); }
.auth-hero { padding: 6px 3px; }
.auth-hero h1 { margin-bottom: 9px; font-size: 31px; }
.auth-hero p:last-child { max-width: 430px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.auth-card, .hero-card, .import-card, .library-card { display: grid; gap: 16px; padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 16px 12px; border-bottom: 1px solid rgba(222, 214, 201, .8); background: rgba(246, 243, 237, .94); backdrop-filter: blur(16px); }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.account-button, .install-button { min-height: 34px; border: 1px solid #bfd3ca; border-radius: 10px; background: #e7f1ed; color: var(--forest); font-weight: 900; }
.account-button { width: 34px; padding: 0; border-radius: 50%; }
.install-button { padding: 0 10px; font-size: 11px; }
.content { display: grid; gap: 14px; padding: 16px 14px 34px; }
.hero-card { grid-template-columns: 1fr auto; align-items: end; border: 0; background: var(--forest); color: white; }
.hero-card .eyebrow { color: #f0b08e; }
.hero-card h2 { margin-bottom: 8px; font-size: 23px; }
.hero-card p:last-child { max-width: 500px; color: #d9e1dc; font-size: 14px; line-height: 1.55; }
.hero-stat { display: grid; justify-items: center; align-content: center; min-width: 76px; min-height: 76px; border-radius: 20px; background: #f8dfd3; color: var(--accent-dark); }
.hero-stat strong { font-size: 28px; line-height: 1; }
.hero-stat span { margin-top: 4px; font-size: 12px; font-weight: 800; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 12px; }
.section-heading > span { color: var(--muted); font-size: 12px; }
.field-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.field { display: grid; gap: 7px; }
.field > span { color: #494740; font-size: 13px; font-weight: 800; }
.field b { color: var(--danger); }
input, select { width: 100%; min-height: 46px; border: 1px solid #d7cec0; border-radius: 11px; outline: 0; background: white; color: var(--ink); }
input { padding: 0 12px; }
select { padding: 0 10px; }
input:focus, select:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(23, 107, 120, .12); }
.import-entry-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.drop-zone { position: relative; display: grid; justify-items: center; gap: 5px; min-height: 130px; padding: 20px 10px; border: 1.5px dashed #c9bead; border-radius: 15px; background: #fbf8f1; color: var(--forest); text-align: center; transition: border-color 140ms ease, background 140ms ease; }
.drop-zone:hover { border-color: var(--accent); background: #fff8ef; }
.drop-zone input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; }
.camera-zone { border-color: #c7d9d6; background: #f1f7f6; }
.drop-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: var(--forest); color: white; font-size: 22px; line-height: 1; }
.camera-zone .drop-icon { background: var(--teal); font-size: 16px; }
.drop-zone strong { font-size: 14px; }
.drop-zone small, .form-hint { color: var(--muted); font-size: 12px; line-height: 1.45; }
.primary-button, .text-button { min-height: 44px; border-radius: 11px; font-weight: 800; }
.primary-button { width: 100%; border: 1px solid var(--accent); background: var(--accent); color: white; }
.primary-button:disabled { border-color: #c8c0b4; background: #c8c0b4; cursor: not-allowed; }
.text-button { padding: 0; border: 0; background: transparent; color: var(--accent-dark); font-size: 12px; }
.search-row { display: grid; grid-template-columns: 1fr; gap: 9px; }
.search-box { display: grid; grid-template-columns: 28px 1fr; align-items: center; min-height: 46px; padding-left: 11px; border: 1px solid #d7cec0; border-radius: 11px; background: white; }
.search-box span { color: var(--muted); font-size: 22px; }
.search-box input { min-height: 44px; padding-left: 0; border: 0; box-shadow: none; }
.store-summary { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.store-chip { flex: 0 0 auto; padding: 8px 10px; border: 1px solid var(--line); border-radius: 999px; background: #fffaf1; color: var(--muted); font-size: 12px; font-weight: 800; }
.store-chip.active { border-color: var(--accent); background: #f8dfd3; color: var(--accent-dark); }
.asset-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.asset-card { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: white; }
.asset-preview { aspect-ratio: 1.05; overflow: hidden; background: #ede8df; }
.asset-preview img, .asset-preview video { width: 100%; height: 100%; object-fit: cover; }
.asset-info { display: grid; gap: 6px; padding: 10px; }
.asset-info strong { overflow: hidden; color: var(--ink); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.asset-meta { display: flex; flex-wrap: wrap; gap: 5px; }
.asset-meta span { padding: 4px 6px; border-radius: 6px; background: var(--surface-soft); color: var(--muted); font-size: 10px; }
.asset-footer { display: flex; align-items: center; justify-content: space-between; gap: 7px; }
.asset-footer small { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.delete-button { padding: 0; border: 0; background: transparent; color: var(--danger); font-size: 11px; font-weight: 800; }
.empty-state { display: grid; justify-items: center; gap: 9px; padding: 34px 18px; border: 1px dashed #c9bead; border-radius: 16px; text-align: center; }
.empty-state p { max-width: 360px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.empty-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: var(--surface-soft); color: var(--accent-dark); font-weight: 900; }
.toast { position: fixed; z-index: 30; left: 50%; bottom: 24px; max-width: calc(100% - 32px); padding: 11px 16px; transform: translate(-50%, 18px); border-radius: 999px; background: #1f2e29; color: white; font-size: 13px; font-weight: 700; opacity: 0; pointer-events: none; transition: opacity 180ms ease, transform 180ms ease; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }

@media (min-width: 560px) {
  .field-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search-row { grid-template-columns: 1fr 180px; }
  .asset-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 559px) {
  .hero-card { grid-template-columns: 1fr; }
  .hero-stat { justify-self: start; min-width: 68px; min-height: 58px; border-radius: 15px; }
  .hero-stat strong { font-size: 23px; }
  .auth-card, .hero-card, .import-card, .library-card { padding: 15px; border-radius: 16px; }
  .primary-button { min-height: 48px; }
}

@media (min-width: 760px) {
  body { background: linear-gradient(90deg, rgba(17, 104, 119, .07), transparent 26%), var(--bg); }
  .app-shell { margin-block: 18px; min-height: calc(100vh - 36px); border: 1px solid var(--line); border-radius: 22px; overflow: hidden; }
}
