:root {
  --rose: #b33951;
  --rose-dark: #8f2d41;
  --ink: #1c1416;
  --muted: #6b5a5e;
  --line: #eadde1;
  --paper: #f7f2f3;
  --card: #ffffff;
  --ok: #1f7a4d;
  --warn: #9a6b12;
  --bg-image: url("https://images.unsplash.com/photo-1518199266791-5375a57590ae?auto=format&fit=crop&w=1920&q=80");
  --app-bg-image: url("https://images.unsplash.com/photo-1516589178581-6cd7833ae3b0?auto=format&fit=crop&w=1600&q=80");
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  min-height: 100vh;
  min-height: 100dvh;
}

#app { min-height: 100vh; min-height: 100dvh; }

.landing {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  background-color: #4a1f32;
  background-image:
    linear-gradient(rgba(28, 20, 22, 0.42), rgba(28, 20, 22, 0.58)),
    radial-gradient(circle at 18% 18%, rgba(255, 140, 170, 0.45), transparent 42%),
    radial-gradient(circle at 82% 78%, rgba(255, 190, 200, 0.28), transparent 38%),
    var(--bg-image);
  background-position: center;
  background-size: cover;
}
.landing-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 18px 24px;
  color: #fff;
}
.brand { font-size: 22px; font-weight: 700; letter-spacing: 0.02em; }
.landing-actions { display: flex; gap: 10px; flex-shrink: 0; }
.landing-actions button { min-width: 108px; min-height: 44px; }
.landing-actions .ghost {
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  border-color: rgba(255, 255, 255, 0.94);
}
.landing-body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 96px 24px;
}
.landing-title {
  text-align: center;
  color: #fff;
  max-width: 640px;
  width: 100%;
}
.landing-title h1 { margin: 0 0 10px; font-size: 52px; line-height: 1.15; text-shadow: 0 2px 18px rgba(0,0,0,.55); }
.landing-title p { margin: 0; font-size: 22px; text-shadow: 0 2px 14px rgba(0,0,0,.5); }

.auth-page {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--paper);
}
.auth-page .topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.auth-page .topbar .brand { color: var(--ink); font-size: 18px; }
.auth-wrap { max-width: 420px; margin: 0 auto; padding: 40px 20px; }

.stage {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background-color: #3a2428;
  background-image:
    linear-gradient(rgba(28, 20, 22, 0.42), rgba(28, 20, 22, 0.58)),
    var(--app-bg-image);
  background-position: center;
  background-size: cover;
}
.app-frame {
  width: 390px;
  height: 720px;
  max-width: 100%;
  max-height: calc(100vh - 32px);
  background-color: var(--paper);
  background-image:
    linear-gradient(rgba(255, 250, 251, 0.62), rgba(247, 242, 243, 0.78)),
    var(--app-bg-image);
  background-position: center;
  background-size: cover;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 18px 40px rgba(28, 20, 22, 0.28);
}
.page {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: transparent;
  min-height: 0;
}

.app-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  position: relative;
}
.app-header .brand { font-size: 18px; color: var(--ink); }
.spacer { flex: 1; }

.gear-wrap { position: relative; }
.icon-btn {
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  border-radius: 50%;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
}
.icon-btn svg { width: 18px; height: 18px; }

.mini-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  width: 190px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  z-index: 20;
}
.mini-menu.open { display: block; }
.mini-menu button {
  width: 100%;
  background: #fff;
  color: var(--ink);
  border: none;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  text-align: left;
  min-height: 40px;
  font-size: 13px;
}
.mini-menu button:last-child { border-bottom: none; }

.app-main, .wrap {
  padding: 14px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
}

.card {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
}
.card h2 { margin: 0 0 14px; font-size: 20px; }
.field { margin-bottom: 12px; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  font-size: 16px;
}
.field-error {
  color: #b42318;
  font-size: 13px;
  margin-top: 6px;
}

button {
  appearance: none;
  border: 1px solid transparent;
  background: var(--rose);
  color: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  min-height: 40px;
  cursor: pointer;
}
button.secondary { background: #fff; color: var(--ink); border-color: var(--line); }
button.full { width: 100%; margin-top: 6px; }

.back-link {
  display: inline-block;
  margin-top: 12px;
  color: var(--rose);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.banner { padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; font-size: 13px; }
.banner.ok { background: #e8f6ee; color: var(--ok); }
.banner.warn { background: #fff4d6; color: var(--warn); }

.profile-card, .activity-frame {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(28, 20, 22, 0.08);
}
.profile-card { margin-bottom: 14px; position: relative; z-index: 2; }
.profile-stats {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 14px;
}
#withdraw-btn {
  position: relative;
  z-index: 3;
  flex-shrink: 0;
  white-space: nowrap;
  min-width: 108px;
  touch-action: manipulation;
}
.profile-top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}
.avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--rose); color: #fff;
  display: grid; place-items: center;
  font-weight: 700; font-size: 18px;
}
.username-text { font-size: 18px; font-weight: 700; }
.profile-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.profile-stats {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 14px;
}
.dashboard-label { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.dashboard-value { font-size: 22px; font-weight: 700; }
.section-title { margin: 6px 0 10px; }
.section-title h2 { margin: 0; font-size: 16px; }

.activity-frame { isolation: isolate; }
.activity-marquee,
.activity-marquee-track {
  pointer-events: none;
}
.activity-line {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  min-height: 44px;
}
.activity-line:last-child { border-bottom: none; }
.activity-speaker {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #fff1f4;
  color: var(--rose);
  display: grid;
  place-items: center;
}
.activity-speaker-icon { width: 16px; height: 16px; display: block; }
.activity-marquee {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  mask-image: linear-gradient(to right, transparent, #000 12px, #000 calc(100% - 12px), transparent);
}
.activity-marquee-track {
  display: inline-flex;
  gap: 48px;
  width: max-content;
  white-space: nowrap;
  animation: activity-scroll linear infinite;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.activity-marquee-track span { padding-right: 8px; }
.activity-line:hover .activity-marquee-track { animation-play-state: paused; }
@keyframes activity-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce) {
  .activity-marquee-track { animation: none; }
  .activity-marquee { mask-image: none; }
  .activity-marquee-track span[aria-hidden="true"] { display: none; }
}

.activity-item { padding: 14px; border-bottom: 1px solid var(--line); }
.activity-item:last-child { border-bottom: none; }
.activity-item h3 { margin: 0 0 6px; font-size: 15px; }
.activity-item p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; word-break: break-word; }
.activity-date { font-size: 11px; color: #9a8589; margin-top: 8px; }
.empty { padding: 24px 14px; text-align: center; color: var(--muted); font-size: 13px; }

.info-box {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.info-box .value { font-size: 16px; font-weight: 600; min-height: 22px; }

@media (max-width: 640px) {
  .landing-header { padding: 14px 16px; }
  .landing-actions button { min-width: 0; padding: 8px 12px; }
  .landing-body { padding: 88px 20px; }
  .landing-title p { font-size: 15px; }
  .stage { padding: 0; }
  .app-frame {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    max-height: none;
    border: none;
    border-radius: 0;
  }
  .profile-stats { grid-template-columns: 1fr; }
  #withdraw-btn { width: 100%; min-height: 48px; }
}
