:root {
  --bg: #07111f;
  --panel-line: rgba(255, 255, 255, 0.08);
  --text-dark: #10223d;
  --text-main: #f4f8ff;
  --text-soft: #aebdd7;
  --text-muted: #64748b;
  --primary: #0c7df2;
  --primary-strong: #0669cb;
  --accent: #16c7a1;
  --accent-soft: rgba(22, 199, 161, 0.14);
  --danger: #d84c63;
  --warning: #f6b84c;
  --success: #0b7b63;
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.28);
  --shadow-soft: 0 20px 44px rgba(16, 34, 61, 0.08);
  --radius-xl: 32px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Noto Sans TC", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(59, 184, 255, 0.18), transparent 32%),
    radial-gradient(circle at bottom right, rgba(32, 214, 161, 0.14), transparent 26%),
    linear-gradient(135deg, #04101d 0%, #0b1730 44%, #0e1f34 100%);
  color: var(--text-main);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.25), transparent 70%);
  pointer-events: none;
}

body.modal-open {
  overflow: hidden;
}

.page-shell {
  min-height: 100vh;
  padding: 28px;
}

.auth-layout {
  display: grid;
  grid-template-columns: minmax(380px, 620px) minmax(420px, 1fr);
  gap: 28px;
  min-height: calc(100vh - 56px);
}

.auth-panel,
.insight-panel {
  position: relative;
  border: 1px solid var(--panel-line);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}

.auth-panel {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 22px;
  padding: 34px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(247, 250, 255, 0.95));
  color: var(--text-dark);
}

.auth-panel::after {
  content: "";
  position: absolute;
  inset: auto -8% -18% auto;
  width: 240px;
  height: 240px;
  background: radial-gradient(circle, rgba(12, 125, 242, 0.12), transparent 70%);
  pointer-events: none;
}

.panel-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 2px;
}

.lang-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  height: 44px;
  padding: 0 16px;
  border: 1px solid rgba(16, 34, 61, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: #1a5db4;
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1;
  white-space: nowrap;
  word-break: keep-all;
  writing-mode: horizontal-tb;
  text-orientation: mixed;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.lang-toggle:hover {
  transform: translateY(-1px);
  border-color: rgba(12, 125, 242, 0.28);
  background: #fff;
}

.brand-block {
  display: flex;
  gap: 18px;
  align-items: flex-start;
}

.logo-mark {
  position: relative;
  width: 62px;
  height: 62px;
  border-radius: 18px;
  background: linear-gradient(145deg, #10284b, #0a74df);
  overflow: hidden;
  box-shadow: 0 16px 32px rgba(12, 125, 242, 0.26);
  flex-shrink: 0;
}

.logo-grid,
.logo-wave {
  position: absolute;
  inset: 0;
}

.logo-grid::before,
.logo-grid::after,
.logo-wave::before {
  content: "";
  position: absolute;
}

.logo-grid::before {
  inset: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 14px;
}

.logo-grid::after {
  left: 17px;
  right: 17px;
  top: 20px;
  height: 1px;
  background: rgba(255, 255, 255, 0.2);
  box-shadow: 0 10px 0 rgba(255, 255, 255, 0.2);
}

.logo-wave::before {
  left: 14px;
  right: 12px;
  bottom: 18px;
  height: 18px;
  border-bottom: 3px solid rgba(255, 255, 255, 0.92);
  border-radius: 0 0 20px 20px;
  transform: skewX(-20deg);
}

.eyebrow,
.mini-label,
.mini-overline,
.setup-step-label {
  margin: 0 0 8px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.eyebrow,
.mini-overline {
  color: #2877d8;
}

.brand-block h1 {
  margin: 0;
  font-family: "Manrope", "Noto Sans TC", sans-serif;
  font-size: clamp(2rem, 2vw, 2.7rem);
  line-height: 1.12;
}

.trust-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 28px 0 24px;
}

.trust-strip span,
.chart-tags span,
.market-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
}

.trust-strip span {
  padding: 10px 14px;
  background: rgba(12, 125, 242, 0.08);
  color: #215286;
}

.auth-card {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 24px;
  padding: 28px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(9, 24, 44, 0.08);
  border-radius: 28px;
}

.card-header,
.form-meta,
.chart-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.card-header h2,
.chart-title-row h3,
.insight-header h2,
.modal-copy h3 {
  margin: 0;
  font-family: "Manrope", "Noto Sans TC", sans-serif;
}

.card-header h2 {
  font-size: 1.35rem;
}

.card-header p,
.field-hint,
.metric-note,
.insight-copy,
.assurance-strip p:last-child,
.support-copy,
.modal-copy p,
.result-copy,
.setup-step p:not(.setup-step-label):not(.helper-note) {
  margin: 6px 0 0;
  color: var(--text-muted);
  line-height: 1.65;
}

.mode-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 6px;
  border-radius: 20px;
  background: rgba(12, 125, 242, 0.08);
}

