:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #52606f;
  --panel: rgba(255, 255, 255, 0.48);
  --panel-strong: rgba(255, 255, 255, 0.66);
  --panel-soft: rgba(255, 255, 255, 0.28);
  --edge: rgba(255, 255, 255, 0.68);
  --edge-dark: rgba(24, 36, 48, 0.13);
  --teal: #1fb7a6;
  --coral: #f06f5f;
  --blue: #4977d6;
  --violet: #8f60cc;
  --shadow: rgba(25, 38, 55, 0.22);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #eff7f2;
}

body {
  min-height: 100dvh;
  margin: 0;
  color: var(--ink);
  overflow-x: hidden;
}

button,
textarea {
  font: inherit;
}

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

#liquid-scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  background: #e9f7f4;
}

.app-shell {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: grid;
  align-items: center;
  padding: 32px;
}

.converter {
  width: min(1060px, 100%);
  margin: 0 auto;
  padding: 22px;
  border: 1px solid var(--edge);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0.26)),
    var(--panel);
  box-shadow:
    0 28px 90px var(--shadow),
    inset 0 1px 0 rgba(255, 255, 255, 0.76),
    inset 0 -1px 0 rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(28px) saturate(1.35);
  -webkit-backdrop-filter: blur(28px) saturate(1.35);
}

.converter::before {
  content: "";
  display: block;
  height: 1px;
  margin: -10px 12px 20px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.8), transparent);
}

.brand-row,
.output-head,
.controls,
.action-row,
.mode-group,
.signal,
.switch-control {
  display: flex;
  align-items: center;
}

.brand-row {
  justify-content: space-between;
  gap: 20px;
  padding: 0 4px 22px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 2.35rem;
  line-height: 1;
  letter-spacing: 0;
}

.signal {
  width: 84px;
  height: 38px;
  justify-content: center;
  gap: 7px;
  border: 1px solid rgba(255, 255, 255, 0.52);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.3);
  box-shadow: inset 0 1px 8px rgba(255, 255, 255, 0.36);
}

.signal span {
  width: 8px;
  border-radius: 8px;
  background: linear-gradient(180deg, var(--teal), var(--blue));
  animation: signal-rise 1.8s ease-in-out infinite;
}

.signal span:nth-child(1) {
  height: 16px;
}

.signal span:nth-child(2) {
  height: 25px;
  background: linear-gradient(180deg, var(--coral), var(--violet));
  animation-delay: 0.18s;
}

.signal span:nth-child(3) {
  height: 20px;
  animation-delay: 0.36s;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  gap: 16px;
}

.input-panel,
.output-panel {
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 8px;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.52), rgba(255, 255, 255, 0.18)),
    rgba(255, 255, 255, 0.22);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.66),
    0 16px 42px rgba(23, 32, 42, 0.12);
}

.input-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
}

.field-label {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
  letter-spacing: 0;
}

textarea {
  width: 100%;
  min-height: 238px;
  resize: vertical;
  border: 1px solid rgba(23, 32, 42, 0.12);
  border-radius: 8px;
  padding: 17px;
  outline: none;
  color: var(--ink);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.35)),
    rgba(255, 255, 255, 0.42);
  box-shadow:
    inset 0 1px 14px rgba(255, 255, 255, 0.45),
    inset 0 -16px 28px rgba(65, 119, 214, 0.06);
  font-size: 1.45rem;
  line-height: 1.5;
}

textarea:focus {
  border-color: rgba(31, 183, 166, 0.62);
  box-shadow:
    0 0 0 3px rgba(31, 183, 166, 0.14),
    inset 0 1px 14px rgba(255, 255, 255, 0.45);
}

.controls {
  justify-content: space-between;
  gap: 12px;
}

.mode-group {
  min-width: 0;
  padding: 4px;
  gap: 4px;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.22);
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  color: var(--ink);
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

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

button:active {
  transform: translateY(0);
}

button:focus-visible {
  outline: 3px solid rgba(73, 119, 214, 0.28);
  outline-offset: 2px;
}

