:root {
  --brand: #6366f1;
  --brand-strong: #4f46e5;
  --surface: #ffffff;
  --surface-muted: rgba(255, 255, 255, 0.8);
  --ink: #0f172a;
  --ink-soft: #475569;
  --border: rgba(15, 23, 42, 0.12);
  --shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 10px;
  --transition: 200ms ease;
  --mark-bg: rgba(99, 102, 241, 0.22);
  --mark-border: rgba(79, 70, 229, 0.45);
  --badge-bg: rgba(99, 102, 241, 0.16);
  --ghost-border: rgba(99, 102, 241, 0.35);
  --chrome-surface: rgba(255, 255, 255, 0.92);
  --chrome-border: rgba(15, 23, 42, 0.12);
  --chrome-text: var(--ink);
  --chrome-link: var(--brand-strong);
  --chrome-muted: var(--ink-soft);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: linear-gradient(135deg, #f4f2ff 0%, #fef6ec 100%);
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.page-shell {
  width: min(1120px, 92%);
  margin: 56px auto 96px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.app-shell {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.global-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: 18px 26px;
  border-radius: var(--radius-lg);
  background: var(--chrome-surface);
  border: 1px solid var(--chrome-border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.global-header__brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  color: var(--chrome-text);
  text-decoration: none;
}

.global-header__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(59, 130, 246, 0.22));
  box-shadow: 0 18px 30px rgba(99, 102, 241, 0.18);
}

.global-header__nav {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.global-header__nav a {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  text-decoration: none;
  color: var(--chrome-link);
  transition: background var(--transition), transform var(--transition);
}

.global-header__nav a:hover,
.global-header__nav a:focus-visible {
  background: rgba(99, 102, 241, 0.18);
  transform: translateY(-1px);
  outline: none;
}

.global-header__actions {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.global-header__cta {
  display: inline-flex;
  align-items: center;
  padding: 10px 18px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.22), rgba(59, 130, 246, 0.28));
  color: var(--chrome-text);
  border: 1px solid rgba(99, 102, 241, 0.35);
  transition: transform var(--transition), box-shadow var(--transition);
  box-shadow: 0 18px 32px rgba(99, 102, 241, 0.16);
}

.global-header__cta:hover,
.global-header__cta:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 24px 38px rgba(99, 102, 241, 0.22);
  outline: none;
}

.hero {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
}

.hero-text h1 {
  font-size: clamp(2rem, 2.4vw, 2.75rem);
  letter-spacing: -0.03em;
  margin: 8px 0 12px;
}

.hero-text p {
  color: var(--ink-soft);
  line-height: 1.6;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--badge-bg);
  color: var(--brand-strong);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}

.hero-stats {
  display: grid;
  gap: 12px;
  align-content: start;
}

.metric {
  padding: 16px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(10px);
}

.metric-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  display: block;
  margin-bottom: 6px;
}

.metric-value {
  font-size: clamp(1.4rem, 2vw, 1.8rem);
  font-weight: 700;
}

.workspace {
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1.1fr);
}

.panel {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.panel-header h2 {
  margin: 0;
  font-size: 1.4rem;
}

.panel-subtitle {
  margin: 6px 0 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.editor {
  min-height: 340px;
  max-height: 540px;
  padding: 24px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-muted);
  overflow-y: auto;
  line-height: 1.7;
  font-size: 1rem;
  white-space: pre-wrap;
}

.editor:focus {
  outline: 2px solid rgba(99, 102, 241, 0.4);
  outline-offset: 2px;
}

.editor:empty::before {
  content: attr(data-placeholder);
  color: rgba(71, 85, 105, 0.6);
}

.editor mark {
  background: var(--mark-bg);
  border-bottom: 2px solid var(--mark-border);
  border-radius: 6px;
  padding: 2px 4px;
  color: inherit;
}

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

.field-label {
  font-weight: 600;
  color: var(--ink);
}

.field-hint {
  font-size: 0.85rem;
  color: var(--ink-soft);
}

input[type="text"],
select {
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  font-size: 1rem;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  transition: border-color var(--transition), box-shadow var(--transition);
}

input[type="text"]:focus,
select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.18);
}

