:root {
  --bg: #f4f8ff;
  --panel: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --accent: #2563eb;
  --accent-soft: #eff6ff;
  --accent-strong: #1d4ed8;
  --success: #0f9d68;
  --danger: #ef4444;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text);
  background: linear-gradient(135deg, #f8fbff 0%, #eef5ff 100%);
}

.page-shell {
  min-height: 100vh;
  padding: 32px 16px;
  display: grid;
  place-items: center;
}

.card {
  width: min(920px, 100%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 32px;
  box-shadow: 0 16px 50px rgba(37, 99, 235, 0.10);
}

.hero {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 26px;
  flex-wrap: wrap;
}

.result-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
}

.hero-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--accent-soft);
  font-size: 22px;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
}

h1 {
  margin: 0 0 8px;
  font-size: 28px;
  line-height: 1.2;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.form {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}

input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 13px 14px;
  font-size: 15px;
  color: var(--text);
  background: #fcfdff;
}

.input-with-icon {
  position: relative;
}

.input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  color: var(--muted);
  pointer-events: none;
}

.input-clear {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(37, 99, 235, 0.12);
  color: var(--accent-strong);
  font-size: 14px;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  line-height: 1;
  box-shadow: none;
}

.input-clear:hover {
  background: rgba(37, 99, 235, 0.20);
  transform: translateY(-50%);
}

.input-clear:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

.input-with-icon input {
  padding-left: 42px;
  padding-right: 48px;
}

input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

button {
  border: none;
  border-radius: 14px;
  padding: 13px 16px;
  font-weight: 700;
  cursor: pointer;
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.16);
}

button:disabled {
  opacity: 0.72;
  cursor: wait;
  transform: none;
  box-shadow: none;
}

.message {
  min-height: 24px;
  margin-top: 12px;
  font-size: 14px;
  color: var(--muted);
}

.message.success {
  color: var(--success);
}

.message.error {
  color: var(--danger);
}

.result-panel {
  margin-top: 18px;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  background: #fcfdff;
}

.result-panel.hidden {
  display: none;
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.result-header h2 {
  margin: 0;
  font-size: 18px;
}

.result-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.code-box {
  min-height: 72px;
  border-radius: 18px;
  padding: 16px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  background: #f8fafc;
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  display: grid;
  place-items: center;
}

.tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.tab-button {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 16px;
  background: white;
  color: var(--muted);
  cursor: pointer;
  min-width: 140px;
  text-align: center;
}

.tab-button.active {
  background: var(--accent-soft);
  color: var(--accent-strong);
  border-color: var(--accent-soft);
}

.content-panel {
  width: 100%;
  min-height: 180px;
  margin: 0;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-family: Consolas, Menlo, Monaco, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

.content-panel.hidden {
  display: none;
}

@media (max-width: 900px) {
  .page-shell {
    padding: 24px 14px;
  }
  .card {
    width: 100%;
    padding: 28px;
  }
}

@media (max-width: 720px) {
  .page-shell { padding: 20px 12px; }
  .card { padding: 22px; border-radius: 20px; }
  .hero { gap: 12px; }
  .hero-icon { width: 40px; height: 40px; font-size: 20px; }
  h1 { font-size: 24px; }
  .result-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .result-actions {
    justify-content: flex-start;
  }
  .code-box {
    font-size: 18px;
  }
  .tab-button {
    flex: 1 1 48%;
    min-width: 0;
  }
}
