:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f1f5fb;
  --ink: #071b3b;
  --muted: #5c697c;
  --line: #d8e0ec;
  --line-strong: #b9c6d8;
  --blue: #0b4db3;
  --blue-dark: #071f4d;
  --blue-soft: #eaf2ff;
  --danger: #8f2c1d;
  --danger-soft: #fff0eb;
  --shadow: 0 18px 55px rgba(7, 31, 77, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  min-width: 0;
  width: 100%;
  max-width: 100%;
  margin: 0;
  overflow-x: hidden;
  background: linear-gradient(180deg, #ffffff 0, var(--bg) 420px, #ffffff 100%);
  color: var(--ink);
  font-family: "Inter", "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 78px;
  padding: 14px max(22px, calc((100vw - 1360px) / 2));
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-size: 28px;
  line-height: 1;
  font-weight: 800;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--blue-dark);
  color: #fff;
  font-size: 24px;
  box-shadow: 0 12px 24px rgba(7, 31, 77, 0.16);
}

.language-switch {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.language-switch button {
  min-width: 68px;
  min-height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.language-switch button.is-active,
.language-switch button:hover {
  background: var(--blue);
  color: #fff;
}

.app-shell {
  width: min(1360px, calc(100% - 56px));
  margin: 0 auto;
  padding: 48px 0 44px;
}

.intro-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.58fr);
  align-items: start;
  gap: 48px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  max-width: 760px;
  color: var(--ink);
  font-size: 42px;
  line-height: 1.12;
  font-weight: 800;
}

.intro-grid p {
  max-width: 780px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.75;
  font-weight: 600;
}

.privacy-note {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 18px;
  min-width: 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow);
}

.privacy-note svg,
.mode-card svg,
.primary-action svg,
.secondary-action svg,
.status-strip svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.privacy-note > svg {
  width: 44px;
  height: 44px;
  color: var(--blue);
}

.privacy-note strong {
  display: block;
  color: var(--ink);
  font-size: 16px;
  font-weight: 800;
}

.privacy-note p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
  font-weight: 600;
}

.control-row {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 280px 176px 176px;
  gap: 24px;
  margin-top: 40px;
}

.mode-card,
.primary-action,
.secondary-action {
  min-width: 0;
  min-height: 68px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.mode-card {
  display: grid;
  grid-template-columns: 36px 1fr;
  align-items: center;
  gap: 18px;
  padding: 16px 18px;
  background: var(--surface);
  border-color: rgba(11, 77, 179, 0.42);
}

.mode-card svg {
  color: var(--blue);
}

.mode-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.mode-card strong {
  display: block;
  margin-top: 2px;
  color: var(--ink);
  font-size: 16px;
  font-weight: 800;
}

.mode-card p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  font-weight: 600;
}

.primary-action,
.secondary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 20px;
  font-size: 16px;
  font-weight: 800;
}

.primary-action {
  background: var(--blue-dark);
  color: #fff;
  box-shadow: 0 18px 36px rgba(7, 31, 77, 0.16);
}

.primary-action:hover {
  background: var(--blue);
}

.primary-action.is-loading svg {
  animation: pulseSpin 1s linear infinite;
}

.secondary-action {
  background: var(--surface);
  color: var(--ink);
}

.secondary-action:hover {
  border-color: var(--line-strong);
  color: var(--blue);
}

.editor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  margin-top: 28px;
}

.editor-panel {
  display: grid;
  grid-template-rows: auto minmax(420px, 1fr) auto;
  min-width: 0;
  min-height: 570px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 14px 40px rgba(7, 31, 77, 0.06);
}

.panel-head,
.panel-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 58px;
  padding: 0 22px;
  border-color: var(--line);
}

.panel-head {
  border-bottom: 1px solid var(--line);
}

.panel-foot {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.panel-foot strong,
.panel-head span {
  color: var(--ink);
  font-weight: 800;
}

.panel-head h2 {
  color: var(--ink);
  font-size: 17px;
  font-weight: 800;
}

textarea,
.result-output {
  width: 100%;
  min-width: 0;
  padding: 24px 22px;
  border: 0;
  outline: none;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.78;
  font-weight: 600;
}

textarea {
  min-height: 420px;
  resize: vertical;
  background: #fff;
}

textarea::placeholder,
.result-output.is-placeholder {
  color: #8490a3;
}

.result-output {
  display: block;
  white-space: pre-wrap;
  overflow: auto;
  background: linear-gradient(180deg, #ffffff 0, #f8fafc 100%);
}

.status-strip {
  display: grid;
  grid-template-columns: 30px 1fr;
  align-items: center;
  gap: 14px;
  margin-top: 34px;
  padding: 18px 20px;
  border: 1px solid #c8d7ec;
  border-radius: 8px;
  background: var(--blue-soft);
  color: var(--blue-dark);
}

.status-strip svg {
  color: var(--blue);
}

.status-strip p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
  font-weight: 700;
}

.status-strip.is-error {
  background: var(--danger-soft);
  border-color: #efc7bc;
}

.status-strip.is-error svg,
.status-strip.is-error p {
  color: var(--danger);
}

.support-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 260px);
  align-items: center;
  gap: 32px;
  margin-top: 24px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 14px 40px rgba(7, 31, 77, 0.06);
}

.support-copy {
  min-width: 0;
}

.support-copy span {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0 10px;
  border: 1px solid rgba(11, 77, 179, 0.26);
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue-dark);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.support-copy h2 {
  margin-top: 14px;
  color: var(--ink);
  font-size: 28px;
  line-height: 1.2;
  font-weight: 800;
}

.support-copy p {
  max-width: 680px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.75;
  font-weight: 700;
}

.support-qr {
  justify-self: end;
  width: min(100%, 230px);
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.support-qr img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
}

.support-qr figcaption {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  font-weight: 800;
  text-align: center;
}

@keyframes pulseSpin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 1080px) {
  .intro-grid,
  .editor-grid,
  .support-band {
    grid-template-columns: 1fr;
  }

  .support-qr {
    justify-self: start;
  }

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

  .mode-card {
    grid-column: 1 / -1;
  }
}

@media (max-width: 680px) {
  .app-header {
    flex-wrap: wrap;
    min-height: 0;
    padding: 14px;
  }

  .brand {
    font-size: 23px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    font-size: 21px;
  }

  .language-switch {
    width: 100%;
    justify-content: space-between;
  }

  .language-switch button {
    flex: 1;
    min-width: 0;
  }

  .app-shell {
    width: min(100% - 28px, 1360px);
    padding: 34px 0 28px;
  }

  h1 {
    font-size: 31px;
    line-height: 1.18;
  }

  .intro-grid p {
    font-size: 16px;
  }

  .privacy-note {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .control-row {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 28px;
  }

  .primary-action,
  .secondary-action {
    min-height: 56px;
  }

  .editor-panel {
    grid-template-rows: auto minmax(300px, 1fr) auto;
    min-height: 450px;
  }

  textarea {
    min-height: 300px;
  }

  textarea,
  .result-output {
    font-size: 16px;
  }

  .panel-foot {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    padding: 12px 18px;
  }

  .support-band {
    padding: 20px;
  }

  .support-copy h2 {
    font-size: 24px;
  }

  .support-qr {
    width: min(100%, 210px);
  }
}
