:root {
  --bg-1: #0f1226;
  --bg-2: #1b2150;
  --accent: #7c8cff;
  --accent-2: #34e0c0;
  --card: rgba(255, 255, 255, 0.06);
  --card-border: rgba(255, 255, 255, 0.12);
  --text: #eef0fb;
  --text-dim: #a8aed1;
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 20%, rgba(124, 140, 255, 0.25), transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(52, 224, 192, 0.18), transparent 45%),
    linear-gradient(160deg, var(--bg-1), var(--bg-2));
  min-height: 100vh;
}

p {
  margin-top: 14px;
}

a {
  color: inherit;
}

.page {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  padding: 28px 16px 40px;
}

.app {
  width: 100%;
  max-width: 920px;
}

.topbar {
  width: 100%;
  max-width: 920px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.brand .mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 800;
  color: #0f1226;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  box-shadow: 0 6px 18px -6px rgba(124, 140, 255, 0.7);
}

.brand .name {
  background: linear-gradient(120deg, #ffffff, var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.backlink {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dim);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.04);
  transition: color .18s ease, border-color .18s ease, background .18s ease;
}

.backlink:hover {
  color: var(--text);
  border-color: var(--accent);
  background: rgba(124, 140, 255, 0.12);
}

.clear-row {
  display: flex;
  justify-content: center;
  margin-top: 24px;
}

.pill-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dim);
  cursor: pointer;
  padding: 10px 26px;
  border-radius: 999px;
  border: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.05);
  transition: color .18s ease, background .25s ease, box-shadow .25s ease, border-color .18s ease;
}

.pill-button .icon {
  font-size: 15px;
  line-height: 1;
  transition: transform .35s ease;
}

.pill-button:hover {
  color: #0f1226;
  border-color: transparent;
  background: linear-gradient(120deg, var(--accent-2), var(--accent));
  box-shadow: 0 6px 18px -6px rgba(124, 140, 255, 0.7);
}

.pill-button:hover .icon {
  transform: rotate(-75deg);
}

.pill-button:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}

.header {
  text-align: center;
  margin-bottom: 28px;
}

.header h1 {
  font-size: clamp(28px, 4vw, 38px);
  font-weight: 800;
  margin: 0 0 8px;
  letter-spacing: -0.02em;
  background: linear-gradient(120deg, #ffffff, var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.header p {
  margin: 0 auto;
  max-width: 560px;
  color: var(--text-dim);
  font-size: 15px;
  line-height: 1.5;
  margin-top: 14px;
}

.eyebrow {
  display: inline-block;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-2);
  background: rgba(52, 224, 192, 0.12);
  border: 1px solid rgba(52, 224, 192, 0.28);
  border-radius: 999px;
  padding: 5px 14px;
  margin-bottom: 14px;
}

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.5);
  padding: 28px;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

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

.field {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 18px 20px;
}

.field label.title {
  display: block;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.number-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

input[inputmode="decimal"] {
  flex: 1;
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  color: var(--text);
  font-family: inherit;
  font-size: 20px;
  font-weight: 600;
  padding: 12px 14px;
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

input[inputmode="decimal"]::placeholder {
  color: var(--text-dim);
  font-weight: 400;
}

input[inputmode="decimal"]:focus {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 4px rgba(124, 140, 255, 0.18);
}

.pillgroup {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--card-border);
  border-radius: 999px;
  padding: 4px;
  gap: 4px;
}

.pillgroup input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.pillgroup label {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dim);
  border-radius: 999px;
  cursor: pointer;
  transition: color .18s ease, background .25s ease, box-shadow .25s ease;
  user-select: none;
}

.pillgroup input:checked + label {
  color: #0f1226;
  background: linear-gradient(120deg, var(--accent-2), var(--accent));
  box-shadow: 0 6px 18px -6px rgba(124, 140, 255, 0.7);
}

.pillgroup input:focus-visible + label {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}

.subrow {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.subrow .sublabel {
  font-size: 13px;
  color: var(--text-dim);
}

.results {
  margin-top: 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

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

.result-card {
  border-radius: 16px;
  padding: 18px 20px;
  background: linear-gradient(135deg, rgba(124, 140, 255, 0.16), rgba(52, 224, 192, 0.10));
  border: 1px solid rgba(255, 255, 255, 0.14);
  position: relative;
  overflow: hidden;
}

.result-card .label {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.result-card .value {
  font-size: clamp(26px, 5vw, 34px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.result-card .value .unit {
  font-size: 0.5em;
  font-weight: 600;
  color: var(--text-dim);
  margin-left: 6px;
}

.result-card .hint {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-dim);
}

.result-card .value .arrow {
  display: inline-block;
  font-size: 0.7em;
  font-weight: 800;
  margin-right: 4px;
}

.result-card .value .arrow.decrease {
  color: #ffb4c0;
}

.result-card .value .arrow.increase {
  color: #9be9d6;
}

.pill-badge {
  position: absolute;
  right: 20px;
  bottom: 18px;
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
  padding: 8px 18px;
  border-radius: 999px;
  color: #0f1226;
  background: linear-gradient(120deg, var(--accent-2), var(--accent));
  box-shadow: 0 6px 18px -6px rgba(124, 140, 255, 0.7);
}

.pill-badge:empty {
  display: none;
}

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

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

.tool-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-radius: 16px;
  padding: 22px 24px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--card-border);
  text-decoration: none;
  color: inherit;
  transition: transform .2s ease, border-color .2s ease, background .2s ease, box-shadow .2s ease;
}

.tool-card:not(.disabled):hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  background: rgba(124, 140, 255, 0.08);
  box-shadow: 0 18px 40px -18px rgba(124, 140, 255, 0.6);
}

.tool-card.disabled {
  opacity: 0.55;
  cursor: default;
}

.tool-card .icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  background: linear-gradient(135deg, rgba(124, 140, 255, 0.28), rgba(52, 224, 192, 0.22));
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.tool-card .name {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.tool-card .desc {
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.5;
}

.tool-card .tag {
  align-self: flex-start;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
}

.tool-card .tag.live {
  color: #9be9d6;
  background: rgba(52, 224, 192, 0.16);
}

.tool-card .tag.soon {
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.08);
}

footer {
  text-align: center;
  margin-top: 22px;
  color: var(--text-dim);
  font-size: 12.5px;
}

textarea {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  line-height: 1.6;
  padding: 14px 16px;
  outline: none;
  resize: vertical;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

textarea::placeholder {
  color: var(--text-dim);
}

textarea:focus {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 4px rgba(124, 140, 255, 0.18);
}

.output-card {
  position: relative;
  margin-top: 20px;
  border-radius: 16px;
  padding: 22px 64px 22px 24px;
  background: linear-gradient(135deg, rgba(124, 140, 255, 0.16), rgba(52, 224, 192, 0.10));
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.output-card .label {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.extract-output {
  font-size: 16px;
  font-weight: 500;
  line-height: 1.7;
  color: var(--text);
  word-break: break-word;
}

.extract-output.placeholder {
  color: var(--text-dim);
  font-weight: 400;
  font-style: italic;
}

.icon-btn {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-dim);
  font-size: 15px;
  cursor: pointer;
  transition: color .18s ease, border-color .18s ease, background .18s ease;
}

.icon-btn:hover,
.icon-btn.copied {
  color: #0f1226;
  border-color: transparent;
  background: linear-gradient(120deg, var(--accent-2), var(--accent));
}

.icon-btn:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}