/* =====================================================================
   PvPrize — light "productivity" theme (Notion-like)
   Calm neutrals, thin borders, one quiet accent colour.
   Previous dark theme: /opt/pvprize/theme-backup/style.dark.css
   ===================================================================== */
:root {
  --bg: #ffffff;
  --bg-soft: #f7f7f5;
  --bg-hover: rgba(55, 53, 47, 0.06);
  --bg-active: rgba(55, 53, 47, 0.1);
  --text: #37352f;
  --text-strong: #191711;
  --muted: rgba(55, 53, 47, 0.65);
  --faint: rgba(55, 53, 47, 0.45);
  --border: rgba(55, 53, 47, 0.12);
  --border-strong: rgba(55, 53, 47, 0.2);
  --accent: #2383e2;
  --accent-hover: #0f6fd1;
  --accent-soft: rgba(35, 131, 226, 0.1);
  --green: #0f7b6c;
  --green-soft: rgba(15, 123, 108, 0.08);
  --red: #e03e3e;
  --red-soft: rgba(224, 62, 62, 0.08);
  --radius: 8px;
  --shadow-pop: 0 0 0 1px rgba(15, 15, 15, 0.05), 0 3px 6px rgba(15, 15, 15, 0.1), 0 9px 24px rgba(15, 15, 15, 0.2);
  --nav-bg: rgba(255, 255, 255, 0.92);
  --avatar-bg: #e8e7e4;
  --card-shadow: 0 1px 2px rgba(15, 15, 15, 0.04);
  color-scheme: light;
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Segoe UI Variable", Helvetica, "Apple Color Emoji", Arial, sans-serif, "Segoe UI Emoji";
}

/* ---------- Dark theme (Notion-like dark) ---------- */
:root[data-theme="dark"] {
  --bg: #191919;
  --bg-soft: #202020;
  --bg-hover: rgba(255, 255, 255, 0.055);
  --bg-active: rgba(255, 255, 255, 0.09);
  --text: rgba(255, 255, 255, 0.81);
  --text-strong: rgba(255, 255, 255, 0.94);
  --muted: rgba(255, 255, 255, 0.55);
  --faint: rgba(255, 255, 255, 0.4);
  --border: rgba(255, 255, 255, 0.094);
  --border-strong: rgba(255, 255, 255, 0.16);
  --accent: #529cca;
  --accent-hover: #6aaedb;
  --accent-soft: rgba(82, 156, 202, 0.16);
  --green: #4dab9a;
  --green-soft: rgba(77, 171, 154, 0.12);
  --red: #ff7369;
  --red-soft: rgba(255, 115, 105, 0.12);
  --shadow-pop: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 3px 6px rgba(0, 0, 0, 0.4), 0 9px 24px rgba(0, 0, 0, 0.5);
  --nav-bg: rgba(25, 25, 25, 0.9);
  --avatar-bg: #373737;
  --card-shadow: none;
  color-scheme: dark;
}
:root[data-theme="dark"] .btn-primary { color: #fff; background: #2f80c2; border-color: #2f80c2; }
:root[data-theme="dark"] .btn-primary:hover { background: #3a8fd4; border-color: #3a8fd4; }

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  transition: background-color 0.15s ease, color 0.15s ease;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.hidden { display: none !important; }

/* =====================================================================
   Top bar
   ===================================================================== */
.nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px max(16px, calc((100% - 1080px) / 2));
  background: var(--nav-bg);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 6px; margin-left: -6px; border-radius: 6px;
  color: var(--text-strong); font-weight: 700; font-size: 1.05rem; letter-spacing: -0.01em;
}
.brand:hover { text-decoration: none; background: var(--bg-hover); }
.brand svg { width: 26px; height: 26px; color: var(--text-strong); }
.brand .accent { color: var(--accent); }

.nav-right { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; }
.nav-actions { display: flex; gap: 6px; }

/* =====================================================================
   Buttons
   ===================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 12px;
  border-radius: 6px; border: 1px solid var(--border-strong);
  background: var(--bg); color: var(--text);
  font: inherit; font-size: 0.9rem; font-weight: 500; white-space: nowrap;
  cursor: pointer; transition: background 0.12s ease;
}
.btn:hover { text-decoration: none; background: var(--bg-hover); }
.btn:active { background: var(--bg-active); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-primary:active { background: var(--accent-hover); }

.btn-lg { height: 42px; padding: 0 18px; font-size: 0.98rem; }
.btn-block { width: 100%; }

/* =====================================================================
   Main / landing
   ===================================================================== */
main { flex: 1; width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }

.hero { max-width: 720px; margin: 0 auto; padding: 72px 0 40px; text-align: center; }
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
  font-size: 0.8rem; font-weight: 600;
}
.hero h1 {
  margin: 18px 0 14px;
  font-size: clamp(2.2rem, 6vw, 3.6rem); line-height: 1.1; font-weight: 700; letter-spacing: -0.03em;
  color: var(--text-strong);
}
.glow { color: var(--accent); }
.hero p { max-width: 560px; margin: 0 auto 28px; color: var(--muted); font-size: 1.1rem; }
.hero-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

