/* =================================================================== */
/* 1. Base Styles & Global Reset
/* =================================================================== */
*,:after,:before{box-sizing:border-box}
html{line-height:1.5;font-family:Open Sans,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif}
body{margin:0;line-height:inherit}
h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}
a{color:inherit;text-decoration:inherit}
button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}
button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button;background-color:initial;background-image:none}
blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}
menu,ol,ul{list-style:none;margin:0;padding:0}
input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}
button,[role=button]{cursor:pointer}
img,video{max-width:100%;height:auto}

/* Global variable resets for sharp design */
*, ::before, ::after {
  border-radius: 0 !important;
  box-shadow: none !important;
}

/* =================================================================== */
/* 2. Design Tokens (Light & Dark Mode)
/* =================================================================== */
:root {
  --joy-bg: #ffffff;
  --joy-surface: #f9fafb;
  --joy-text: #111827;
  --joy-muted: #6b7280;
  --joy-accent: #3b82f6;
  --joy-divider: #e5e7eb;
  --joy-input-bg: #ffffff;
  --joy-input-border: #d1d5db;
  --success: #10b981;
  --wait: #f59e0b;
  --error: #ef4444;
}

@media (prefers-color-scheme: dark) {
  :root {
    --joy-bg: #000000;
    --joy-surface: #111827;
    --joy-text: #e5e7eb;
    --joy-muted: #9ca3af;
    --joy-divider: rgba(255, 255, 255, .1);
    --joy-input-bg: #111827;
    --joy-input-border: #374151;
  }
}

body {
  font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--joy-bg);
  color: var(--joy-text);
  margin: 0;
  padding-top: 80px;
}

.sharp-text {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* =================================================================== */
/* 3. Header
/* =================================================================== */
.joy-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background: var(--joy-bg);
  border-bottom: 1px solid var(--joy-divider);
  z-index: 50;
  padding: 0 2rem;
}
.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
  height: 64px;
}
.logo-link {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--joy-text);
  font-weight: 600;
}
.logo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  width: 24px;
  height: 24px;
}
.square { background-color: #5A5ACB; }
.square1 { opacity: 0.25; }
.square2 { opacity: 0.5; }
.square3 { opacity: 0.75; }
.square4 { opacity: 1; }
.header-nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.header-nav a {
  text-decoration: none;
  color: var(--joy-muted);
  font-size: 0.875rem;
  transition: color 0.2s ease;
}
.header-nav a:hover {
  color: var(--joy-text);
}
.header-nav a.btn-signup {
  background: var(--joy-accent);
  color: white;
  padding: 8px 16px;
  font-weight: 600;
}
.header-nav a.btn-signup:hover {
  background: #2563eb;
  color: white;
}

/* =================================================================== */
/* 4. Hero Section
/* =================================================================== */
.hero-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 4rem 2rem;
}
.hero-content h1 {
  font-size: 2.5rem;
  font-weight: 800;
  margin: 0;
  color: var(--joy-text);
}
.hero-content .lead {
  font-size: 1.5rem;
  color: var(--joy-accent);
  margin: 0.5rem 0;
}
.hero-content .arrow {
  transition: transform 0.2s;
  display: inline-block;
}
.hero-content .lead:hover .arrow {
  transform: translateX(5px);
}
.hero-content .sub-lead {
  font-size: 1.1rem;
  color: var(--joy-muted);
  max-width: 600px;
  margin: 1rem 0;
}
.kicker {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}
.chip {
  font-size: 12px;
  padding: 6px 12px;
  border: 1px solid var(--joy-divider);
  background: var(--joy-surface);
  color: var(--joy-muted);
}

/* =================================================================== */
/* 5. Proxy Builder Specific Styles
/* =================================================================== */
.container {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  max-width: 1200px;
  margin: 24px auto;
  padding: 0 2rem;
}
.left, .right {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 300px;
}
.left { flex-grow: 1.2; }

.card {
  background: var(--joy-surface);
  border: 1px solid var(--joy-divider);
  padding: 24px;
}
.card h3 {
  margin: 0 0 6px 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--joy-text);
}
.card p.muted {
  font-size: 0.875rem;
  margin: 0 0 16px 0;
  color: var(--joy-muted);
}
.divider {
  height: 1px;
  background: var(--joy-divider);
  margin: 24px 0;
  border: none;
}
.form-row { display: flex; gap: 16px; flex-wrap: wrap; }
.form-field { flex: 1; min-width: 150px; margin-bottom: 16px; }
.form-field-half { max-width: 50%; }

label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--joy-muted);
}

/* UNIFIED INPUT STYLE */
input[type="text"],
input[type="password"] {
  background-color: transparent;
  border: none;
  border-bottom: 1px solid var(--joy-input-border);
  width: 100%;
  padding: 10px 4px;
  font-size: 0.875rem;
  color: var(--joy-text);
  transition: border-color 0.2s ease;
}
input[type="text"]:focus,
input[type="password"]:focus {
  outline: none;
  border-bottom-color: var(--joy-accent);
}

button#buildBtn {
  width: 100%;
  padding: 12px;
  background: var(--joy-accent);
  color: white;
  border: none;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 16px;
  transition: background-color .2s;
}
button#buildBtn:hover { background: #2563eb; }

label.inline { display: flex; align-items: center; gap: 8px; font-size: 13px; user-select: none; color: var(--joy-muted); }
input[type="checkbox"] { accent-color: var(--joy-accent); }

.mono { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace; }

.status-line { display: flex; justify-content: space-between; align-items: center; font-size: 14px; padding: 6px 0; color: var(--joy-muted); }
.status-line span { color: var(--joy-text); }
.badge {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  background: var(--joy-divider);
  color: var(--joy-muted);
}
#statusBadge.success { background: var(--success); color: white; }
#statusBadge.wait { background: var(--wait); color: white; }
#statusBadge.error { background: var(--error); color: white; }

.timeline-item { font-size: 13px; color: var(--joy-muted); }
.timeline-dot { background: var(--joy-divider); }
.timeline-dot.active { background: var(--joy-accent); }
.timeline-dot.success { background: var(--success); }

.log-output {
  background: var(--joy-bg);
  border: 1px solid var(--joy-divider);
  color: var(--joy-muted);
  font-family: monospace;
  font-size: 12px;
  white-space: pre-wrap;
  padding: 12px;
  height: 200px;
  overflow-y: auto; 
}

.public-item {
  background: var(--joy-bg);
  border: 1px solid var(--joy-divider);
  color: var(--joy-muted);
}

/* =================================================================== */
/* 7. Scrollbar Styling
/* =================================================================== */

/* For Firefox */
.log-output {
  scrollbar-width: thin;
  scrollbar-color: var(--joy-muted) var(--joy-bg);
}

/* For Webkit Browsers (Chrome, Safari, Edge) */
.log-output::-webkit-scrollbar {
  width: 8px;
}

.log-output::-webkit-scrollbar-track {
  background: var(--joy-bg);
}

.log-output::-webkit-scrollbar-thumb {
  background-color: var(--joy-muted);
  border: 2px solid var(--joy-bg);
}

.log-output::-webkit-scrollbar-thumb:hover {
  background-color: var(--joy-text);
}