:root {
  --bg: #090b0f;
  --surface: #10131a;
  --surface-2: #151922;
  --surface-3: #1a1f29;
  --border: #272d38;
  --border-hover: #3a4352;
  --text: #f3f5f8;
  --muted: #9aa3b2;
  --muted-2: #697384;
  --accent: #f4f6f8;
  --accent-text: #0b0d12;
  --danger: #ff7b86;
  --success: #7ee2aa;
  --shadow: 0 24px 80px rgba(0,0,0,.34);
  --radius: 18px;
  --max: 920px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 50% -10%, rgba(255,255,255,.055), transparent 38%),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button, textarea { font: inherit; }

button { -webkit-tap-highlight-color: transparent; }

.app-shell {
  width: min(100%, 1180px);
  margin: 0 auto;
  padding: 0 28px;
}

.site-header {
  height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  color: var(--text);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 750;
  letter-spacing: -.02em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border-hover);
  border-radius: 9px;
  background: linear-gradient(145deg, #fff, #cdd2d9);
  color: #11151b;
  font-size: 14px;
  font-weight: 900;
}

.privacy-badge {
  color: var(--muted);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 12px rgba(126,226,170,.5);
}

.hero {
  width: min(100%, var(--max));
  margin: 70px auto 34px;
  text-align: center;
}

.eyebrow {
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
  margin-bottom: 15px;
}

.hero h1 {
  margin: 0;
  font-size: clamp(36px, 6vw, 62px);
  line-height: .98;
  letter-spacing: -.055em;
  font-weight: 780;
}

.hero h1 span {
  color: var(--muted);
  font-weight: 500;
}

.hero p {
  max-width: 640px;
  margin: 20px auto 0;
  color: var(--muted);
  font-size: 15px;
}

.tool-card {
  width: min(100%, var(--max));
  margin: 0 auto;
  background: rgba(16,19,26,.88);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  backdrop-filter: blur(14px);
}

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 6px;
  background: #0d1016;
  border-bottom: 1px solid var(--border);
  gap: 5px;
}

.mode-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 12px;
  padding: 13px 16px;
  cursor: pointer;
  text-align: left;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}

.mode-btn:hover { color: var(--text); }

.mode-btn.active {
  background: var(--surface-2);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--border);
}

.mode-btn span {
  display: block;
  font-size: 14px;
  font-weight: 750;
}

.mode-btn small {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted-2);
}

.mode-btn.active small { color: var(--muted); }

.tool-panel { padding: 28px; }

.input-heading, .result-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
}

.input-heading label, .result-heading label {
  font-size: 13px;
  font-weight: 700;
}

.input-heading span, .output-meta, .result-status {
  color: var(--muted-2);
  font-size: 11px;
}

.textarea-wrap, .output-wrap {
  position: relative;
}

textarea {
  display: block;
  width: 100%;
  resize: vertical;
  outline: none;
  color: var(--text);
  background: #0b0e13;
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 17px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.65;
  transition: border-color .18s ease, box-shadow .18s ease;
}

textarea::placeholder { color: #4f5867; }

textarea:focus {
  border-color: #596373;
  box-shadow: 0 0 0 3px rgba(255,255,255,.045);
}

#inputText { min-height: 185px; padding-bottom: 38px; }

#outputText {
  min-height: 155px;
  background: #0c0f14;
}

.char-count {
  position: absolute;
  right: 13px;
  bottom: 11px;
  color: var(--muted-2);
  font-size: 10px;
  pointer-events: none;
}

.error-message {
  min-height: 18px;
  margin: 7px 2px 0;
  color: var(--danger);
  font-size: 12px;
}

.action-row {
  display: flex;
  gap: 9px;
  margin: 7px 0 28px;
}

.primary-btn, .secondary-btn, .icon-btn {
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
  transition: transform .15s ease, opacity .15s ease, background .15s ease, border-color .15s ease;
}

.primary-btn {
  flex: 1;
  min-height: 46px;
  background: var(--accent);
  color: var(--accent-text);
  padding: 0 18px;
}

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

.primary-btn:active:not(:disabled) { transform: translateY(0); }

.btn-icon { margin-right: 5px; }

.secondary-btn {
  min-width: 88px;
  background: var(--surface-3);
  border-color: var(--border);
  color: var(--muted);
  padding: 0 18px;
}

.secondary-btn:hover { color: var(--text); border-color: var(--border-hover); }

.result-section {
  border-top: 1px solid var(--border);
  padding-top: 25px;
}

.result-heading > div:first-child {
  display: flex;
  align-items: center;
  gap: 9px;
}

.result-status {
  border: 1px solid var(--border);
  padding: 2px 7px;
  border-radius: 999px;
}

.result-status.success {
  color: var(--success);
  border-color: rgba(126,226,170,.2);
}

.result-status.error {
  color: var(--danger);
  border-color: rgba(255,123,134,.2);
}

.result-actions {
  display: flex;
  gap: 6px;
}

.icon-btn {
  padding: 7px 10px;
  background: var(--surface-3);
  border-color: var(--border);
  color: var(--muted);
  font-size: 11px;
}

.icon-btn:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--border-hover);
}

button:disabled {
  cursor: not-allowed;
  opacity: .4;
}

.output-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
}

.info-grid {
  width: min(100%, var(--max));
  margin: 28px auto 0;
  display: grid;
  grid-template-columns: .9fr 1.1fr;
  gap: 14px;
}

.info-card {
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: rgba(16,19,26,.6);
}

.info-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-bottom: 15px;
  border: 1px solid var(--border-hover);
  border-radius: 8px;
  color: var(--muted);
  font: 700 10px/1 monospace;
}

.info-card h2 {
  margin: 0 0 12px;
  font-size: 15px;
  letter-spacing: -.02em;
}

.info-card ol {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 12px;
}

.info-card li { margin: 8px 0; }
.info-card strong { color: var(--text); }

details {
  border-top: 1px solid var(--border);
  padding: 11px 0;
}

details:first-of-type { border-top: 0; }

summary {
  cursor: pointer;
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
  list-style-position: outside;
}

details p {
  color: var(--muted);
  font-size: 12px;
  margin: 8px 0 1px;
  line-height: 1.65;
}

.site-footer {
  width: min(100%, var(--max));
  margin: 42px auto 28px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
  color: var(--muted-2);
  font-size: 11px;
}

.site-footer a {
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
}

.site-footer a:hover { text-decoration: underline; }
.footer-separator { opacity: .5; }

@media (max-width: 700px) {
  .app-shell { padding: 0 15px; }
  .site-header { height: 68px; }
  .hero { margin-top: 48px; margin-bottom: 25px; }
  .hero p { font-size: 13px; }
  .tool-panel { padding: 20px; }
  .info-grid { grid-template-columns: 1fr; }
  #inputText { min-height: 160px; }
  #outputText { min-height: 140px; }
}

@media (max-width: 480px) {
  .privacy-badge { display: none; }
  .hero h1 { font-size: 39px; }
  .mode-btn { padding: 11px 12px; }
  .mode-btn small { font-size: 10px; }
  .action-row { flex-direction: column; }
  .secondary-btn { min-height: 43px; }
  .result-heading { align-items: flex-start; }
  .result-heading, .output-meta { flex-wrap: wrap; }
  .site-footer { flex-wrap: wrap; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