.mode-tab {
  border: 0;
  border-radius: 16px;
  padding: 13px 16px;
  background: transparent;
  color: #47617f;
  font-size: 0.98rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.mode-tab.is-active {
  background: #fff;
  color: var(--primary-strong);
  box-shadow: 0 8px 20px rgba(12, 125, 242, 0.12);
}

.demo-panel {
  border: 1px solid rgba(12, 125, 242, 0.1);
  border-radius: 18px;
  background: rgba(12, 125, 242, 0.04);
  padding: 16px 18px;
}

.demo-panel summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--text-dark);
}

.demo-panel[open] summary {
  margin-bottom: 12px;
}

.demo-panel-body p {
  margin: 0 0 10px;
  color: var(--text-muted);
}

.demo-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
  color: #38506e;
}

.demo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.demo-actions .secondary-button {
  width: auto;
}

.status-banner {
  padding: 13px 15px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  line-height: 1.55;
}

.status-banner.error {
  background: rgba(216, 76, 99, 0.12);
  color: #ac2844;
}

.status-banner.success {
  background: rgba(22, 199, 161, 0.13);
  color: var(--success);
}

.status-banner.warning {
  background: rgba(246, 184, 76, 0.16);
  color: #9c6107;
}

.auth-form,
.stack-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.grid-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.compact-grid {
  gap: 10px 20px;
}

.check-stack {
  display: grid;
  gap: 10px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-group label,
.metric-label,
.assurance-label,
.support-title {
  font-size: 0.94rem;
  font-weight: 700;
}

input[type="email"],
input[type="password"],
input[type="text"] {
  width: 100%;
  border: 1px solid rgba(16, 34, 61, 0.14);
  border-radius: 16px;
  background: #fff;
  color: var(--text-dark);
  padding: 16px 18px;
  font-size: 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

input[readonly] {
  background: #f7f9fd;
}

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

input::placeholder {
  color: #96a4b9;
}

input:focus {
  outline: none;
  border-color: rgba(12, 125, 242, 0.6);
  box-shadow: 0 0 0 4px rgba(12, 125, 242, 0.12);
}

.field-error {
  min-height: 1.2em;
  margin: 0;
  color: var(--danger);
  font-size: 0.86rem;
}

.caps-warning {
  min-height: 1.2em;
  margin: 0;
  color: #9c6107;
  font-size: 0.86rem;
}

.field-group.invalid input[type="email"],
.field-group.invalid input[type="password"],
.field-group.invalid input[type="text"] {
  border-color: rgba(216, 76, 99, 0.45);
  box-shadow: 0 0 0 4px rgba(216, 76, 99, 0.08);
  background: #fffafb;
}

.password-wrap {
  position: relative;
}

.password-wrap input {
  padding-right: 96px;
}

.ghost-toggle {
  position: absolute;
  top: 50%;
  right: 10px;
  min-width: 68px;
  transform: translateY(-50%);
  border: 0;
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(12, 125, 242, 0.08);
  color: #1958a6;
  font-weight: 700;
  cursor: pointer;
}

.password-strength {
  display: grid;
  gap: 8px;
}

.strength-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.85rem;
  color: #64748b;
}

.strength-track {
  height: 8px;
  border-radius: 999px;
  background: #e7eef8;
  overflow: hidden;
}

.strength-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: #d84c63;
  transition: width 0.2s ease, background 0.2s ease;
}

.password-strength[data-strength="1"] .strength-fill {
  width: 25%;
  background: #d84c63;
}

.password-strength[data-strength="2"] .strength-fill {
  width: 50%;
  background: #d9942f;
}

.password-strength[data-strength="3"] .strength-fill {
  width: 75%;
  background: #1f7fe3;
}

