/* ============================================================
   Y+ Studio — Base / shared styles
   ============================================================ */
:root, [data-theme="light"] {
  --bg: #FAFAF8;
  --surface: #FFFFFF;
  --surface-2: #F4F4F0;
  --ink: #15171C;
  --muted: #5B616E;
  --line: #E7E7E2;
  --line-strong: #D8D8D1;
  --brand: #3D5AFE;
  --brand-2: #6B7CFF;
  --accent: #3D5AFE;
  --accent-soft: #EEF1FF;
  --accent-ink: #2A3BC7;
  --ok: #1F8A5B;
  --warn: #B26A00;
  --danger: #D6453B;
  --shadow: 0 1px 2px rgba(20, 22, 30, .05), 0 1px 3px rgba(20, 22, 30, .06);
  --shadow-pop: 0 10px 30px rgba(20, 22, 30, .10);
  --radius: 12px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-full: 999px;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-synthesis: none;
}
[data-theme="dark"] {
  --bg: #0E1014; --surface: #16191F; --surface-2: #1C2028;
  --ink: #ECEEF2; --muted: #949BA8; --line: #262A31; --line-strong: #333945;
  --brand: #6B7CFF; --brand-2: #6B7CFF; --accent: #6B7CFF; --accent-soft: #1A2032; --accent-ink: #AAB4FF;
  --ok: #3DBE82; --danger: #E5594D;
  --shadow-pop: 0 10px 30px rgba(0, 0, 0, .45);
}
.mono { font-family: var(--font-mono); }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  font: inherit; font-weight: 600; font-size: 14px;
  padding: 9px 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  cursor: pointer; text-decoration: none; line-height: 1; transition: .15s;
}
.btn:hover { border-color: #cdd2e4; background: #fbfbff; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn.danger { color: var(--danger); border-color: #f3c9d3; }
.btn.danger:hover { background: #fff5f7; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.btn.sm { padding: 6px 10px; font-size: 13px; }

/* Brand mark */
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--ink); color: var(--bg); font-weight: 800; font-size: 14px; line-height: 1;
}
.brand-mark::after { content: "+"; color: var(--accent); font-weight: 800; font-size: 13px; }

/* Toast */
.yp-toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px);
  background: #15182a; color: #fff; padding: 11px 18px; border-radius: 10px;
  font-size: 14px; font-weight: 500; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: .2s; z-index: 9999; max-width: 80vw;
}
.yp-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.yp-toast.success { background: #14532d; }
.yp-toast.error { background: #7f1d1d; }

/* Save indicator */
.save-indicator { font-size: 12px; color: var(--muted); }
.save-indicator.saving { color: var(--warn); }
.save-indicator.saved { color: var(--ok); }
.save-indicator.error { color: var(--danger); }

/* Modal */
.modal {
  position: fixed; inset: 0; background: rgba(20, 24, 60, .35);
  display: grid; place-items: center; z-index: 1000;
}
.modal[hidden] { display: none; }
.modal-card {
  background: var(--surface); border-radius: var(--radius); padding: 22px;
  box-shadow: var(--shadow); width: min(92vw, 440px);
}
.modal-card h3 { margin: 0 0 12px; }

/* Inputs */
input[type=text], input[type=email], input[type=number], textarea, select {
  width: 100%; font: inherit; padding: 9px 11px; border: 1px solid var(--line);
  border-radius: 9px; background: #fff; color: var(--ink);
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--brand); border-color: var(--brand); }
label { display: block; font-size: 13px; font-weight: 600; margin: 10px 0 4px; }

.muted { color: var(--muted); }

/* Account chip + auth modal */
.yp-acct { display: inline-flex; align-items: center; gap: 8px; }
.yp-acct-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.yp-acct-email { font-size: 12px; color: var(--muted); max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.yp-acct-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 13px; border: 1px solid var(--line); border-radius: var(--r-sm, 8px); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; font-size: 13px; cursor: pointer; }
.yp-acct-btn:hover { background: var(--surface-2, #f4f4f0); }
.yp-acct-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.yp-acct-btn.primary:hover { background: var(--accent-ink, #2A3BC7); }
.yp-acct-btn.block { width: 100%; margin-top: 8px; }
.yp-modal { position: fixed; inset: 0; z-index: 1000; background: rgba(20,22,30,.4); display: grid; place-items: center; padding: 24px; }
.yp-modal-card { position: relative; width: min(94vw, 380px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md, 12px); box-shadow: var(--shadow-pop); padding: 22px; }
.yp-modal-tabs { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-sm, 8px); overflow: hidden; margin-bottom: 16px; }
.yp-modal-tabs button { font: inherit; font-weight: 600; font-size: 13px; padding: 7px 14px; border: 0; background: var(--surface); color: var(--muted); cursor: pointer; }
.yp-modal-tabs button + button { border-left: 1px solid var(--line); }
.yp-modal-tabs button.active { background: var(--accent); color: #fff; }
.yp-f { display: block; font-size: 12px; font-weight: 600; color: var(--ink); margin-bottom: 12px; }
.yp-f input { width: 100%; margin-top: 5px; font: inherit; font-size: 14px; padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--r-sm, 8px); background: var(--surface); color: var(--ink); }
.yp-err { font-size: 12px; color: var(--danger); margin: 2px 0 10px; }
.yp-modal-x { position: absolute; top: 14px; right: 14px; border: 0; background: transparent; color: var(--muted); font-size: 15px; cursor: pointer; }
.yp-modal-note { margin: 12px 0 0; text-align: center; font-size: 11px; color: var(--muted); }
.yp-google { gap: 9px; }
.yp-google svg { flex: 0 0 auto; }
.yp-modal-or { display: flex; align-items: center; gap: 10px; margin: 14px 0; color: var(--muted); font-size: 11px; }
.yp-modal-or::before, .yp-modal-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* Monetization: Go-Pro button, ad slot, Pro modal */
.upgrade-btn { display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: var(--r-full); border: 1px solid var(--accent); background: var(--accent-soft); color: var(--accent-ink); font-size: 12px; font-weight: 600; cursor: pointer; }
.upgrade-btn:hover { background: var(--accent); color: #fff; }
.ad-slot { display: block; max-width: 970px; margin: 24px auto 8px; min-height: 90px; border: 1px dashed var(--line); border-radius: var(--r-sm); overflow: hidden; }
.ad-slot[hidden] { display: none; }
.pro-badge { display: inline-block; padding: 3px 9px; border-radius: var(--r-full); background: var(--accent); color: #fff; font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.pro-list { list-style: none; margin: 0 0 16px; padding: 0; }
.pro-list li { position: relative; padding: 6px 0 6px 24px; font-size: 13px; border-bottom: 1px solid var(--line); }
.pro-list li::before { content: "✓"; position: absolute; left: 4px; color: var(--ok); font-weight: 700; }
.pro-list .soon { display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: var(--r-full); background: var(--surface-2); color: var(--muted); font-size: 10px; }
.yp-lic { display: flex; gap: 8px; margin-top: 2px; }
.yp-lic input { flex: 1; min-width: 0; font: inherit; font-size: 13px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-sm, 8px); background: var(--surface); color: var(--ink); }
.yp-lic .yp-acct-btn { white-space: nowrap; }

/* Slim page footer (dashboard) */
.dash-foot { display: flex; align-items: center; gap: 16px; max-width: 1100px; margin: 40px auto 0; padding: 18px 4px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.dash-foot .grow { flex: 1; }
.dash-foot a { color: var(--muted); text-decoration: none; }
.dash-foot a:hover { color: var(--ink); }
