:root {
  color-scheme: light;
  --bg: #eff6ff;
  --card: rgba(255, 255, 255, 0.46);
  --ink: #18223b;
  --soft: #5d6f90;
  --muted: #7f90b0;
  --line: rgba(103, 132, 186, 0.16);
  --line-blue: rgba(102, 164, 255, 0.34);
  --blue: #4f8df6;
  --violet: #7aa9ff;
  --lavender: #c5d9ff;
  --pink: #8cc7ff;
  --blue-soft: rgba(79, 141, 246, 0.12);
  --green: #008f64;
  --green-bg: rgba(0, 143, 100, 0.12);
  --red: #d73055;
  --glass: rgba(255, 255, 255, 0.48);
  --glass-strong: rgba(255, 255, 255, 0.78);
  --shadow: 0 28px 70px rgba(61, 94, 156, 0.16);
  --inner-glass: inset 0 1px 0 rgba(255, 255, 255, 0.9), inset 0 -1px 0 rgba(103, 132, 186, 0.1);
  font-family: Inter, "HarmonyOS Sans SC", "Microsoft YaHei", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  position: relative;
  color: var(--ink);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.94), rgba(255, 255, 255, 0.2) 36%, rgba(255, 255, 255, 0)),
    linear-gradient(122deg, #f7fbff 0%, #e8f2ff 34%, #eef6ff 66%, #eaf2ff 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(122deg, transparent 0 17%, rgba(255, 255, 255, 0.54) 17% 18%, transparent 18% 44%, rgba(130, 186, 255, 0.2) 44% 45%, transparent 45%),
    linear-gradient(302deg, rgba(79, 141, 246, 0.12), transparent 28%, rgba(140, 199, 255, 0.1) 74%, transparent),
    repeating-linear-gradient(135deg, rgba(104, 141, 206, 0.045) 0 1px, transparent 1px 34px);
  opacity: 0.9;
}

body::after {
  content: "";
  position: fixed;
  inset: 18px;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 28px;
  box-shadow: inset 0 0 68px rgba(255, 255, 255, 0.38);
  opacity: 0.72;
}

button,
textarea {
  font: inherit;
}

.page {
  position: relative;
  z-index: 1;
  width: min(900px, calc(100% - 32px));
  height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 18px;
  padding: 36px 0;
}

.header {
  display: grid;
  gap: 8px;
}

.service {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 18px;
  color: var(--soft);
  font-size: 12px;
}

.brand {
  color: #4f78d3;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-weight: 700;
  letter-spacing: 1.8px;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--violet);
  box-shadow: 0 0 18px rgba(79, 141, 246, 0.56);
}

h1,
h2,
p {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  color: #1b2740;
  font-size: 28px;
  line-height: 1.25;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.64);
}

.summary {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 112px;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.66);
  border-radius: 22px;
  background:
    linear-gradient(112deg, rgba(255, 255, 255, 0.84), rgba(255, 255, 255, 0.42) 48%, rgba(220, 235, 255, 0.74)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.58), rgba(255, 255, 255, 0.08));
  box-shadow:
    0 22px 52px rgba(79, 141, 246, 0.16),
    var(--inner-glass);
  backdrop-filter: blur(28px) saturate(1.35);
  -webkit-backdrop-filter: blur(28px) saturate(1.35);
}

.summary::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(118deg, transparent 0 12%, rgba(255, 255, 255, 0.56) 12% 13%, transparent 13% 62%, rgba(255, 255, 255, 0.28) 62% 63%, transparent 63%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.2), transparent 60%);
}

.summary h2 {
  position: relative;
  z-index: 1;
  margin-top: 10px;
  font-size: 18px;
  line-height: 1.4;
  color: #24385d;
}

.pill,
.state {
  gap: 6px;
  display: inline-flex;
  align-items: center;
  height: 26px;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  flex: 0 0 auto;
  line-height: 1;
}

