:root{
      --bg:#0b1220;
      --text:#e8eeff;
      --muted:rgba(232,238,255,.72);
      --muted2:rgba(232,238,255,.55);
      --stroke:rgba(232,238,255,.10);
      --stroke2:rgba(232,238,255,.16);
      --accent:#6ea8ff;
      --accent2:#7ce7ff;
      --ok:#39d98a;
      --danger:#ff5c7a;
      --shadow: 0 14px 40px rgba(0,0,0,.35);
      --radius:18px;
      --radius2:22px;
      --font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
      --card-bg: rgba(16,27,56,.75);
      --card-border: rgba(0,0,0,.08);
      --topbar-bg: rgba(11,18,32,.92);
    }

    html.light-mode {
      --bg:#ffffff;
      --text:#0d1117;
      --muted:rgba(13,17,23,.70);
      --muted2:rgba(13,17,23,.60);
      --stroke:rgba(13,17,23,.15);
      --stroke2:rgba(13,17,23,.22);
      --accent:#0969da;
      --accent2:#0073e6;
      --ok:#1a7f37;
      --danger:#da3633;
      --shadow: 0 2px 8px rgba(13,17,23,.10);
      --card-bg: #f8f9fa;
      --card-border: rgba(13,17,23,.15);
      --topbar-bg: rgba(255,255,255,.90);
    }

    *{ box-sizing:border-box; }
    body{
      margin:0;
      font-family:var(--font);
      background:
        radial-gradient(900px 500px at 20% -10%, rgba(110,168,255,.18), transparent 60%),
        radial-gradient(800px 400px at 80% 0%, rgba(124,231,255,.10), transparent 60%),
        radial-gradient(700px 400px at 50% 110%, rgba(110,168,255,.10), transparent 55%),
        var(--bg);
      color:var(--text);
      transition: background-color .3s ease, color .3s ease;
    }

    html.light-mode body {
      background:
        radial-gradient(900px 500px at 20% -10%, rgba(74,126,255,.08), transparent 60%),
        radial-gradient(800px 400px at 80% 0%, rgba(0,153,204,.06), transparent 60%),
        radial-gradient(700px 400px at 50% 110%, rgba(74,126,255,.06), transparent 55%),
        var(--bg);
    }

    .topbar{
      position:sticky; top:0; z-index:10;
      background: linear-gradient(180deg, var(--topbar-bg), transparent);
      backdrop-filter: blur(10px);
      border-bottom:1px solid var(--stroke);
      transition: background .3s ease, border-color .3s ease;
    }
    .wrap{ max-width: 1280px; margin:0 auto; padding: 14px 16px 26px; }
    .title{ display:flex; justify-content:space-between; align-items:flex-end; gap:12px; padding: 6px 0 10px; }
    .title h1{ margin:0; font-size:18px; font-weight:900; letter-spacing:.2px; }
    .title .sub{ font-size:12px; color:var(--muted); line-height:1.35; }

    .theme-toggle{
      padding: 8px 12px; border-radius: 10px; border:1px solid var(--stroke2);
      background: rgba(255,255,255,.08); color: var(--text); cursor:pointer;
      font-weight:900; font-size: 13px; white-space:nowrap; transition: .15s ease;
    }
    .theme-toggle:hover{ transform: translateY(-1px); border-color: var(--accent); color: var(--accent); }

    .tabs{ display:flex; gap:10px; flex-wrap:wrap; padding: 6px 0 14px; align-items:center; }
    .tab{
      padding: 10px 12px; border:1px solid var(--stroke2);
      background: rgba(16,27,56,.55); border-radius: 999px; cursor:pointer;
      user-select:none; font-weight:800; font-size: 13px; color: var(--muted);
      transition: .15s ease;
    }
    html.light-mode .tab {
      background: rgba(13,17,23,.08);
    }
    .tab:hover{ transform: translateY(-1px); border-color: rgba(110,168,255,.35); color: var(--text); }
    .tab.active{
      background: linear-gradient(180deg, rgba(110,168,255,.22), rgba(110,168,255,.10));
      border-color: rgba(110,168,255,.45); color: var(--text);
    }
    html.light-mode .tab.active{
      background: linear-gradient(180deg, rgba(74,126,255,.20), rgba(74,126,255,.08));
      border-color: rgba(74,126,255,.45); color: var(--text);
    }

    .grid{ display:grid; grid-template-columns: 460px 1fr; gap:16px; align-items:start; }
    .grid.full-width{ grid-template-columns: 1fr; }
    @media (max-width: 980px){ .grid{ grid-template-columns: 1fr; } }

    .card{
      background: var(--card-bg);
      border: 1px solid var(--stroke);
      border-radius: var(--radius2);
      box-shadow: var(--shadow);
      overflow:hidden;
      transition: background .3s ease, border-color .3s ease, box-shadow .3s ease;
    }
    .card .hd{
      padding: 14px 16px; border-bottom:1px solid var(--stroke);
      display:flex; align-items:center; justify-content:space-between; background: var(--card-border);
      transition: background .3s ease, border-color .3s ease;
    }
    .card .hd b{ font-size: 13px; letter-spacing:.2px; }
    .card .bd{ padding: 14px 16px 16px; }

    .hint{
      background: rgba(110,168,255,.08); border:1px solid rgba(110,168,255,.18);
      border-radius: 14px; padding: 10px 12px; color: var(--muted);
      font-size: 12px; line-height: 1.35; transition: background .3s ease, border-color .3s ease;
    }
    html.light-mode .hint {
      background: rgba(9,105,218,.08);
      border-color: rgba(9,105,218,.18);
      color: rgba(13,17,23,.75);
    }
    label{
      display:block; margin-top: 12px; font-size: 12px;
      font-weight:900; color: var(--muted); letter-spacing:.2px; transition: color .3s ease;
    }
    input, select{
      width:100%; margin-top: 7px; padding: 10px 10px;
      border-radius: 12px; border:1px solid var(--stroke2);
      background: rgba(0,0,0,.14); color: var(--text); outline:none;
      transition: background .3s ease, border-color .3s ease, color .3s ease;
      font-family: inherit; font-size: inherit;
    }
    html.light-mode input, html.light-mode select {
      background: rgba(26,31,58,.05);
    }
    input:focus, select:focus{
      border-color: rgba(110,168,255,.55);
      box-shadow: 0 0 0 3px rgba(110,168,255,.12);
    }
    
    /* Select dropdown options styling */
    select {
      appearance: none;
      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23e8eeff' d='M1.5 4l4.5 4 4.5-4'/%3E%3C/svg%3E");
      background-repeat: no-repeat;
      background-position: right 10px center;
      padding-right: 32px;
    }
    html.light-mode select {
      background-color: #f0f3f6;
      background-repeat: no-repeat;
      background-position: right 10px center;
      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%230d1117' d='M1.5 4l4.5 4 4.5-4'/%3E%3C/svg%3E");
    }
    
    select option {
      background: var(--bg);
      color: var(--text);
      padding: 8px 10px;
    }
    
    select option:checked {
      background: linear-gradient(rgba(110,168,255,.3), rgba(110,168,255,.3));
      color: var(--text);
    }
    
    html.light-mode select option {
      background: #ffffff;
      color: #0d1117;
    }
    
    html.light-mode select option:checked {
      background: linear-gradient(rgba(9,105,218,.2), rgba(9,105,218,.2));
      color: #0d1117;
    }
    .row{ display:flex; gap:10px; align-items:center; margin-top:10px; }
    .row > *{ flex:1; }

    .btn{
      padding: 10px 12px; border-radius: 12px; border:1px solid var(--stroke2);
      background: rgba(255,255,255,.05); color: var(--text); font-weight:900;
      cursor:pointer; transition: .15s ease; width: 100%;
    }
    .btn.small{
      width:auto; padding: 8px 10px; font-size: 12px; border-radius: 10px;
    }
    html.light-mode .btn {
      background: rgba(13,17,23,.08);
      border-color: rgba(13,17,23,.15);
    }
    .btn:hover{ transform: translateY(-1px); border-color: rgba(110,168,255,.35); }
    html.light-mode .btn:hover {
      border-color: rgba(9,105,218,.35);
      background: rgba(13,17,23,.12);
    }
    .btn.primary{ background: linear-gradient(180deg, rgba(110,168,255,.35), rgba(110,168,255,.15)); border-color: rgba(110,168,255,.55); }
    html.light-mode .btn.primary {
      background: linear-gradient(180deg, rgba(9,105,218,.20), rgba(9,105,218,.08));
      border-color: rgba(9,105,218,.40);
      color: #0969da;
    }
    .btn.ok{ background: linear-gradient(180deg, rgba(57,217,138,.25), rgba(57,217,138,.10)); border-color: rgba(57,217,138,.40); }
    html.light-mode .btn.ok {
      background: linear-gradient(180deg, rgba(26,183,55,.15), rgba(26,183,55,.05));
      border-color: rgba(26,183,55,.30);
      color: #1a7f37;
    }
    .btn.ghost{ background: rgba(0,0,0,.12); }
    html.light-mode .btn.ghost {
      background: rgba(13,17,23,.08);
    }
    .btn.danger{ background: rgba(255,92,122,.12); border-color: rgba(255,92,122,.35); }
    html.light-mode .btn.danger {
      background: rgba(218,54,51,.12);
      border-color: rgba(218,54,51,.30);
      color: #da3633;
    }

    .seg{ display:flex; gap:8px; flex-wrap:wrap; margin-top:10px; }
    .pill{
      padding: 9px 10px; border-radius: 999px; border:1px solid var(--stroke2);
      background: rgba(0,0,0,.12); color: var(--muted); font-weight:900;
      cursor:pointer; font-size: 12px; transition: .15s ease; white-space:nowrap;
    }
    html.light-mode .pill {
      background: rgba(13,17,23,.08);
    }
    .pill.active{
      background: linear-gradient(180deg, rgba(124,231,255,.22), rgba(124,231,255,.08));
      border-color: rgba(124,231,255,.45); color: var(--text);
    }
    html.light-mode .pill.active {
      background: linear-gradient(180deg, rgba(0,153,204,.20), rgba(0,153,204,.08));
      border-color: rgba(0,153,204,.45);
    }

    .divider{ height:1px; background: var(--stroke); margin: 14px 0; transition: background .3s ease; }

    .previewHeader{
      display:flex; align-items:flex-start; justify-content:space-between; gap:12px;
      padding: 14px 16px; border-bottom: 1px solid var(--stroke); background: var(--card-border);
      transition: background .3s ease, border-color .3s ease;
    }
    .previewHeader .ttl{ font-weight: 900; font-size: 13px; letter-spacing:.2px; }
    .previewHeader .sub{ font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.35; }

    .kpi{ display:flex; gap:10px; flex-wrap:wrap; justify-content:flex-end; font-size:12px; }
    .kpi .chip{
      border:1px solid var(--stroke2); background: rgba(0,0,0,.12);
      padding: 6px 8px; border-radius: 999px; color: var(--muted);
      font-weight:900; white-space:nowrap; transition: background .3s ease, border-color .3s ease;
    }
    html.light-mode .kpi .chip {
      background: rgba(26,31,58,.08);
    }

    .result{
      margin-top: 12px; padding: 10px 12px; border-radius: 14px;
      border:1px solid var(--stroke2); background: rgba(0,0,0,.12);
      color: var(--muted); line-height: 1.4; font-size: 12px;
      transition: background .3s ease, border-color .3s ease, color .3s ease;
    }
    html.light-mode .result {
      background: rgba(26,31,58,.05);
    }
    .result b{ color: var(--text); }
    a{ color: var(--accent2); font-weight:900; text-decoration:none; transition: color .3s ease; }
    a:hover{ text-decoration:underline; }

    .canvasShell{ padding: 14px 16px 18px; }
    .canvasFrame{
      border:1px solid var(--stroke2);
      border-radius: 18px;
      background: rgba(0,0,0,.12);
      padding: 10px;
      overflow:auto;
      transition: background .3s ease, border-color .3s ease;
    }
    html.light-mode .canvasFrame {
      background: rgba(26,31,58,.05);
    }
    canvas{ border:1px solid rgba(232,238,255,.10); border-radius:14px; display:block; background:#fff; }
    input[type="range"]{ padding:0; height:28px; }

    .hidden{ display:none !important; }
    .tiny{ font-size:11px; color: var(--muted2); transition: color .3s ease; }

    .list{
      border:1px solid var(--stroke2);
      border-radius: 14px;
      overflow:hidden;
      margin-top:10px;
      transition: border-color .3s ease;
    }
    .list .item{
      padding:10px 10px;
      border-bottom:1px solid rgba(232,238,255,.08);
      display:flex;
      gap:10px;
      align-items:center;
      justify-content:space-between;
      background: rgba(0,0,0,.08);
      cursor:pointer;
      transition: background .3s ease, border-color .3s ease;
    }
    html.light-mode .list .item {
      background: rgba(26,31,58,.05);
      border-bottom-color: rgba(26,31,58,.08);
    }
    .list .item:last-child{ border-bottom:none; }
    .list .item.active{ outline: 2px solid rgba(124,231,255,.35); background: rgba(124,231,255,.10); }
    html.light-mode .list .item.active{ outline: 2px solid rgba(0,153,204,.35); background: rgba(0,153,204,.08); }
    .list .meta{ display:flex; flex-direction:column; gap:3px; }
    .list .meta b{ font-size:12px; }
    .list .meta span{ font-size:11px; color: var(--muted2); }
    .mini{
      display:flex; gap:8px; align-items:center;
    }
    .mini select{ margin-top:0; padding:8px 10px; }

.topActions{
  display:flex; gap:10px; align-items:center;
}
.topActions .authUser{
  display:flex; gap:8px; align-items:center; font-size: 12px; font-weight:900;
}
.projectBar{
  display:flex; gap:8px; align-items:center; padding: 6px 8px;
  border:1px solid var(--stroke2); border-radius: 12px; background: rgba(0,0,0,.12);
  transition: background .3s ease, border-color .3s ease;
}
    html.light-mode .projectBar{
      background: rgba(13,17,23,.06);
    }
.projectSelect{
  width: 180px; margin-top:0;
  padding: 8px 10px; border-radius: 10px; font-size: 12px;
}
.authScreen{
  position:fixed; inset:0; z-index:9999;
  display:flex; align-items:center; justify-content:center;
  background: radial-gradient(900px 500px at 20% -10%, rgba(110,168,255,.18), transparent 60%),
              radial-gradient(800px 400px at 80% 0%, rgba(124,231,255,.10), transparent 60%),
              var(--bg);
}
.authCard{
  width:min(460px, 92vw);
  background: var(--card-bg);
  border:1px solid var(--stroke);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 22px;
}
.authBrand h2{ margin:0 0 6px; font-size:20px; }
.authSub{ font-size:12px; color: var(--muted); margin-bottom:14px; }
.authTabs{ display:flex; gap:8px; margin-bottom:12px; }
.authFields{
  display:flex; flex-direction:column; gap:10px;
}
.authInput{
  width: 100%;
  padding: 10px 12px; border-radius: 12px; font-size: 14px;
  border:1px solid var(--stroke2);
  background: rgba(0,0,0,.14); color: var(--text); outline:none;
}
html.light-mode .authInput{ background: rgba(26,31,58,.05); }
.authActions{ display:flex; gap:10px; flex-wrap:wrap; }
.authDivider{
  position: relative;
  text-align: center;
  margin: 16px 0;
}
.authDivider span{
  background: var(--card-bg);
  padding: 0 12px;
  font-size: 12px;
  color: var(--muted2);
  position: relative;
  z-index: 1;
}
.authDivider::before{
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: var(--stroke);
}
.btnGoogle{
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--stroke2);
  border-radius: 12px;
  background: white;
  color: #3c4043;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
.btnGoogle:hover{
  background: #f8f9fa;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  transform: translateY(-1px);
}
.googleIcon{
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}
.authMsg{ font-size:12px; color: var(--muted); min-height: 16px; }
.authFoot{ margin-top:12px; font-size:11px; color: var(--muted2); }
.authScreen.hidden{ display:none; }

body.auth-only .topbar,
body.auth-only .wrap{
  display:none;
}
    .projectForm{
      display:flex; gap:6px; align-items:center;
    }
    .projectForm.hidden{ display:none; }
    .projectInput{
      width: 160px; margin-top:0;
      padding: 8px 10px; border-radius: 10px; font-size: 12px;
      border:1px solid var(--stroke2);
      background: rgba(0,0,0,.14); color: var(--text); outline:none;
    }
    html.light-mode .projectInput{
      background: rgba(26,31,58,.05);
    }

    /* Disclaimer Modal Styles */
    .disclaimerModal{
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background: rgba(0, 0, 0, 0.7);
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 9999;
    }
    
    .disclaimerModal.hidden{
      display: none;
    }
    
    .disclaimerContent{
      background: var(--card-bg);
      border: 1px solid var(--stroke);
      border-radius: 22px;
      padding: 32px;
      max-width: 600px;
      width: 90vw;
      max-height: 80vh;
      overflow-y: auto;
      box-shadow: var(--shadow);
    }
    
    .disclaimerContent h2{
      margin: 0 0 20px 0;
      font-size: 24px;
      color: var(--text);
    }
    
    .disclaimerText{
      font-size: 14px;
      line-height: 1.6;
      color: var(--muted);
      margin-bottom: 24px;
    }
    
    .disclaimerText p{
      margin: 12px 0;
    }
    
    .disclaimerText strong{
      color: var(--text);
      font-weight: 600;
    }
    
    .disclaimerText ul{
      margin: 12px 0;
      padding-left: 20px;
    }
    
    .disclaimerText li{
      margin: 8px 0;
      color: var(--muted);
    }
    
    #disclaimerAccept{
      width: 100%;
      padding: 12px;
      font-size: 14px;
      border: none;
      border-radius: 12px;
      background: var(--accent);
      color: white;
      cursor: pointer;
      font-weight: 600;
      transition: background-color 0.3s ease;
    }
    
    #disclaimerAccept:hover{
      background: var(--accent2);
    }
    /* Legal Panel Styles */
    .legalContent{
      font-size: 14px;
      line-height: 1.6;
      color: var(--muted);
    }
    
    .legalContent h3{
      font-size: 20px;
      color: var(--text);
      margin: 0 0 20px 0;
    }
    
    .legalContent h4{
      font-size: 15px;
      color: var(--text);
      margin: 16px 0 10px 0;
      font-weight: 600;
    }
    
    .legalSection{
      margin-bottom: 20px;
      padding: 12px;
      border-left: 3px solid var(--accent);
      background: rgba(110, 168, 255, 0.05);
      border-radius: 4px;
    }
    
    .legalSection p{
      margin: 8px 0;
    }
    
    .legalSection ul{
      margin: 10px 0;
      padding-left: 20px;
    }
    
    .legalSection li{
      margin: 6px 0;
      color: var(--muted);
    }

    /* Link Styles */
    .legalLink, .disclaimerLink{
      color: var(--accent);
      text-decoration: none;
      font-weight: 600;
      border-bottom: 2px solid var(--accent);
      transition: all 0.3s ease;
      cursor: pointer;
    }
    
    .legalLink:hover, .disclaimerLink:hover{
      color: var(--accent2);
      border-bottom-color: var(--accent2);
    }

    /* Footer Styles */
    .appFooter{
      margin-top: 60px;
      padding: 32px 16px;
      border-top: 1px solid var(--stroke);
      background: var(--card-bg);
      text-align: center;
      backdrop-filter: blur(10px);
    }
    
    html.light-mode .appFooter{
      background: rgba(248, 249, 250, 0.8);
    }
    
    .footerContent{
      max-width: 1200px;
      margin: 0 auto;
    }
    
    .footerContent p{
      margin: 0;
      font-size: 14px;
      color: var(--muted);
      letter-spacing: 0.5px;
      line-height: 1.6;
    }
    
    .footerLink{
      color: var(--accent);
      text-decoration: none;
      font-weight: 600;
      transition: all 0.3s ease;
      padding: 0 4px;
      border-radius: 4px;
    }
    
    .footerLink:hover{
      color: var(--accent2);
      background: rgba(110, 168, 255, 0.1);
    }