.options-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  border-radius: var(--radius-md);
  padding: 18px 20px;
  border: 1px dashed rgba(99, 102, 241, 0.35);
}

.options-grid legend {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink-soft);
  padding: 0 4px 6px;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
  color: var(--ink);
}

.toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

.accent-actions {
  display: flex;
  gap: 12px;
}

.global-footer {
  width: 100%;
  background: var(--chrome-surface);
  border: 1px solid var(--chrome-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 24px 28px;
  display: grid;
  gap: 10px;
  text-align: center;
  color: var(--chrome-muted);
}

.global-footer__links {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
  font-weight: 600;
}

.global-footer__links a {
  color: var(--chrome-link);
  text-decoration: none;
}

.global-footer__links a:hover,
.global-footer__links a:focus-visible {
  text-decoration: underline;
  outline: none;
}

.global-footer__note,
.global-footer__love,
.global-footer__copy {
  margin: 0;
}

.global-footer__love {
  font-weight: 600;
  color: var(--chrome-text);
}

button {
  border: none;
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  font-size: 0.95rem;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
}

.primary {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-strong) 100%);
  color: #fff;
  box-shadow: 0 12px 24px rgba(99, 102, 241, 0.22);
}

.primary:hover {
  transform: translateY(-1px);
}

.ghost {
  background: transparent;
  border: 1px solid var(--ghost-border);
  color: var(--brand-strong);
}

.ghost:hover {
  background: rgba(99, 102, 241, 0.08);
}

.link-button {
  background: none;
  color: var(--brand-strong);
  padding: 0;
}

.link-button:hover {
  text-decoration: underline;
}

.controls-panel {
  gap: 22px;
}

.history header,
.pro-tips h3 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 0 10px;
  font-size: 1rem;
}

.history-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.history-chips button {
  border-radius: 999px;
  padding: 8px 14px;
  border: 1px solid rgba(99, 102, 241, 0.3);
  background: rgba(255, 255, 255, 0.6);
  font-size: 0.9rem;
  color: var(--ink);
}

.history-chips button:hover {
  background: rgba(99, 102, 241, 0.08);
}

.pro-tips ul {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 10px;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.results-panel .table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 420px;
}

thead th {
  text-align: left;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

tbody td {
  padding: 14px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
  font-size: 0.95rem;
  vertical-align: middle;
}

tbody tr:last-child td {
  border-bottom: none;
}

.share-cell {
  width: 160px;
}

.share-bar {
  position: relative;
  border-radius: 999px;
  height: 10px;
  background: rgba(99, 102, 241, 0.12);
  overflow: hidden;
}

.share-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-strong) 100%);
}

.share-label {
  display: inline-block;
  margin-left: 10px;
  color: var(--ink-soft);
  font-size: 0.85rem;
}

.empty-state td {
  text-align: center;
  color: var(--ink-soft);
  padding: 40px 16px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%) translateY(100px);
  background: #0f172a;
  color: #fff;
  padding: 14px 22px;
  border-radius: 999px;
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.3);
  opacity: 0;
  transition: transform var(--transition), opacity var(--transition);
  pointer-events: none;
  font-size: 0.95rem;
}

.toast.is-visible {
  transform: translateX(-50%) translateY(0);
  opacity: 0.95;
}

@media (max-width: 1024px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .hero {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .app-shell {
    margin: 36px auto 72px;
    gap: 24px;
  }

  .panel,
  .hero {
    padding: 22px;
  }

  .hero-actions,
  .accent-actions {
    flex-direction: column;
    align-items: stretch;
  }

  button {
    width: 100%;
  }

  .metric {
    padding: 14px 16px;
  }
}

@media (max-width: 520px) {
  .panel-header {
    flex-direction: column;
    align-items: stretch;
  }

  .panel-actions {
    justify-content: flex-start;
  }
}
