:root {
  --bg: #070912;
  --bg-2: #0d1320;
  --panel: rgba(12, 18, 32, 0.72);
  --panel-2: rgba(10, 17, 28, 0.92);
  --line: rgba(80, 234, 255, 0.22);
  --line-strong: rgba(255, 48, 167, 0.35);
  --text: #e9f7ff;
  --muted: #9fb7c9;
  --cyan: #4ef2ff;
  --pink: #ff3eb5;
  --purple: #9b6dff;
  --green: #6cff9e;
  --warning: #ffd166;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  --radius: 22px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Inter, Arial, Helvetica, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(78, 242, 255, 0.08), transparent 30%),
    radial-gradient(circle at top right, rgba(255, 62, 181, 0.08), transparent 30%),
    linear-gradient(180deg, #05070c 0%, #08111d 45%, #05070c 100%);
  min-height: 100vh;
  overflow-x: hidden;
}

.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(78, 242, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(78, 242, 255, 0.06) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, rgba(0,0,0,0.85), rgba(0,0,0,0.25));
  z-index: 0;
}

.bg-orb {
  position: fixed;
  width: 320px;
  height: 320px;
  filter: blur(60px);
  opacity: 0.16;
  pointer-events: none;
  z-index: 0;
}

.orb-a {
  top: 5%;
  left: -80px;
  background: var(--cyan);
}

.orb-b {
  right: -100px;
  top: 25%;
  background: var(--pink);
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 24px));
  margin: 0 auto;
  padding: 24px 0 64px;
}

.panel {
  background: linear-gradient(180deg, rgba(16, 24, 39, 0.88), rgba(9, 14, 25, 0.88));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.hero,
.input-panel,
.result-panel,
.history-panel,
.about-panel,
.faq-panel,
.info-grid .panel {
  padding: 24px;
}

.brand-line {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}

.brand-pill,
.brand-category {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.88rem;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.02);
}

.hero h1 {
  margin: 0 0 12px;
  line-height: 1.04;
  font-size: clamp(2rem, 6vw, 4.25rem);
  letter-spacing: -0.04em;
}

.hero h1 span {
  color: var(--cyan);
  text-shadow: 0 0 18px rgba(78, 242, 255, 0.45);
}