.password-strength[data-strength="4"] .strength-fill {
  width: 100%;
  background: #0b7b63;
}

.remember-me,
.check-row {
  display: inline-flex;
  align-items: flex-start;
  gap: 10px;
  color: #39506f;
}

.check-row {
  font-size: 0.94rem;
  font-weight: 500;
}

.check-row span {
  line-height: 1.5;
}

.button-link {
  border: 0;
  background: transparent;
  color: #236ac1;
  font: inherit;
  font-weight: 700;
  padding: 0;
  cursor: pointer;
}

.button-link:hover,
.legal-footer a:hover {
  text-decoration: underline;
}

.action-stack {
  display: grid;
  gap: 12px;
}

.button-row,
.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.primary-button,
.secondary-button,
.google-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  border: 0;
  border-radius: 16px;
  padding: 15px 18px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease,
    border-color 0.2s ease, opacity 0.2s ease;
}

.primary-button {
  background: linear-gradient(135deg, var(--primary), #1e90ff);
  color: #fff;
  box-shadow: 0 16px 28px rgba(12, 125, 242, 0.22);
}

.secondary-button,
.google-button {
  border: 1px solid rgba(16, 34, 61, 0.1);
  background: #fff;
  color: var(--text-dark);
}

.compact {
  width: auto;
  min-width: 160px;
}

.primary-button:hover,
.secondary-button:hover,
.google-button:hover,
.button-link:hover {
  transform: translateY(-1px);
}

.ghost-toggle:hover,
.ghost-toggle:focus-visible {
  transform: translateY(-50%);
  background: rgba(12, 125, 242, 0.14);
  box-shadow: 0 0 0 3px rgba(12, 125, 242, 0.12);
}

.primary-button:disabled,
.secondary-button:disabled,
.google-button:disabled,
.mode-tab:disabled,
.lang-toggle:disabled {
  opacity: 0.72;
  cursor: not-allowed;
  transform: none;
}

.ghost-toggle:disabled {
  opacity: 0.72;
  cursor: not-allowed;
  transform: translateY(-50%);
}

.divider {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #7b8ca4;
  font-size: 0.9rem;
}

.divider::before {
  content: "";
  position: absolute;
  inset: 50% 0 auto;
  height: 1px;
  background: rgba(16, 34, 61, 0.08);
}

.divider span {
  position: relative;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.84);
}

.google-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.google-glyph {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ea4335, #4285f4);
  color: #fff;
  font-weight: 800;
  font-family: "Manrope", sans-serif;
}

.support-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.support-card {
  padding: 18px;
  border-radius: 20px;
  border: 1px solid rgba(16, 34, 61, 0.08);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow-soft);
}

.support-title,
.support-copy {
  margin: 0;
}

.support-copy {
  margin-top: 10px;
}

.legal-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  padding-top: 8px;
}

.legal-footer a {
  color: #516783;
  text-decoration: none;
  font-size: 0.94rem;
}

.insight-panel {
  padding: 36px;
  background:
    radial-gradient(circle at top, rgba(32, 214, 161, 0.08), transparent 30%),
    linear-gradient(180deg, rgba(8, 19, 37, 0.88), rgba(6, 18, 35, 0.96));
}

.insight-surface {
  height: 100%;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 22px;
}

.insight-header h2 {
  font-size: clamp(2rem, 2.8vw, 3.2rem);
  line-height: 1.08;
  max-width: 13ch;
}

.mini-label {
  color: #56c0ff;
}

.insight-copy {
  max-width: 48ch;
  color: var(--text-soft);
}

.metric-grid,
.assurance-strip {
  display: grid;
  gap: 14px;
}

.metric-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.metric-card,
.chart-card,
.assurance-strip article {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 24px;
}

.metric-card {
  padding: 20px;
}

.metric-label {
  color: #9fc5f1;
}

.metric-value {
  margin: 12px 0 8px;
  font-family: "Manrope", sans-serif;
  font-size: 2rem;
  font-weight: 800;
}

.metric-note {
  color: #89a2c5;
}

.chart-card {
  padding: 22px;
}

.market-pill {
  padding: 9px 14px;
  background: rgba(22, 199, 161, 0.12);
  color: #88f3db;
}

.chart-visual {
  position: relative;
  margin-top: 18px;
  min-height: 320px;
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02)),
    rgba(1, 9, 19, 0.42);
  overflow: hidden;
}

