:root {
  --ground: #F4F2EE;
  --card: #FFFFFF;
  --ink: #1C1B1F;
  --muted: #5E5C66;
  --line: #E4E0D8;
  --field: #CFCAC0;
  --violet: #4C2FE0;
  --violet-dark: #3A20B8;
  --violet-tint: #EEEAFE;
  --green: #127A4A;
  --green-tint: #E2F0E7;
  --green-ink: #1E5C3A;
  --amber-tint: #FFF1D6;
  --amber-ink: #7A4300;
  --red: #A8380A;
  --red-tint: #FCEBE4;
  --blue: #0B5FD6;
  --blue-tint: #EAF1FC;
  --radius: 14px;
  --font: Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Space Grotesk', Inter, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ground); color: var(--ink); font: 400 16px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--violet); font-weight: 600; text-decoration: none; }
a:hover { color: var(--violet-dark); }
h1, h2 { font-family: var(--display); margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 30px; line-height: 1.2; }
h2 { font-size: 22px; line-height: 1.25; }
p { margin: 0; }
img { max-width: 100%; display: block; }
code, .mono { font-family: ui-monospace, Menlo, Consolas, monospace; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { align-self: center; text-align: center; }
.hidden, [hidden] { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 10px; }
.stack-xs { display: flex; flex-direction: column; gap: 6px; }
.stack-xxs { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.row { display: flex; gap: 10px; align-items: center; }
.row.between { justify-content: space-between; align-items: flex-start; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grid-2 > .btn { white-space: normal; line-height: 1.2; padding: 6px 10px; }

/* Page layouts */
.page { min-height: 100dvh; max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; }
.page.narrow { max-width: 440px; }
.page.pad { padding: 32px 22px 40px; gap: 22px; }
.center-col { justify-content: center; align-items: center; text-align: center; }
.center-col .btn-block { align-self: stretch; }

.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; background: var(--card); border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 8px; font-family: var(--display); font-size: 22px; font-weight: 700; color: var(--ink); }
.brand.big { font-size: 26px; }
.brand-mark { width: 22px; height: 22px; border-radius: 6px; background: var(--violet); display: inline-block; }
.content { flex: 1; padding: 16px 16px 96px; display: flex; flex-direction: column; gap: 16px; }
.page-title { font-size: 26px; }
.small-title { font-size: 15px; font-family: var(--font); font-weight: 700; }
.back { min-height: 44px; display: inline-flex; align-items: center; }

.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 5; display: flex; justify-content: center; gap: 4px; padding: 6px 8px calc(10px + env(safe-area-inset-bottom)); background: var(--card); border-top: 1px solid var(--line); }
.bottom-nav a, .bottom-nav button { flex: 1; max-width: 110px; min-height: 48px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font: 600 12px var(--font); color: var(--muted); background: none; border: 0; cursor: pointer; border-radius: 10px; }
.bottom-nav .active { color: var(--violet); font-weight: 700; }
.icon { display: inline-flex; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
.field.small { font-size: 13px; }
input[type=text], input[type=tel], textarea { width: 100%; min-height: 48px; padding: 12px 14px; border: 1px solid var(--field); border-radius: 10px; background: var(--card); font: 400 16px var(--font); color: var(--ink); }
textarea { resize: vertical; line-height: 1.45; }
input:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid #9D8BF5; outline-offset: 2px; }
.row > input { flex: 1; min-width: 0; }
.code-input { font-weight: 600 !important; font-size: 20px !important; letter-spacing: 0.4em; text-align: center; }
.form-msg { font-size: 14px; min-height: 20px; }
.form-msg.error { color: var(--red); }
.form-msg.ok { color: var(--green-ink); }
.verified { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 48px; padding: 0 14px; border-radius: 10px; background: var(--green-tint); font-size: 15px; }
.verified b { font-size: 13px; color: var(--green-ink); }
.upload-label { cursor: pointer; display: block; }
.upload-box { min-height: 130px; border: 2px dashed #B9B2A6; border-radius: 12px; background: var(--card); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 14px; text-align: center; color: var(--muted); font-weight: 400; font-size: 14px; overflow: hidden; }
.upload-box b { color: var(--violet); }
.upload-box.tall { min-height: 280px; }
.upload-box img { max-height: 360px; border-radius: 8px; object-fit: contain; }
.entry { display: flex; align-items: center; gap: 6px; padding: 4px 4px 4px 0; }
.entry input:first-child { flex: 0 0 38%; }

/* Buttons */
.btn { min-height: 48px; padding: 0 18px; display: inline-flex; align-items: center; justify-content: center; border-radius: 12px; border: 1px solid transparent; font: 600 15px var(--font); cursor: pointer; text-align: center; white-space: nowrap; }
.btn:disabled { opacity: 0.6; cursor: progress; }
.btn-block { width: 100%; min-height: 52px; font-size: 16px; }
.btn-sm { min-height: 44px; font-size: 14px; align-self: flex-start; }
.btn-primary { background: var(--violet); color: #fff; }
.btn-primary:hover { background: var(--violet-dark); color: #fff; }
.btn-dark { background: var(--ink); color: #fff; }
.btn-green { background: var(--green); color: #fff; }
.btn-outline { background: var(--card); color: var(--violet); border-color: var(--violet); }
.btn-outline-red { background: var(--card); color: var(--red); border-color: var(--field); }
.btn-dashed { background: transparent; color: var(--violet); border: 1px dashed #8E86A8; }
.link-btn { background: none; border: 0; color: var(--violet); font: 600 15px var(--font); min-height: 44px; cursor: pointer; padding: 0 6px; }
.link-btn.red { color: var(--red); font-size: 13px; }
.icon-btn { margin-left: auto; width: 44px; height: 44px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; background: none; border: 0; border-radius: 10px; color: #6E6A75; cursor: pointer; }
.icon-btn:hover { background: var(--ground); }

/* Cards and bits */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card p { font-size: 14px; margin-top: 4px; }
.card.list { padding: 4px 16px; }
.choice { display: flex; flex-direction: column; gap: 4px; padding: 18px; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); font: 400 15px var(--font); color: var(--ink); cursor: pointer; }
.choice b { font-size: 17px; }
.choice:hover { border-color: var(--violet); }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: #D8D3CA; }
.chip { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 999px; background: var(--ground); font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.chip-green { background: var(--green-tint); color: var(--green-ink); }
.chip-violet { background: var(--violet-tint); color: #3B2A99; }
.chip-amber { background: var(--amber-tint); color: var(--amber-ink); }
.chip-red { background: var(--red-tint); color: var(--red); }
.chip-blue { background: var(--blue-tint); color: #0B4FB3; }
.notice { padding: 12px 14px; border-radius: 12px; background: var(--violet-tint); font-size: 14px; line-height: 1.45; text-align: left; }
.notice-red { background: var(--red-tint); color: #7C2A08; }
.empty { padding: 40px 12px; text-align: center; }
.big-icon { width: 72px; height: 72px; border-radius: 36px; display: flex; align-items: center; justify-content: center; }
.big-icon.amber { background: var(--amber-tint); color: #9A5B00; }
.big-icon.red { background: var(--red-tint); color: #C2410C; }

/* Plans + payment */
.plan { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 16px; border-radius: var(--radius); background: var(--card); border: 2px solid #D8D3CA; font: 600 14px var(--font); color: var(--ink); cursor: pointer; text-align: left; }
.plan.on { border-color: var(--violet); background: var(--violet-tint); }
.price { font-family: var(--display); font-size: 30px; font-weight: 700; line-height: 1.1; }
.pay-card { display: flex; gap: 16px; align-items: center; padding: 18px; border-radius: 16px; background: var(--card); border: 2px solid var(--blue); }
.qr { width: 150px; height: 150px; flex-shrink: 0; object-fit: contain; border-radius: 10px; }
.qr-missing { border: 2px dashed #8DA9D9; background: #F2F6FD; color: #3D5A8C; font-size: 12px; font-weight: 600; display: flex; align-items: center; justify-content: center; text-align: center; padding: 10px; }
.gcash-label { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; color: var(--blue); }
.steps { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 12px; font-size: 15px; }
.steps li::marker { font-weight: 700; }
.sms { display: block; margin: 8px 0; padding: 10px 12px; border-radius: 10px; background: var(--card); border: 1px solid #D8D3CA; font-size: 14px; overflow-wrap: anywhere; }

/* Feed + profile */
.post { display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); }
.post-head { display: flex; align-items: center; gap: 12px; }
.post-name { color: var(--ink); font-weight: 700; }
.post-img { width: 100%; border-radius: 12px; background: #E8E4DC; max-height: 640px; object-fit: cover; }
.post-caption { font-size: 15px; white-space: pre-wrap; overflow-wrap: anywhere; }
.avatar { flex-shrink: 0; border-radius: 50%; background: #D9D1FB; color: #3B2A99; font-weight: 700; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-head { display: flex; align-items: center; gap: 16px; }
.profile-head h1 { font-size: 26px; }
.profile-head .chip { align-self: flex-start; }
.bio { white-space: pre-wrap; overflow-wrap: anywhere; }
.info-list { margin: 0; padding: 4px 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.info-list div { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid #ECE8E1; font-size: 14px; }
.info-list div:last-child { border-bottom: 0; }
.info-list dt { color: var(--muted); }
.info-list dd { margin: 0; font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.artist-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.artist-tile { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 18px 10px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); text-align: center; }

/* Admin */
.tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 4px; gap: 4px; }
.tabs button { min-height: 44px; border: 0; border-radius: 9px; background: none; font: 600 14px var(--font); color: var(--muted); cursor: pointer; }
.tabs button.on { background: var(--violet-tint); color: var(--violet); }
.val-photo { width: 110px; height: 110px; flex-shrink: 0; border-radius: 12px; background: #E8E4DC; display: flex; align-items: center; justify-content: center; font-size: 12px; color: var(--muted); overflow: hidden; }
.val-photo img { width: 110px; height: 110px; object-fit: cover; }
.member { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 0; border-bottom: 1px solid #ECE8E1; }
.member:last-child { border-bottom: 0; }
.member > .stack-xxs { flex: 1 1 140px; }
.member .chip { white-space: normal; }

/* Loading + toast */
.loading { min-height: 100dvh; display: flex; align-items: center; justify-content: center; }
.spinner { width: 32px; height: 32px; margin: 40px auto; border-radius: 50%; border: 3px solid #D9D1FB; border-top-color: var(--violet); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }
.toast { position: fixed; left: 50%; bottom: 96px; transform: translate(-50%, 20px); max-width: calc(100% - 32px); padding: 12px 16px; border-radius: 12px; background: var(--ink); color: #fff; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 20; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #7C2A08; }
.toast.ok { background: var(--green-ink); }
.captcha-box { min-height: 0; }
