/* StrategyForge — shared theme (vanilla CSS, no frameworks) */
:root {
  --bg: #0a0e14;
  --panel: #111722;
  --panel-2: #0d131d;
  --border: #1e2937;
  --text: #e6edf3;
  --muted: #8b97a7;
  --accent: #26d07c;
  --accent-dim: #1a9c5c;
  --red: #f6465d;
  --amber: #f0b429;
  --code-bg: #0b1017;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: radial-gradient(1200px 600px at 70% -10%, rgba(38, 208, 124, 0.08), transparent 60%),
    radial-gradient(900px 500px at 10% 10%, rgba(240, 180, 41, 0.05), transparent 55%), var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }

/* ---- Brand / logo ---- */
.logo {
  width: 34px; height: 34px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dim));
  display: grid; place-items: center; font-weight: 800; color: #04140b;
  box-shadow: 0 4px 14px rgba(38, 208, 124, 0.35); flex: 0 0 auto;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand b { font-size: 18px; letter-spacing: -0.02em; }
.brand span { color: var(--muted); font-size: 13px; }
.brand .logo { font-size: 13px; letter-spacing: -0.5px; } /* "YS" monogram */
.brand-block { margin-bottom: 22px; }
.brand-tagline { font-size: 11.5px; color: var(--muted); margin-top: 9px; line-height: 1.4; padding: 0 2px; }

/* Prominent Generate button */
button.primary.primary-lg {
  font-size: 16px; font-weight: 800; padding: 15px 30px; border-radius: 12px;
  box-shadow: 0 8px 26px rgba(38, 208, 124, 0.42); letter-spacing: -0.01em;
}
button.primary.primary-lg:hover { filter: brightness(1.08); transform: translateY(-1px); }

/* "How to use" info section */
.howto {
  margin-bottom: 20px; background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px; padding: 4px 16px;
}
.howto summary {
  list-style: none; cursor: pointer; padding: 12px 0; font-size: 14px; font-weight: 700;
  display: flex; align-items: center; gap: 8px; user-select: none;
}
.howto summary::-webkit-details-marker { display: none; }
.howto .ht-icon { font-size: 16px; }
.howto .ht-hint { font-size: 11.5px; color: var(--muted); font-weight: 500; margin-left: auto; }
.howto-steps { margin: 0 0 14px; padding: 0 0 0 20px; color: var(--muted); font-size: 13.5px; line-height: 1.7; }
.howto-steps b { color: var(--text); }
.howto[open] summary { border-bottom: 1px solid var(--border); margin-bottom: 12px; }