.grid-lines {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 56px 56px;
  opacity: 0.7;
}

.chart-svg {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  min-height: 280px;
  display: block;
  padding: 26px 18px 18px;
}

.chart-tags {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  z-index: 2;
}

.chart-tags span {
  padding: 10px 14px;
  background: rgba(7, 17, 31, 0.66);
  color: #d9ecff;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.assurance-strip {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.assurance-strip article {
  padding: 18px;
}

.assurance-label {
  color: #dcedff;
}

.button-loader {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  order: -1;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.secondary-button .button-loader,
.google-button .button-loader {
  border-color: rgba(12, 125, 242, 0.2);
  border-top-color: currentColor;
}

.modal-shell {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 10, 19, 0.62);
  backdrop-filter: blur(10px);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
  border-radius: 28px;
  padding: 28px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--text-dark);
  box-shadow: var(--shadow);
}

.modal-card.wide {
  width: min(860px, 100%);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(16, 34, 61, 0.06);
  color: #365271;
  font-size: 0;
  cursor: pointer;
}

.modal-close::before {
  content: "\00d7";
  font-size: 1.45rem;
  line-height: 1;
}

.modal-copy {
  margin-bottom: 18px;
  padding-right: 36px;
}

.modal-copy h3 {
  font-size: 1.45rem;
}

.modal-result,
.result-card {
  display: grid;
  gap: 10px;
}

.result-card {
  padding: 18px;
  border-radius: 18px;
  background: rgba(12, 125, 242, 0.06);
  border: 1px solid rgba(12, 125, 242, 0.1);
}

.result-title {
  margin: 0;
  font-weight: 800;
}

.code-preview,
.status-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(12, 125, 242, 0.08);
  color: #22558a;
  font-weight: 700;
  line-height: 1.4;
}

.helper-note {
  margin: 0;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 0.92rem;
  line-height: 1.55;
}

.helper-note.info {
  background: rgba(12, 125, 242, 0.08);
  color: #235f9c;
}

.helper-note.success {
  background: rgba(22, 199, 161, 0.13);
  color: var(--success);
}

.helper-note.warning {
  background: rgba(246, 184, 76, 0.16);
  color: #9c6107;
}

.helper-note.error {
  background: rgba(216, 76, 99, 0.12);
  color: #ac2844;
}

.setup-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.setup-step {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid rgba(16, 34, 61, 0.08);
  background: rgba(247, 250, 255, 0.92);
}

.setup-step.complete {
  border-color: rgba(22, 199, 161, 0.28);
  background: linear-gradient(180deg, rgba(22, 199, 161, 0.1), rgba(22, 199, 161, 0.04));
}

.setup-step-label {
  margin-bottom: 0;
  color: #1d6cbc;
}

.modal-card .primary-button,
.modal-card .secondary-button {
  width: auto;
}

.hidden {
  display: none !important;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 1100px) {
  .auth-layout {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .insight-header h2 {
    max-width: none;
  }
}

@media (max-width: 980px) {
  .insight-panel {
    display: none;
  }

  .auth-layout {
    grid-template-columns: 1fr;
    min-height: auto;
  }
}

@media (max-width: 820px) {
  .support-grid,
  .setup-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .page-shell {
    padding: 14px;
  }

  .auth-panel,
  .insight-panel {
    border-radius: 24px;
    padding: 20px 18px;
  }

  .auth-panel {
    gap: 16px;
  }

  .auth-card {
    margin-top: 18px;
  }

  .auth-card,
  .chart-card,
  .metric-card,
  .assurance-strip article,
  .modal-card {
    padding-left: 20px;
    padding-right: 20px;
  }

  .brand-block,
  .card-header,
  .form-meta,
  .chart-title-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .mode-switch,
  .grid-two,
  .metric-grid,
  .assurance-strip {
    grid-template-columns: 1fr;
  }

  .brand-block h1 {
    font-size: 1.74rem;
  }

  .chart-visual {
    min-height: 260px;
  }

  .chart-tags {
    left: 16px;
    right: 16px;
  }

  .button-row,
  .inline-actions {
    flex-direction: column;
  }

  .compact {
    width: 100%;
  }

  .demo-actions {
    flex-direction: column;
  }

  .modal-shell {
    padding: 12px;
  }
}
