:root {
  --bg: #f4eee6;
  --paper: #fffdf9;
  --ink: #1c1714;
  --muted: #7a6e64;
  --line: #eadfd4;
  --cocoa: #2b211c;
  --cocoa-2: #3d3129;
  --chip: #fff;
  --shadow: 0 10px 28px rgba(43, 33, 28, 0.08);
  --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.theme-cocoa {
  --bg: #1b1613;
  --paper: #2a211c;
  --ink: #f6efe7;
  --muted: #c4b4a6;
  --line: #3d322b;
  --cocoa: #171310;
  --cocoa-2: #2b211c;
  --chip: #322821;
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Source Sans 3", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
}

.atmosphere {
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
}
.orb {
  position: absolute;
  width: 42vw;
  height: 42vw;
  border-radius: 50%;
  filter: blur(40px);
  opacity: 0.35;
  animation: drift 36s var(--ease) infinite alternate;
}
.orb-a { background: #e8d4c2; top: -8%; left: -6%; }
.orb-b { background: #d8c6b4; bottom: -12%; right: -8%; animation-duration: 44s; }

@keyframes drift {
  from { transform: translate(0, 0); }
  to { transform: translate(28px, 18px); }
}

.app {
  position: relative;
  z-index: 1;
  width: min(430px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 18px 128px;
}

body.is-gate .app,
body.is-app .gate,
body.public-mode .gate { display: none; }

.gate {
  position: relative;
  z-index: 2;
  width: min(430px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 72px 18px 56px;
  display: grid;
  align-content: center;
}
.gate-theme {
  position: absolute;
  top: 18px;
  right: 18px;
}
.gate-card {
  background: #fffdf9;
  border: 1px solid #e4d7c8;
  border-radius: 28px;
  padding: 32px 22px 22px;
  box-shadow: 0 18px 48px rgba(43, 33, 28, 0.12);
  color: #1c1714;
}
.theme-cocoa .gate-card {
  background: #2a211c;
  border-color: #4a3c33;
  color: #f6efe7;
}
.gate-mark {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
  background: #1c1714;
  color: #f7f1ea;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.02em;
}
.theme-cocoa .gate-mark {
  background: #f6efe7;
  color: #1c1714;
}
.gate .primary {
  background: #1c1714;
  color: #f7f1ea;
}
.theme-cocoa .gate .primary {
  background: #f6efe7;
  color: #1c1714;
}
.gate-kicker {
  margin: 0 0 8px;
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.gate-card h1 {
  margin: 0 0 8px;
  text-align: center;
  font-size: 24px;
  font-weight: 650;
  line-height: 1.2;
}
.gate-lead {
  margin: 0 0 20px;
  text-align: center;
  color: var(--muted);
  line-height: 1.45;
}
.gate-demo {
  width: 100%;
  margin-top: 12px;
  border: 0;
  border-radius: 14px;
  padding: 12px 14px;
  background: #f3ebe3;
  color: #1c1714;
  font: inherit;
  cursor: pointer;
}
.theme-cocoa .gate-demo {
  background: #f6efe7;
  color: #1c1714;
}
.gate-lang { margin-top: 16px; }
.auth-error {
  margin: 0 0 12px;
  color: #9a3b1a;
  line-height: 1.4;
}
.theme-cocoa .auth-error { color: #f3b8a0; }
.gate.register-mode .gate-demo { display: none; }

.topbar {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}
.avatar, .icon-btn, .dock-add {
  border: 0;
  cursor: pointer;
  background: var(--chip);
}
.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: var(--cocoa);
  box-shadow: var(--shadow);
}
.brand { text-align: center; }
.brand strong { display: block; font-size: 17px; letter-spacing: 0.01em; }
.brand span {
  display: block;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.top-actions { display: flex; gap: 8px; }
.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #1c1714;
  overflow: visible;
  box-shadow: var(--shadow);
}
#profile-btn .ico {
  display: block;
  stroke: #1c1714;
}

.hero {
  background: linear-gradient(160deg, var(--cocoa) 0%, var(--cocoa-2) 100%);
  color: #f7f1ea;
  border-radius: 28px;
  padding: 26px 24px 28px;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute;
  width: 180px;
  height: 180px;
  right: -40px;
  top: -50px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
}
.hero .kicker {
  margin: 0 0 6px;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.72;
}
.hero h1 {
  margin: 0 0 8px;
  font-size: 28px;
  font-weight: 600;
  line-height: 1.15;
  color: #fff;
}
.hero p { margin: 0; opacity: 0.78; }

.pills {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.pill {
  background: var(--chip);
  border-radius: 22px;
  padding: 14px 8px 12px;
  text-align: center;
  box-shadow: var(--shadow);
}
.pill .n { display: block; font-size: 22px; font-weight: 700; }
.pill .l { color: var(--muted); font-size: 12px; }

.card, .row-link, .sheet {
  background: var(--paper);
  border-radius: 22px;
  box-shadow: var(--shadow);
}
.card { padding: 18px 18px 16px; margin-bottom: 12px; }
.card .eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.card h2, .page-head h2 {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 650;
}
.card p, .empty { margin: 0; color: var(--muted); line-height: 1.45; }

.tip-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #f3e6d8;
  color: var(--cocoa);
  margin-bottom: 10px;
}
.theme-cocoa .tip-icon { background: #3b2f28; color: #f0e2d4; }

.row-link {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 14px;
  margin-bottom: 10px;
  text-align: left;
  border: 0;
  color: inherit;
  cursor: pointer;
  text-decoration: none;
}
.badge {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  flex: 0 0 42px;
  display: grid;
  place-items: center;
  background: #f3ebe3;
  color: var(--cocoa);
}
.theme-cocoa .badge { background: #3b2f28; color: #f0e2d4; }
.row-link .copy { flex: 1; min-width: 0; }
.row-link strong { display: block; font-size: 15px; }
.row-link small { display: block; color: var(--muted); font-size: 13px; }
.row-link .chev { color: var(--muted); }

.page-head { margin: 4px 0 16px; }
.page-head p { margin: 6px 0 0; color: var(--muted); }

.list-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; }
.list-item strong { display: block; }
.list-item small { color: var(--muted); }
.ghost, .primary, .seg button {
  font: inherit;
  border: 0;
  cursor: pointer;
}
.ghost {
  background: transparent;
  color: var(--muted);
  padding: 6px;
}
.primary {
  width: 100%;
  background: var(--cocoa);
  color: #f7f1ea;
  border-radius: 999px;
  padding: 14px 16px;
  font-weight: 600;
}
.primary.with-ico {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.primary.with-ico .ico {
  flex: 0 0 auto;
}
.theme-cocoa .primary,
.theme-cocoa .ghost-btn,
.theme-cocoa .provider,
.theme-cocoa .icon-btn,
.theme-cocoa .avatar {
  background: #f6efe7;
  color: #1c1714;
}
.field { margin-bottom: 12px; }
.field label {
  display: block;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.field input, .field select {
  width: 100%;
  border: 0;
  background: #f6f0e8;
  border-radius: 14px;
  padding: 13px 14px;
  font: inherit;
  color: var(--ink);
}
.theme-cocoa .field input,
.theme-cocoa .field select {
  background: #f6efe7;
  color: #1c1714;
}

.btn-row {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}
.ghost-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  border: 0;
  border-radius: 999px;
  padding: 12px 16px;
  background: var(--chip);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  box-shadow: var(--shadow);
  cursor: pointer;
}
.section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.section-head h2 { margin: 0; font-size: 17px; flex: 1; }
.section-head .count { color: var(--muted); font-size: 13px; }
.public-mode .dock,
.public-mode .top-actions,
.auth-mode .topbar,
.auth-mode .dock { display: none; }

.seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 16px;
  padding: 4px;
  border-radius: 999px;
  background: #e8ddd2;
}
.seg button {
  border-radius: 999px;
  padding: 10px 12px;
  background: transparent;
  color: #7a6e64;
  font-weight: 500;
}
.seg button.on {
  background: #fffdf9;
  color: #1c1714;
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(28, 23, 20, 0.16);
}
.theme-cocoa .seg {
  background: #14110f;
}
.theme-cocoa .seg button {
  background: transparent;
  color: #b7a89b;
}
.theme-cocoa .seg button.on {
  background: #f6efe7;
  color: #1c1714;
  font-weight: 700;
}

.provider {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 10px 0 0;
  padding: 14px 16px;
  border: 0;
  border-radius: 16px;
  background: #f6f0e8;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.theme-cocoa .provider { background: #f6efe7; color: #1c1714; }
.provider .ico { flex: 0 0 auto; }

.share {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-top: 8px;
}
.share img {
  width: 120px;
  height: 120px;
  background: #fffdf9;
  border: 0;
  border-radius: 16px;
  padding: 6px;
  display: block;
}
.theme-cocoa .share img {
  background: #f6efe7;
}
.result { margin-top: 12px; color: var(--ink); }

.screen-credit {
  position: fixed;
  left: 50%;
  bottom: 10px;
  z-index: 6;
  width: min(430px, calc(100% - 24px));
  margin: 0;
  transform: translateX(-50%);
  text-align: center;
  font-size: 11px;
  line-height: 1.3;
  color: var(--muted);
  pointer-events: none;
}
body.is-app .screen-credit { bottom: 10px; }

.dock {
  position: fixed;
  left: 50%;
  bottom: 36px;
  transform: translateX(-50%);
  width: min(390px, calc(100% - 28px));
  background: var(--cocoa);
  color: #f7f1ea;
  border-radius: 999px;
  display: grid;
  grid-template-columns: 1fr 64px 1fr;
  align-items: center;
  padding: 8px 10px;
  z-index: 5;
  box-shadow: 0 12px 30px rgba(28, 23, 20, 0.22);
}
.dock button {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  display: grid;
  justify-items: center;
  gap: 2px;
  font-size: 12px;
  cursor: pointer;
}
.dock button.active { font-weight: 700; }
.dock-add {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: #f7f1ea;
  color: var(--cocoa);
  display: grid;
  place-items: center;
  margin: 0 auto;
}
.dock-icon { display: grid; }

#sheet[hidden] { display: none; }
#sheet {
  position: fixed;
  inset: 0;
  background: rgba(28, 23, 20, 0.38);
  z-index: 10;
  display: grid;
  align-items: end;
}
.sheet {
  margin: 0 auto;
  width: min(430px, 100%);
  padding: 18px 18px 24px;
  border-radius: 24px 24px 0 0;
}
.sheet h3 { margin: 0 0 14px; }

.anim-in {
  opacity: 0;
  transform: translateY(50px);
  animation: fadeup 0.7s var(--ease) forwards;
}
@keyframes fadeup {
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .orb { animation: none; }
  .anim-in { animation: none; opacity: 1; transform: none; }
}