.hero-text {
  margin: 0;
  max-width: 900px;
  color: var(--muted);
  font-size: 1.02rem;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

.hero-badge {
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--text);
  background: linear-gradient(90deg, rgba(78, 242, 255, 0.08), rgba(255, 62, 181, 0.08));
  font-size: 0.92rem;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.panel-head h2 {
  margin: 0 0 6px;
  font-size: 1.28rem;
}

.panel-head p,
.panel-mini-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.input-panel {
  margin-top: 20px;
}

.field-label {
  display: block;
  margin-bottom: 10px;
  color: var(--text);
  font-weight: 600;
}

textarea {
  width: 100%;
  border: 1px solid rgba(78, 242, 255, 0.22);
  border-radius: 18px;
  background: rgba(3, 7, 15, 0.8);
  color: var(--text);
  padding: 18px;
  resize: vertical;
  min-height: 120px;
  font-size: 1.06rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

textarea:focus {
  border-color: rgba(78, 242, 255, 0.6);
  box-shadow: 0 0 0 4px rgba(78, 242, 255, 0.09);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 14px;
}

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 13px 18px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.2s ease;
  color: var(--text);
  background: rgba(255,255,255,0.04);
}

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

.btn-primary {
  background: linear-gradient(90deg, var(--cyan), var(--purple));
  color: #031018;
  box-shadow: 0 10px 24px rgba(78, 242, 255, 0.22);
}

.btn-secondary {
  background: rgba(255,255,255,0.06);
  border-color: rgba(78, 242, 255, 0.18);
}

.btn-ghost {
  background: transparent;
  border-color: rgba(255,255,255,0.12);
}

.small-btn {
  padding: 10px 14px;
  font-size: 0.92rem;
}

.examples-wrap,
.keypad-wrap {
  margin-top: 18px;
}

.small-title {
  color: var(--muted);
  font-size: 0.92rem;
  margin-bottom: 10px;
}

.example-chips,
.keypad {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chip,
.key {
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  color: var(--text);
  cursor: pointer;
  transition: 0.2s ease;
}

.chip {
  padding: 10px 14px;
}

.key {
  min-width: 48px;
  padding: 12px 14px;
  font-weight: 700;
}

.chip:hover,
.key:hover,
.tab-btn:hover,
.faq-question:hover {
  border-color: rgba(78, 242, 255, 0.35);
  box-shadow: 0 0 0 3px rgba(78, 242, 255, 0.06);
}

.helper-note {
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.95rem;
}

.dashboard-grid {
  margin-top: 20px;
  display: grid;
  grid-template-columns: 1.65fr 0.85fr;
  gap: 20px;
}

.status-message {
  font-size: 0.92rem;
  color: var(--cyan);
  border: 1px solid rgba(78, 242, 255, 0.14);
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(78, 242, 255, 0.06);
  white-space: nowrap;
}

.tab-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.tab-btn {
  appearance: none;
  border: 1px solid rgba(255,255,255,0.09);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  border-radius: 12px;
  padding: 11px 14px;
  cursor: pointer;
  font-weight: 700;
  transition: 0.2s ease;
}

.tab-btn.active {
  background: linear-gradient(90deg, rgba(78, 242, 255, 0.16), rgba(255, 62, 181, 0.14));
  border-color: rgba(78, 242, 255, 0.34);
  color: var(--cyan);
}

.result-card {
  border: 1px solid rgba(255,255,255,0.08);
  background: radial-gradient(circle at top left, rgba(78, 242, 255, 0.08), transparent 45%), rgba(4, 8, 16, 0.75);
  border-radius: 18px;
  padding: 18px;
}

.result-label {
  color: var(--muted);
  font-size: 0.92rem;
  margin-bottom: 10px;
}

.result-expression {
  min-height: 84px;
  display: flex;
  align-items: center;
  font-size: clamp(1.15rem, 3vw, 1.7rem);
  line-height: 1.35;
  font-weight: 800;
  color: var(--green);
  word-break: break-word;
  text-shadow: 0 0 14px rgba(108, 255, 158, 0.16);
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 16px;
}

.meta-card {
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 16px;
  background: rgba(255,255,255,0.03);
}

.meta-title {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 7px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-item,
.history-empty {
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 14px;
  background: rgba(255,255,255,0.03);
}

.history-item {
  cursor: pointer;
  transition: 0.2s ease;
}

.history-item:hover {
  border-color: rgba(255, 62, 181, 0.3);
  transform: translateY(-1px);
}

.history-expression {
  font-weight: 700;
  margin-bottom: 8px;
  word-break: break-word;
}

.history-meta {
  color: var(--muted);
  font-size: 0.88rem;
}

.info-grid {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.steps-list,
.errors-list {
  padding-left: 22px;
  margin: 0;
}

.steps-list li,
.errors-list li {
  margin-bottom: 12px;
  line-height: 1.65;
  color: var(--text);
}

.steps-list code {
  background: rgba(255,255,255,0.06);
  border-radius: 8px;
  padding: 2px 6px;
  color: var(--cyan);
}

.errors-list li::marker {
  color: var(--warning);
}

.about-content p {
  color: var(--muted);
  line-height: 1.78;
}

.about-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin: 18px 0;
}

.about-box {
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 18px;
  padding: 18px;
  background: rgba(255,255,255,0.03);
}

.about-box h3 {
  margin: 0 0 10px;
  color: var(--cyan);
}

.about-box p {
  margin: 0;
}

.faq-list {
  display: grid;
  gap: 12px;
}

.faq-item {
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  overflow: hidden;
  background: rgba(255,255,255,0.03);
}

.faq-question {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  color: var(--text);
  font-weight: 700;
  padding: 18px;
  cursor: pointer;
  font-size: 1rem;
}

.faq-answer {
  display: none;
  padding: 0 18px 18px;
  color: var(--muted);
  line-height: 1.7;
}

.faq-item.open .faq-answer {
  display: block;
}

.loading {
  opacity: 0.75;
  pointer-events: none;
}

@media (max-width: 980px) {
  .dashboard-grid,
  .info-grid,
  .about-grid,
  .meta-grid {
    grid-template-columns: 1fr;
  }

  .status-message {
    white-space: normal;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 16px, 1180px);
    padding-top: 16px;
    padding-bottom: 34px;
  }

  .hero,
  .input-panel,
  .result-panel,
  .history-panel,
  .about-panel,
  .faq-panel,
  .info-grid .panel {
    padding: 18px;
  }

  .panel-head {
    flex-direction: column;
  }

  .form-actions,
  .result-actions,
  .tab-row,
  .hero-badges,
  .example-chips,
  .keypad {
    gap: 8px;
  }

  .btn,
  .tab-btn,
  .chip,
  .key {
    width: 100%;
  }

  .key {
    min-width: unset;
  }

  .result-expression {
    min-height: 70px;
  }
}