.mode {
  min-width: 64px;
  padding: 0 13px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.mode.is-active {
  color: #102536;
  background: rgba(255, 255, 255, 0.62);
  box-shadow:
    0 7px 18px rgba(23, 32, 42, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.primary-button,
.glass-button,
.ghost-button {
  font-weight: 850;
}

.primary-button {
  min-height: 54px;
  color: white;
  background:
    linear-gradient(135deg, rgba(31, 183, 166, 0.96), rgba(73, 119, 214, 0.94) 52%, rgba(143, 96, 204, 0.94)),
    #4977d6;
  box-shadow:
    0 14px 35px rgba(73, 119, 214, 0.26),
    inset 0 1px 0 rgba(255, 255, 255, 0.34);
}

.ghost-button,
.glass-button {
  border: 1px solid rgba(255, 255, 255, 0.58);
  background: rgba(255, 255, 255, 0.28);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.ghost-button {
  flex: 0 0 auto;
  padding: 0 15px;
}

.switch-control {
  width: fit-content;
  gap: 10px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 850;
  cursor: pointer;
  user-select: none;
}

.switch-control input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.switch-track {
  position: relative;
  width: 50px;
  height: 30px;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 8px;
  background: rgba(82, 96, 111, 0.18);
  box-shadow:
    inset 0 1px 6px rgba(255, 255, 255, 0.45),
    inset 0 -10px 20px rgba(23, 32, 42, 0.08);
  transition:
    background 160ms ease,
    box-shadow 160ms ease;
}

.switch-thumb {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 7px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.58)),
    #fff;
  box-shadow:
    0 5px 14px rgba(23, 32, 42, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.88);
  transition: transform 180ms ease;
}

.switch-control input:checked + .switch-track {
  background:
    linear-gradient(135deg, rgba(31, 183, 166, 0.78), rgba(73, 119, 214, 0.72)),
    rgba(255, 255, 255, 0.28);
  box-shadow:
    0 8px 22px rgba(31, 183, 166, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.52);
}

.switch-control input:checked + .switch-track .switch-thumb {
  transform: translateX(20px);
}

.switch-control input:focus-visible + .switch-track {
  outline: 3px solid rgba(73, 119, 214, 0.28);
  outline-offset: 2px;
}

.output-panel {
  display: flex;
  flex-direction: column;
  padding: 18px;
}

.output-head {
  justify-content: space-between;
  gap: 12px;
}

.action-row {
  gap: 8px;
}

.glass-button {
  padding: 0 14px;
}

.result {
  display: block;
  min-height: 138px;
  margin-top: 16px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 8px;
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.56), rgba(255, 255, 255, 0.2)),
    rgba(255, 255, 255, 0.26);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.72),
    inset 0 -22px 35px rgba(240, 111, 95, 0.08);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  font-size: 2.05rem;
  line-height: 1.55;
  font-weight: 900;
}

.result.is-empty {
  color: rgba(82, 96, 111, 0.72);
  font-weight: 800;
}

.breakdown {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.token {
  min-height: 54px;
  display: grid;
  place-items: center;
  gap: 1px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.24);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.52);
}

.token small {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1;
}

.token strong {
  font-size: 1.2rem;
  line-height: 1.15;
}

.status {
  min-height: 22px;
  margin: auto 0 0;
  padding-top: 14px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

@keyframes signal-rise {
  0%,
  100% {
    transform: scaleY(0.72);
    opacity: 0.72;
  }

  50% {
    transform: scaleY(1);
    opacity: 1;
  }
}

@media (max-width: 820px) {
  .app-shell {
    align-items: start;
    padding: 18px;
  }

  .converter {
    padding: 16px;
  }

  .brand-row {
    padding-bottom: 17px;
  }

  h1 {
    font-size: 2rem;
  }

  .signal {
    display: none;
  }

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

  textarea {
    min-height: 168px;
    font-size: 1.25rem;
  }

  .result {
    min-height: 110px;
    font-size: 1.7rem;
  }
}

@media (max-width: 520px) {
  .app-shell {
    padding: 12px;
  }

  .converter {
    padding: 12px;
  }

  .controls,
  .output-head {
    align-items: stretch;
    flex-direction: column;
  }

  .mode-group,
  .action-row {
    width: 100%;
  }

  .mode,
  .glass-button {
    flex: 1 1 0;
    min-width: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}