.state-dot {
  display: block;
  width: 4px;
  height: 4px;
  flex: 0 0 4px;
  border-radius: 999px;
  background: currentColor;
}

.pill {
  position: relative;
  z-index: 1;
  color: #3d73da;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(79, 141, 246, 0.28);
  box-shadow: var(--inner-glass);
}

.primary,
.secondary,
.copy {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  cursor: pointer;
  transform: translateY(0);
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    filter 180ms ease,
    background-color 180ms ease,
    border-color 180ms ease;
}

.grid {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
}

.card {
  position: relative;
  overflow: hidden;
  min-height: 0;
  display: grid;
  gap: 16px;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.64);
  border-radius: 22px;
  background: var(--card);
  box-shadow:
    var(--shadow),
    var(--inner-glass);
  backdrop-filter: blur(30px) saturate(1.42);
  -webkit-backdrop-filter: blur(30px) saturate(1.42);
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(128deg, rgba(255, 255, 255, 0.58), transparent 28%),
    linear-gradient(310deg, rgba(130, 186, 255, 0.22), transparent 46%);
}

.card::after {
  content: "";
  position: absolute;
  inset: 1px;
  pointer-events: none;
  border-radius: 21px;
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.input-card {
  grid-template-rows: auto 1fr auto;
}

.output-card {
  grid-template-rows: auto 1fr;
}

.card-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 32px;
}

.card-head h2 {
  color: #23314d;
  font-size: 15px;
  line-height: 1.4;
}

.card-head span {
  color: var(--muted);
  font-size: 12px;
}

.card-head span.error {
  color: var(--red);
  font-weight: 700;
}

.result-tools {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
}

.field {
  position: relative;
  z-index: 1;
  min-height: 0;
  display: grid;
  grid-template-rows: 1fr;
  gap: 0;
}

textarea {
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 14px;
  border: 1px solid rgba(116, 91, 151, 0.2);
  border-radius: 18px;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0.38)),
    rgba(255, 255, 255, 0.42);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.86),
    inset 0 -1px 0 rgba(116, 91, 151, 0.08),
    0 12px 24px rgba(97, 73, 142, 0.08);
  backdrop-filter: blur(20px) saturate(1.24);
  -webkit-backdrop-filter: blur(20px) saturate(1.24);
  outline: none;
  line-height: 1.55;
  resize: none;
  word-break: break-all;
}

textarea::placeholder {
  color: #9a8bad;
}

textarea:focus {
  border-color: rgba(79, 141, 246, 0.5);
  box-shadow:
    0 0 0 4px rgba(79, 141, 246, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.86),
    0 14px 30px rgba(79, 141, 246, 0.15);
}

textarea.invalid {
  border-color: #e35a6b;
  box-shadow:
    0 0 0 4px rgba(215, 48, 70, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

textarea.shake {
  animation: field-shake 360ms ease;
}

.actions {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 70px;
  gap: 10px;
}

.primary,
.secondary,
.copy {
  min-height: 40px;
  font-size: 14px;
}

.primary {
  border: 0;
  color: #fff;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.24), transparent 46%),
    linear-gradient(135deg, #4f8df6 0%, #63b2ff 52%, #8bc8ff 100%);
  font-weight: 700;
  box-shadow:
    0 16px 30px rgba(79, 141, 246, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.38);
}

.primary::after {
  content: "";
  position: absolute;
  top: -40%;
  left: -32%;
  width: 28%;
  height: 180%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.46), transparent);
  transform: rotate(18deg) translateX(-180%);
  opacity: 0;
  pointer-events: none;
}

.secondary,
.copy {
  border: 1px solid rgba(116, 91, 151, 0.2);
  color: #57456f;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.64), rgba(255, 255, 255, 0.36)),
    rgba(255, 255, 255, 0.42);
  box-shadow:
    0 10px 22px rgba(84, 62, 128, 0.08),
    var(--inner-glass);
  backdrop-filter: blur(18px) saturate(1.18);
  -webkit-backdrop-filter: blur(18px) saturate(1.18);
}

.copy {
  min-width: 50px;
  min-height: 32px;
  font-size: 12px;
}

.primary:hover:not(:disabled),
.secondary:hover:not(:disabled),
.copy:hover:not(:disabled) {
  filter: brightness(1.04);
  transform: translateY(-2px);
}

.primary:hover:not(:disabled) {
  box-shadow: 0 20px 34px rgba(79, 141, 246, 0.32);
}

.primary:hover:not(:disabled)::after {
  animation: button-shine 760ms ease;
}

.secondary:hover:not(:disabled),
.copy:hover:not(:disabled) {
  border-color: rgba(79, 141, 246, 0.34);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.76), rgba(255, 255, 255, 0.48)),
    rgba(255, 255, 255, 0.54);
  box-shadow:
    0 14px 28px rgba(84, 62, 128, 0.12),
    var(--inner-glass);
}