.features {
  display: grid; gap: 12px; margin: 24px 0 72px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.card {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; transition: background 0.12s ease;
}
.card:hover { background: var(--bg-soft); }
.feature .icon { font-size: 1.6rem; line-height: 1; margin-bottom: 12px; }
.feature h3 { margin: 0 0 4px; font-size: 1rem; font-weight: 600; color: var(--text-strong); }
.feature p { margin: 0; color: var(--muted); font-size: 0.92rem; }

/* =====================================================================
   Auth forms
   ===================================================================== */
.auth-wrap { display: flex; justify-content: center; padding: 56px 0 72px; }
.auth-card { width: 100%; max-width: 380px; padding: 0; border: none; background: transparent; }
.auth-card:hover { background: transparent; }
.auth-card h1 { margin: 0 0 4px; font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; color: var(--text-strong); }
.auth-card .sub { margin: 0 0 24px; color: var(--muted); }

.field { margin-bottom: 14px; }
.field label { display: block; margin-bottom: 5px; font-size: 0.8rem; font-weight: 500; color: var(--muted); }
.field input {
  width: 100%; height: 38px; padding: 0 10px;
  border-radius: 6px; border: 1px solid var(--border-strong);
  background: var(--bg); color: var(--text);
  font: inherit; font-size: 0.95rem;
  box-shadow: inset 0 1px 1px rgba(15, 15, 15, 0.03);
  transition: border-color 0.12s, box-shadow 0.12s;
}
.field input::placeholder { color: var(--faint); }
.field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field .hint { margin-top: 5px; font-size: 0.78rem; color: var(--faint); }

.alert { padding: 10px 12px; border-radius: 6px; margin-bottom: 14px; font-size: 0.9rem; }
.alert-error { background: var(--red-soft); color: var(--red); border: 1px solid rgba(224, 62, 62, 0.2); }
.alert-success { background: var(--green-soft); color: var(--green); border: 1px solid rgba(15, 123, 108, 0.2); }

.switch { margin-top: 18px; text-align: center; color: var(--muted); font-size: 0.9rem; }

footer {
  padding: 22px 16px; text-align: center;
  color: var(--faint); font-size: 0.8rem;
  border-top: 1px solid var(--border);
}

/* =====================================================================
   Dropdown menus (language / country / profile) — shared look
   ===================================================================== */
.lang { position: relative; }
.lang-btn {
  display: inline-flex; align-items: center; gap: 5px;
  height: 34px; padding: 0 8px; border-radius: 6px;
  border: none; background: transparent; color: var(--muted);
  font: inherit; font-size: 0.85rem; font-weight: 500; cursor: pointer;
}
.lang-btn:hover { background: var(--bg-hover); color: var(--text); }
.lang-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.lang-btn .globe { width: 16px; height: 16px; }
.lang-btn .chev, .avatar-btn .chev, .country-btn .chev { width: 10px; height: 10px; color: var(--faint); transition: transform 0.15s; }
.lang-btn[aria-expanded="true"] .chev,
.avatar-btn[aria-expanded="true"] .chev,
.country-btn[aria-expanded="true"] .chev { transform: rotate(180deg); }

.lang-menu, .country-menu, .profile-menu {
  position: absolute; top: calc(100% + 6px); z-index: 60;
  background: var(--bg); border-radius: 8px; box-shadow: var(--shadow-pop);
}
.lang-menu { right: 0; min-width: 180px; margin: 0; padding: 6px; list-style: none; }
.lang-menu button, .country-list button, .pm-item {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 6px 8px; border: none; border-radius: 4px; background: transparent;
  color: var(--text); font: inherit; font-size: 0.9rem; text-align: left; cursor: pointer;
}
.lang-menu button { justify-content: space-between; }
.lang-menu button:hover, .lang-menu button:focus-visible,
.country-list button:hover, .country-list button:focus-visible,
.pm-item:hover, .pm-item:focus-visible { background: var(--bg-hover); outline: none; }
.lang-menu button[aria-selected="true"], .country-list button[aria-selected="true"] { background: var(--accent-soft); color: var(--accent); }
.lang-menu .l-code { color: var(--faint); font-size: 0.75rem; font-weight: 600; }

/* ---------- Phone + country picker ---------- */
.phone-group { position: relative; display: flex; align-items: stretch; }
.phone-group .country-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 38px; padding: 0 8px 0 10px;
  border: 1px solid var(--border-strong); border-right: none; border-radius: 6px 0 0 6px;
  background: var(--bg-soft); color: var(--text);
  font: inherit; font-size: 0.9rem; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.phone-group .country-btn:hover { background: var(--bg-active); }
.phone-group .country-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.phone-group .flag { font-size: 1.1rem; line-height: 1; }
.phone-group > input[type="tel"] { flex: 1; min-width: 0; border-radius: 0 6px 6px 0; }

.country-menu { left: 0; right: 0; overflow: hidden; }
.phone-group .country-search {
  width: 100%; height: 38px; padding: 0 12px;
  border: none; border-bottom: 1px solid var(--border); border-radius: 0;
  background: var(--bg); color: var(--text); font: inherit; font-size: 0.9rem; box-shadow: none;
}
.phone-group .country-search:focus { outline: none; box-shadow: none; background: var(--bg-soft); }
.country-list { list-style: none; margin: 0; padding: 4px; max-height: 260px; overflow-y: auto; overscroll-behavior: contain; }
.country-list .c-flag { width: 1.4em; text-align: center; font-size: 1.05rem; }
.country-list .c-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.country-list .c-dial { color: var(--faint); font-variant-numeric: tabular-nums; }
.country-list .c-empty { padding: 12px; text-align: center; color: var(--faint); }

/* =====================================================================
   Theme toggle (icon button)
   ===================================================================== */
.icon-btn {
  display: inline-grid; place-items: center;
  width: 34px; height: 34px; border-radius: 6px;
  border: none; background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .i-sun { display: none; }
:root[data-theme="dark"] .icon-btn .i-sun { display: block; }
:root[data-theme="dark"] .icon-btn .i-moon { display: none; }

/* =====================================================================
   Balance chip
   ===================================================================== */
.balance {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 10px 0 6px; border-radius: 6px;
  background: var(--green-soft); border: 1px solid rgba(15, 123, 108, 0.18);
  font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.balance .coin { width: 18px; height: 18px; flex: none; }
.balance-value { color: var(--green); font-size: 0.88rem; }
.balance-cur { color: var(--green); opacity: 0.7; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.04em; }

/* =====================================================================
   Profile
   ===================================================================== */
.profile { position: relative; }
.avatar-btn {
  display: inline-flex; align-items: center; gap: 4px;
  height: 34px; padding: 0 6px 0 4px; border-radius: 6px;
  border: none; background: transparent; color: var(--text); cursor: pointer;
}
.avatar-btn:hover { background: var(--bg-hover); }
.avatar-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.avatar {
  width: 26px; height: 26px; border-radius: 4px; flex: none;
  display: grid; place-items: center;
  background: var(--avatar-bg); color: var(--text-strong);
  font-weight: 600; font-size: 0.85rem; text-transform: uppercase;
}
.avatar-lg { width: 40px; height: 40px; border-radius: 6px; font-size: 1.1rem; }

.profile-menu { right: 0; width: 280px; padding: 6px; }
.pm-head { display: flex; gap: 10px; align-items: center; padding: 8px 8px 10px; }
.pm-who { min-width: 0; }
.pm-name { font-weight: 600; color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm-uid { display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.uid-label { color: var(--faint); font-size: 0.72rem; font-weight: 500; }
.uid-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 1px 6px; border-radius: 4px; border: none;
  background: var(--bg-soft); color: var(--text);
  font: inherit; font-size: 0.8rem; font-weight: 500; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  cursor: pointer;
}
.uid-btn:hover { background: var(--bg-active); }
.uid-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.uid-btn svg { width: 12px; height: 12px; color: var(--faint); }
.uid-copied { display: block; margin-top: 3px; color: var(--green); font-size: 0.75rem; font-weight: 500; }
.pm-row {
  display: flex; justify-content: space-between; align-items: center;
  margin: 2px 2px 0; padding: 8px 8px; border-radius: 4px;
  color: var(--muted); font-size: 0.88rem;
}
.pm-row strong { color: var(--green); font-weight: 600; font-variant-numeric: tabular-nums; }
.pm-sep { height: 1px; margin: 6px 0; background: var(--border); }
.pm-item svg { width: 16px; height: 16px; color: var(--muted); }
.pm-danger { color: var(--red); }
.pm-danger svg { color: var(--red); }
.pm-danger:hover, .pm-danger:focus-visible { background: var(--red-soft); }

/* =====================================================================
   Dashboard
   ===================================================================== */
.dash-head { padding: 40px 0 20px; }
.dash-kicker { margin: 0 0 4px; color: var(--faint); font-size: 0.85rem; font-weight: 500; }
.dash-title {
  margin: 0; font-size: clamp(1.7rem, 5vw, 2.4rem); font-weight: 700; letter-spacing: -0.02em;
  color: var(--text-strong); overflow-wrap: anywhere;
}
.dash-title .glow { color: var(--text-strong); }

.dash-grid {
  display: grid; gap: 12px; margin-bottom: 56px;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}
.dash-card {
  min-height: 150px; padding: 16px; border-radius: var(--radius);
  background: var(--bg); border: 1px solid var(--border);
  box-shadow: var(--card-shadow);
  transition: background 0.12s ease, box-shadow 0.12s ease;
}
.dash-card:not(.is-empty):hover { background: var(--bg-soft); box-shadow: 0 2px 6px rgba(15, 15, 15, 0.06); }
.dash-card.is-empty {
  display: grid; place-items: center;
  background: var(--bg-soft); border: 1px dashed var(--border-strong); box-shadow: none;
}
.dash-card-placeholder { display: inline-flex; align-items: center; gap: 8px; color: var(--faint); font-size: 0.85rem; }
.dash-card-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--border-strong); }

/* =====================================================================
   Small screens
   ===================================================================== */
@media (max-width: 560px) {
  .nav { padding: 8px 12px; gap: 8px; flex-wrap: wrap; }
  body.is-auth .nav { flex-wrap: nowrap; }
  body.is-auth .brand > span { display: none; }
  .nav-right { gap: 4px; }
  .balance-cur { display: none; }
  .lang-btn .chev { display: none; }
  .nav-actions .btn { height: 32px; padding: 0 10px; font-size: 0.85rem; }
  .profile-menu { width: min(290px, calc(100vw - 24px)); }
  .hero { padding: 44px 0 28px; }
  .hero-actions .btn { width: 100%; }
  .auth-wrap { padding: 32px 0 48px; }
  .dash-head { padding: 28px 0 16px; }
  .dash-grid { grid-template-columns: 1fr; }
  .dash-card { min-height: 120px; }
}
@media (min-width: 561px) and (max-width: 860px) {
  .dash-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* =====================================================================
   Settings page
   ===================================================================== */
a.pm-item, a.pm-item:hover { text-decoration: none; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.settings { max-width: 680px; margin: 0 auto; padding: 40px 0 64px; }
.set-head h1 { margin: 0 0 4px; font-size: 2rem; font-weight: 700; letter-spacing: -0.02em; color: var(--text-strong); }
.set-head p { margin: 0; color: var(--muted); }

.set-section { padding: 28px 0; border-bottom: 1px solid var(--border); }
.set-section:last-child { border-bottom: none; }
.set-section h2 { margin: 0 0 12px; font-size: 1.05rem; font-weight: 600; color: var(--text-strong); }
.set-desc { margin: 0 0 14px; color: var(--muted); font-size: 0.9rem; }
.set-note { margin: 12px 0 0; color: var(--faint); font-size: 0.8rem; }

.set-list { margin: 0; }
.set-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 44px; padding: 8px 0; border-bottom: 1px solid var(--border);
}
.set-list .set-row:last-child { border-bottom: none; }
.set-row dt, .set-row label { color: var(--muted); font-size: 0.9rem; }
.set-row dd { margin: 0; color: var(--text); font-weight: 500; text-align: right; overflow-wrap: anywhere; }
.set-row .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.9rem; }
.set-row .money { color: var(--green); font-variant-numeric: tabular-nums; }
.set-row-action { border-bottom: none; }
.set-row-action .set-desc { margin: 0; }

.set-form { max-width: 380px; }
.set-form .btn { margin-top: 4px; }

.set-select {
  height: 32px; padding: 0 28px 0 10px; border-radius: 6px;
  border: 1px solid var(--border-strong); background: var(--bg); color: var(--text);
  font: inherit; font-size: 0.9rem; cursor: pointer;
}
.set-select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

@media (max-width: 560px) {
  .settings { padding: 28px 0 48px; }
  .set-head h1 { font-size: 1.6rem; }
  .set-row-action { flex-direction: column; align-items: stretch; }
  .set-row-action .btn { width: 100%; }
}

/* ---------- Session list (settings) ---------- */
.sess-list { list-style: none; margin: 0 0 8px; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); }
.sess-list:empty { display: none; }
.sess-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.sess-item:last-child { border-bottom: none; }
.sess-icon { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 6px; background: var(--bg-soft); color: var(--muted); }
.sess-icon svg { width: 20px; height: 20px; }
.sess-main { flex: 1; min-width: 0; }
.sess-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 500; color: var(--text-strong); font-size: 0.93rem; }
.sess-badge { padding: 1px 7px; border-radius: 999px; background: var(--green-soft); color: var(--green); font-size: 0.72rem; font-weight: 600; }
.sess-meta { margin-top: 2px; color: var(--faint); font-size: 0.8rem; overflow-wrap: anywhere; }
.sess-meta .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.sess-item .btn { flex: none; height: 30px; padding: 0 10px; font-size: 0.82rem; }
.dash-grid { margin-top: 32px; }
@media (max-width: 560px) {
  .sess-item { flex-wrap: wrap; }
  .sess-item .btn { width: 100%; }
  .dash-grid { margin-top: 20px; }
}