/* App footer */
.app-footer {
  margin-top: 40px; padding-top: 22px; border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
}
.app-footer .foot-links { display: flex; gap: 10px; flex-wrap: wrap; }
.app-footer .foot-links a {
  text-decoration: none; font-size: 13px; font-weight: 600; color: var(--text);
  border: 1px solid var(--border); background: var(--panel-2); padding: 8px 14px; border-radius: 9px; transition: all 0.12s;
}
.app-footer .foot-links a:hover { border-color: var(--accent-dim); color: var(--accent); }
.app-footer .foot-built { font-size: 12px; color: #55606f; }
.app-footer .foot-built b { color: var(--muted); }

/* ---- Buttons ---- */
button.primary, .btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-dim));
  color: #04140b; font-weight: 700; font-size: 15px; text-decoration: none; text-align: center;
  border: none; border-radius: 10px; padding: 13px 22px; cursor: pointer;
  box-shadow: 0 6px 20px rgba(38, 208, 124, 0.3); transition: transform 0.1s, filter 0.15s;
  display: inline-block;
}
button.primary:hover, .btn-primary:hover { filter: brightness(1.06); }
button.primary:active, .btn-primary:active { transform: translateY(1px); }
button.primary:disabled, .btn-primary:disabled { opacity: 0.6; cursor: not-allowed; filter: grayscale(0.3); }
button.ghost, .btn-ghost {
  background: transparent; color: var(--muted); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 18px; cursor: pointer; font-size: 14px; transition: all 0.12s;
  text-decoration: none; display: inline-block;
}
button.ghost:hover, .btn-ghost:hover { color: var(--text); border-color: #2c3a4d; }
.btn-danger {
  background: transparent; color: var(--red); border: 1px solid rgba(246, 70, 93, 0.4);
  border-radius: 10px; padding: 11px 16px; cursor: pointer; font-size: 14px; font-weight: 600;
}
.btn-danger:hover { background: rgba(246, 70, 93, 0.1); }

/* ---- Form fields ---- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; color: var(--muted); font-weight: 600; }
.field input, .field select {
  background: var(--code-bg); color: var(--text); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px; font-size: 15px; font-family: inherit; outline: none;
  transition: border-color 0.15s;
}
.field input:focus, .field select:focus { border-color: var(--accent-dim); }
.field input::placeholder { color: #55606f; }
.field input:read-only { opacity: 0.7; cursor: not-allowed; }

.card {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--border); border-radius: 16px; padding: 22px; box-shadow: var(--shadow);
}
.error-box {
  margin-top: 14px; display: none; padding: 12px 14px; border-radius: 10px;
  background: rgba(246, 70, 93, 0.1); border: 1px solid rgba(246, 70, 93, 0.35); color: #ffb3bf; font-size: 14px;
}
.error-box.show { display: block; }
.ok-box {
  margin-top: 14px; display: none; padding: 12px 14px; border-radius: 10px;
  background: rgba(38, 208, 124, 0.1); border: 1px solid var(--accent-dim); color: var(--accent); font-size: 14px;
}
.ok-box.show { display: block; }

/* ---- Password strength meter ---- */
.pw-meter { margin: -6px 0 14px; }
.pw-meter .pw-bars { display: flex; gap: 4px; }
.pw-meter .pw-bars i { height: 5px; flex: 1; border-radius: 3px; background: var(--border); transition: background 0.15s; }
.pw-meter .pw-label { font-size: 12px; margin-top: 6px; color: var(--muted); min-height: 15px; }
.pw-meter.s0 .pw-bars i:nth-child(-n+1), .pw-meter.s1 .pw-bars i:nth-child(-n+1) { background: var(--red); }
.pw-meter.s2 .pw-bars i:nth-child(-n+2) { background: var(--amber); }
.pw-meter.s3 .pw-bars i:nth-child(-n+3) { background: #6cb6ff; }
.pw-meter.s4 .pw-bars i { background: var(--accent); }
.pw-meter.s0 .pw-label, .pw-meter.s1 .pw-label { color: var(--red); }
.pw-meter.s2 .pw-label { color: var(--amber); }
.pw-meter.s3 .pw-label { color: #6cb6ff; }
.pw-meter.s4 .pw-label { color: var(--accent); }

.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--border); border-top-color: var(--accent); animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---- Auth pages ---- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card .brand { justify-content: center; margin-bottom: 22px; }
.auth-card h1 { font-size: 24px; margin: 0 0 6px; letter-spacing: -0.02em; }
.auth-card .sub { color: var(--muted); font-size: 14px; margin: 0 0 22px; }
.auth-card .alt { text-align: center; margin-top: 18px; font-size: 14px; color: var(--muted); }
.auth-card .alt a { font-weight: 600; text-decoration: none; }
.forgot { font-size: 12.5px; color: var(--muted); text-align: right; margin: -6px 0 12px; }

/* ---- Landing ---- */
.landing { max-width: 1080px; margin: 0 auto; padding: 22px 22px 80px; }
.landing-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 70px; }
.landing-nav .nav-links { display: flex; gap: 12px; align-items: center; }
.landing-hero { text-align: center; max-width: 780px; margin: 0 auto 40px; }
.landing-hero h1 {
  font-size: clamp(32px, 6vw, 52px); line-height: 1.06; letter-spacing: -0.03em; margin: 0 0 18px;
  background: linear-gradient(180deg, #ffffff, #b9c6d6);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.landing-hero h1 .hl { color: var(--accent); -webkit-text-fill-color: var(--accent); }
.landing-hero p { color: var(--muted); font-size: 18px; margin: 0 0 28px; line-height: 1.5; }
.landing-cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 56px 0; }
@media (max-width: 760px) { .features { grid-template-columns: 1fr; } }
.feature { padding: 22px; }
.feature .f-icon { font-size: 26px; margin-bottom: 12px; }
.feature h3 { margin: 0 0 8px; font-size: 16px; }
.feature p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.demo { margin-top: 20px; }
.demo .demo-frame {
  border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: var(--code-bg);
  box-shadow: var(--shadow);
}
.demo .demo-bar { display: flex; gap: 6px; padding: 10px 14px; background: var(--panel); border-bottom: 1px solid var(--border); }
.demo .demo-bar i { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.demo .demo-code { margin: 0; padding: 18px; font-family: "SF Mono", Menlo, monospace; font-size: 12.5px; line-height: 1.6; overflow-x: auto; }

/* ---- App shell (authenticated) ---- */
.app-shell { display: flex; min-height: 100vh; }
.app-sidebar {
  flex: 0 0 250px; background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border-right: 1px solid var(--border); padding: 20px 16px; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.app-sidebar .brand { margin-bottom: 26px; padding: 0 6px; }
.user-chip {
  display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--panel-2); margin-bottom: 20px; cursor: pointer; position: relative;
}
.user-chip:hover { border-color: #2c3a4d; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: 0 0 auto; display: grid; place-items: center;
  font-weight: 800; font-size: 13px; color: #04140b; background: linear-gradient(135deg, var(--accent), var(--accent-dim));
}
.user-chip .u-meta { min-width: 0; flex: 1; }
.user-chip .u-name { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip .u-mail { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip .u-caret { color: var(--muted); font-size: 11px; }
.user-menu {
  display: none; position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 20;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; box-shadow: var(--shadow);
}
.user-menu.show { display: block; }
.user-menu button { width: 100%; text-align: left; background: none; border: none; color: var(--text); padding: 10px 14px; font-size: 13px; cursor: pointer; }
.user-menu button:hover { background: var(--panel-2); }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 11px 12px; border-radius: 9px;
  color: var(--muted); font-size: 14px; font-weight: 600; cursor: pointer; border: none; background: none;
  text-align: left; width: 100%; transition: all 0.12s;
}
.nav-item .n-ico { font-size: 16px; width: 18px; text-align: center; }
.nav-item:hover { background: var(--panel-2); color: var(--text); }
.nav-item.active { background: rgba(38, 208, 124, 0.12); color: var(--accent); }
.nav-spacer { flex: 1; }
.usage-box { margin-top: 18px; padding: 12px 13px; border-radius: 10px; border: 1px solid var(--border); background: var(--panel-2); font-size: 13px; color: var(--muted); }
.usage-box b { color: var(--accent); }
.usage-box.low b { color: var(--amber); }
.usage-box.out b { color: var(--red); }
.usage-box .u-bar { height: 5px; border-radius: 3px; background: var(--border); margin-top: 8px; overflow: hidden; }
.usage-box .u-bar span { display: block; height: 100%; background: var(--accent); transition: width 0.3s; }

.app-main { flex: 1 1 auto; min-width: 0; padding: 32px 28px 80px; max-width: 980px; }
.view { display: none; }
.view.active { display: block; animation: fade 0.2s ease; }
.view h2.page-title { font-size: 22px; margin: 0 0 6px; letter-spacing: -0.02em; }
.view .page-sub { color: var(--muted); font-size: 14px; margin: 0 0 24px; }

.mobile-topbar { display: none; }
@media (max-width: 860px) {
  .app-shell { flex-direction: column; }
  .app-sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: 260px; flex-basis: 260px; height: 100vh;
    transform: translateX(-100%); transition: transform 0.2s; z-index: 50;
  }
  .app-sidebar.open { transform: translateX(0); }
  .app-main { padding: 16px 16px 60px; }
  .mobile-topbar {
    display: flex; align-items: center; gap: 12px; padding: 12px 16px;
    border-bottom: 1px solid var(--border); background: var(--panel); position: sticky; top: 0; z-index: 40;
  }
  .mobile-topbar .hamburger { background: none; border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-size: 18px; padding: 4px 10px; cursor: pointer; }
  .backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 45; }
  .backdrop.show { display: block; }
}

/* ---- My Scripts grid ---- */
.scripts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.script-card { padding: 16px; cursor: pointer; transition: all 0.12s; position: relative; }
.script-card:hover { border-color: var(--accent-dim); transform: translateY(-2px); }
.script-card .sc-name { font-size: 15px; font-weight: 700; margin-bottom: 8px; padding-right: 24px; }
.script-card .sc-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.pill { font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: rgba(38,208,124,0.14); color: var(--accent); border: 1px solid var(--accent-dim); }
.pill.gray { background: var(--panel-2); color: var(--muted); border-color: var(--border); }
.script-card .sc-preview { font-family: "SF Mono", Menlo, monospace; font-size: 11px; color: #55606f; line-height: 1.4; max-height: 54px; overflow: hidden; white-space: pre-wrap; }
.script-card .sc-del { position: absolute; top: 12px; right: 12px; border: none; background: none; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; border-radius: 6px; padding: 0 4px; }
.script-card .sc-del:hover { color: var(--red); background: rgba(246,70,93,0.12); }
.empty-state { text-align: center; color: var(--muted); padding: 50px 20px; }

/* ---- Settings ---- */
.settings-section { margin-bottom: 22px; }
.settings-section h3 { font-size: 14px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 14px; }
.settings-section.danger h3 { color: var(--red); }
.checkbox-row { display: flex; gap: 16px; flex-wrap: wrap; }
.checkbox-row label { display: flex; align-items: center; gap: 7px; font-size: 14px; color: var(--text); cursor: pointer; }
.checkbox-row input { width: 16px; height: 16px; accent-color: var(--accent); }