.primary:active:not(:disabled),
.secondary:active:not(:disabled),
.copy:active:not(:disabled) {
  transform: translateY(0) scale(0.98);
  box-shadow: 0 6px 12px rgba(12, 28, 58, 0.08);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.56;
  transform: none;
  box-shadow: none;
}

.ripple {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0);
  animation: button-ripple 560ms ease-out;
}

.primary .ripple {
  background: rgba(255, 255, 255, 0.52);
}

.secondary .ripple,
.copy .ripple {
  background: rgba(79, 141, 246, 0.18);
}

.state-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.state.ok {
  color: var(--green);
  background: var(--green-bg);
  border: 1px solid rgba(0, 143, 100, 0.18);
  box-shadow: var(--inner-glass);
}

.state.soft {
  color: #5d6f90;
  background: rgba(255, 255, 255, 0.48);
  border: 1px solid rgba(116, 91, 151, 0.16);
  box-shadow: var(--inner-glass);
}

.status {
  min-height: 40px;
  display: flex;
  align-items: center;
  color: #526078;
  font-size: 12px;
  line-height: 1.4;
}

.status[hidden] {
  display: none;
}

.status.ok {
  color: var(--green);
}

.status.error {
  color: var(--red);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 30;
  max-width: min(420px, calc(100% - 32px));
  padding: 12px 16px;
  border: 1px solid rgba(215, 48, 85, 0.18);
  border-radius: 16px;
  color: #9f1f3b;
  background: rgba(255, 248, 251, 0.78);
  box-shadow:
    0 18px 40px rgba(84, 62, 128, 0.16),
    var(--inner-glass);
  backdrop-filter: blur(22px) saturate(1.22);
  -webkit-backdrop-filter: blur(22px) saturate(1.22);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 18px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.ok {
  border-color: rgba(0, 143, 100, 0.18);
  color: var(--green);
  background: var(--green-bg);
}

@keyframes button-shine {
  0% {
    opacity: 0;
    transform: rotate(18deg) translateX(-180%);
  }

  18% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: rotate(18deg) translateX(520%);
  }
}

@keyframes button-ripple {
  to {
    opacity: 0;
    transform: translate(-50%, -50%) scale(18);
  }
}

@keyframes field-shake {
  0%,
  100% {
    transform: translateX(0);
  }

  22% {
    transform: translateX(-5px);
  }

  44% {
    transform: translateX(5px);
  }

  66% {
    transform: translateX(-3px);
  }

  82% {
    transform: translateX(3px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .primary,
  .secondary,
  .copy,
  .toast {
    transition: none;
  }

  .primary:hover:not(:disabled)::after,
  .ripple,
  textarea.shake {
    animation: none;
  }
}

@media (max-width: 760px) {
  html,
  body {
    overflow: auto;
  }

  .page {
    width: min(100% - 24px, 900px);
    height: auto;
    min-height: 100vh;
    padding: 24px 0;
  }

  .summary {
    align-items: stretch;
    flex-direction: column;
  }

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

  .card {
    min-height: 280px;
  }
}
