:root {
  color-scheme: dark;
  --bg: #030816;
  --surface: #0b1426;
  --surface-2: #111d33;
  --text: #edf4ff;
  --muted: #8da0bf;
  --accent: #4c7cff;
  --accent-2: #2f5fd2;
  --danger: #ff6b8a;
}

body.light {
  color-scheme: light;
  --bg: #f8f5ff;
  --surface: #ffffff;
  --surface-2: #f3ebff;
  --text: #241a3b;
  --muted: #7b6f93;
  --accent: #7c4dff;
  --accent-2: #5b3fe8;
  --danger: #dc2626;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", "SF Pro Display", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

body.light {
  background: #f8f5ff;
}

button,
input,
textarea {
  font: inherit;
}

.app-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px 20px 56px;
}

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
  padding: 8px 2px;
}

.hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
}

.hero h1 {
  margin: 0 0 8px;
  font-size: clamp(2rem, 3vw, 3rem);
  line-height: 1.07;
  letter-spacing: -0.03em;
}

.hero-copy {
  margin: 0;
  color: var(--muted);
  max-width: 720px;
  line-height: 1.7;
  font-size: 1.02rem;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 20px;
  align-items: start;
}

.lower-grid {
  grid-template-columns: minmax(0, 1fr) minmax(270px, 0.45fr);
  margin-top: 20px;
}

.card {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  padding: 22px;
  box-shadow: 0 20px 50px rgba(2, 8, 22, 0.28);
}

body.light .card {
  background: var(--surface);
  border-color: #e5e7eb;
  box-shadow: 0 14px 35px rgba(15, 23, 42, 0.05);
}

.card-header h2 {
  margin: 0 0 4px;
  font-size: 1.15rem;
}

.card-header p {
  margin: 0 0 16px;
  color: var(--muted);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.field span {
  color: var(--muted);
  font-size: 0.95rem;
}

.inline-row {
  display: flex;
  gap: 10px;
}

.inline-row input {
  flex: 1;
}

.hint {
  color: var(--muted);
  font-size: 0.82rem;
}

input,
textarea {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text);
  padding: 10px 12px;
}

body.light input,
body.light textarea {
  border-color: #dfe7f1;
}

textarea {
  resize: vertical;
}

.token-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

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

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

.preset-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.phone-controls {
  margin-bottom: 16px;
}

select {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text);
  padding: 10px 12px;
}

body.light select {
  border-color: #dfe7f1;
}

.token-btn,
.preset-btn,
.primary-btn,
.secondary-btn {
  border: none;
  border-radius: 999px;
  padding: 11px 15px;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease, box-shadow 120ms ease;
  font-weight: 600;
}

.token-btn:hover,
.preset-btn:hover,
.primary-btn:hover,
.secondary-btn:hover {
  transform: translateY(-1px);
}

.token-btn {
  background: var(--surface-2);
  color: var(--text);
}

.preset-btn {
  background: rgba(37, 99, 235, 0.12);
  color: var(--text);
}

.primary-btn {
  background: var(--accent);
  color: white;
  font-weight: 700;
  box-shadow: none;
}

.secondary-btn {
  background: var(--surface-2);
  color: var(--text);
  backdrop-filter: blur(10px);
}

.icon-btn {
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  padding: 0;
}

.piece-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 0 0;
}

.card-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 18px;
  padding-top: 6px;
}

.piece {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-2);
  border-radius: 14px;
  padding: 11px 12px;
}

.piece-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.piece-chip strong {
  color: var(--accent);
}

.remove-btn {
  border: none;
  background: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 1rem;
}

.regex-output {
  padding: 16px 18px;
  border-radius: 16px;
  background: var(--surface-2);
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 1.08rem;
  margin-bottom: 12px;
  word-break: break-word;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

body.light .regex-output {
  border-color: #e5e7eb;
}

.explanation {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.explanation-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 11px 12px;
  border-radius: 14px;
  background: var(--surface-2);
}

.explanation-badge {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #02111b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}

.match-result {
  min-height: 22px;
  margin-bottom: 10px;
  font-weight: 600;
}

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

.cheat-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface-2);
}

.cheat-symbol {
  min-width: 42px;
  text-align: center;
  font-family: "Cascadia Code", Consolas, monospace;
  font-weight: 700;
  color: var(--accent);
}

.highlighted-text {
  padding: 12px;
  border-radius: 14px;
  background: var(--surface-2);
  line-height: 1.6;
  min-height: 58px;
}

body.style-swiss {
  --bg: #f5f5f1;
  --surface: #ffffff;
  --surface-2: #f0f0eb;
  --text: #111111;
  --muted: #5c5c5c;
  --accent: #0f172a;
  --accent-2: #4b5563;
  --danger: #b91c1c;
  font-family: "Inter", "Helvetica Neue", Arial, sans-serif;
}

body.style-swiss .card {
  border-radius: 16px;
  border-color: #e5e7eb;
  box-shadow: none;
}

body.style-editorial {
  --bg: #f7f2e8;
  --surface: #fcfaf7;
  --surface-2: #efe6d8;
  --text: #1d1a16;
  --muted: #746a5d;
  --accent: #8b5e3c;
  --accent-2: #4a3d2d;
  --danger: #92400e;
  font-family: "Iowan Old Style", "Palatino Linotype", serif;
}

body.style-editorial .hero h1,
body.style-editorial .card-header h2 {
  font-family: "Iowan Old Style", "Palatino Linotype", serif;
  letter-spacing: -0.02em;
}

body.style-editorial .card {
  border-radius: 22px;
  box-shadow: 0 10px 30px rgba(29, 26, 22, 0.06);
}

body.style-luxury {
  font-family: "Avenir Next", "Segoe UI", sans-serif;
}

body.style-luxury .hero {
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

body.style-luxury .card {
  border-radius: 24px;
  box-shadow: 0 14px 38px rgba(2, 8, 22, 0.28);
  border-color: rgba(255, 255, 255, 0.06);
}

body.light.style-luxury .hero {
  border-bottom-color: rgba(15, 23, 42, 0.08);
}

body.light.style-luxury .card {
  box-shadow: 0 14px 35px rgba(15, 23, 42, 0.05);
  border-color: #e5e7eb;
}

body.style-tech {
  --bg: #07111f;
  --surface: #0d1726;
  --surface-2: #111c30;
  --text: #f4f7fb;
  --muted: #7b8aa1;
  --accent: #4cc9f0;
  --accent-2: #3a86ff;
  --danger: #ff6b6b;
  font-family: "Inter", "Segoe UI", sans-serif;
}

body.style-tech .hero h1,
body.style-tech .card-header h2 {
  letter-spacing: -0.03em;
}

body.style-tech .card {
  border: 1px solid rgba(76, 201, 240, 0.16);
  box-shadow: 0 16px 40px rgba(5, 10, 20, 0.28);
}


mark {
  background: rgba(79, 209, 197, 0.32);
  color: var(--text);
  padding: 0 2px;
  border-radius: 4px;
}

@media (max-width: 800px) {
  .app-shell {
    padding: 20px 16px 40px;
  }

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

  .hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-actions {
    width: 100%;
  }

  .inline-row {
    flex-direction: column;
  }

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

  .cheat-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .hero h1 {
    font-size: 1.75rem;
  }

  .card {
    padding: 18px;
  }

  .token-btn,
  .preset-btn,
  .primary-btn,
  .secondary-btn {
    width: 100%;
    justify-content: center;
  }

  .hero-actions {
    flex-wrap: wrap;
  }

  .icon-btn {
    width: 40px;
    height: 40px;
  }
}
