@font-face {
  font-family: "Golos Text";
  src: url("../fonts/GolosText-Regular.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Golos Text";
  src: url("../fonts/GolosText-Medium.woff2") format("woff2");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: "Golos Text";
  src: url("../fonts/GolosText-SemiBold.woff2") format("woff2");
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}

@font-face {
  font-family: "Golos Text";
  src: url("../fonts/GolosText-Bold.woff2") format("woff2");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

:root {
  --font-ui: "Golos Text", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --page-bg: #edf3fa;
  --card: rgba(255, 255, 255, 0.97);
  --text: #172a47;
  --text-strong: #0b1d39;
  --muted: #63738a;
  --muted-2: #7b899b;
  --line: #d8e3f0;
  --line-strong: #c4d3e5;
  --blue: #1e62c8;
  --blue-deep: #0f3d91;
  --blue-soft: #eef5ff;
  --green: #13884a;
  --green-deep: #0a6c3a;
  --green-soft: #eef9f3;
  --slate: #61758d;
  --slate-soft: #f2f5f8;
  --danger: #b73242;
  --danger-soft: #fff1f3;
  --warning: #95620f;
  --warning-soft: #fff8e9;
  --shadow-lg: 0 24px 68px rgba(39, 69, 111, 0.13), 0 4px 14px rgba(39, 69, 111, 0.05);
  --shadow-md: 0 14px 38px rgba(39, 69, 111, 0.09), 0 2px 8px rgba(39, 69, 111, 0.04);
  --shadow-sm: 0 8px 22px rgba(39, 69, 111, 0.08);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --focus: 0 0 0 4px rgba(30, 98, 200, 0.15);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 17px;
  line-height: 1.55;
  background:
    radial-gradient(circle at 4% 0%, rgba(58, 130, 231, 0.17), transparent 28rem),
    radial-gradient(circle at 98% 5%, rgba(56, 189, 248, 0.11), transparent 28rem),
    linear-gradient(180deg, #fafcff 0%, var(--page-bg) 52%, #e9f0f8 100%);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
select {
  font: inherit;
}

button,
[role="button"],
label,
summary {
  -webkit-tap-highlight-color: transparent;
}

button {
  border: 0;
}

svg {
  display: block;
}

[hidden] {
  display: none !important;
}

.app-shell {
  width: min(1540px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 16px;
}

/* Hero */
.hero {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: 102px minmax(400px, 1fr) minmax(390px, 0.92fr);
  align-items: center;
  gap: 30px;
  min-height: 202px;
  padding: 28px 34px;
  overflow: hidden;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: var(--radius-xl);
  background: linear-gradient(121deg, #09295f 0%, #104a9e 57%, #2778d0 100%);
  box-shadow: 0 25px 70px rgba(15, 61, 145, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.hero::before,
.hero::after {
  content: "";
  position: absolute;
  pointer-events: none;
  z-index: -1;
}

.hero::before {
  width: 560px;
  height: 560px;
  right: -180px;
  top: -300px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: -210px 180px 0 rgba(255, 255, 255, 0.035);
}

.hero::after {
  inset: 0;
  opacity: .38;
  background:
    linear-gradient(135deg, transparent 37%, rgba(255,255,255,.09) 37.4%, transparent 37.8%),
    linear-gradient(153deg, transparent 61%, rgba(255,255,255,.07) 61.4%, transparent 61.8%);
}

.hero-brand {
  position: relative;
  z-index: 2;
  width: 102px;
  height: 102px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.40);
  border-radius: 30px;
  color: #fff;
  background: linear-gradient(145deg, #377fdf, #1250ad);
  box-shadow: 0 18px 40px rgba(4, 23, 63, 0.30), inset 0 0 0 7px rgba(255, 255, 255, 0.10), inset 0 1px 0 rgba(255, 255, 255, 0.55);
  font-size: 62px;
  line-height: 1;
  font-weight: 700;
}

.hero-copy {
  position: relative;
  z-index: 2;
  min-width: 0;
}

.hero-kicker {
  margin: 0 0 7px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12.5px;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  color: #fff;
  font-size: clamp(48px, 4.15vw, 67px);
  line-height: .98;
  letter-spacing: -.038em;
  font-weight: 700;
  text-transform: uppercase;
  text-wrap: balance;
}

.hero-subtitle {
  max-width: 700px;
  margin: 13px 0 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: clamp(17px, 1.25vw, 20px);
  line-height: 1.42;
  font-weight: 400;
  text-wrap: balance;
}

.hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 17px;
}

.hero-tags span {
  display: inline-flex;
  align-items: center;
  min-height: 31px;
  padding: 5px 12px;
  border: 1px solid rgba(255,255,255,.20);
  border-radius: 999px;
  background: rgba(255, 255, 255, .11);
  font-size: 13px;
  line-height: 1;
  font-weight: 500;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.hero-visual {
  position: relative;
  z-index: 2;
  height: 154px;
  min-width: 0;
}

.hero-total-card,
.hero-words-card {
  position: absolute;
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, .50);
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 22px 48px rgba(4, 23, 63, .25);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
}

.hero-total-card {
  right: 0;
  top: 0;
  width: min(330px, 74%);
  padding: 15px 17px;
  border-radius: 19px;
  transform: rotate(1.2deg);
}

.hero-total-card > span,
.hero-words-card > span {
  display: block;
  color: #6a7890;
  font-size: 11.5px;
  line-height: 1.2;
  font-weight: 500;
}

.hero-total-card > strong {
  display: block;
  margin-top: 5px;
  color: #132b52;
  font-size: 23px;
  line-height: 1.15;
  font-weight: 600;
  white-space: nowrap;
}

.hero-total-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #e1e9f3;
  color: #2b435f;
  font-size: 12.5px;
}

.hero-total-row b,
.hero-total-row em {
  font-style: normal;
  font-weight: 500;
}

.hero-words-card {
  left: 0;
  right: 24%;
  bottom: 0;
  min-height: 69px;
  padding: 13px 16px;
  border-radius: 17px;
  transform: rotate(-1.5deg);
}

.hero-words-card strong {
  display: -webkit-box;
  margin-top: 5px;
  overflow: hidden;
  color: #1c3154;
  font-size: 14.5px;
  line-height: 1.42;
  font-weight: 500;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

/* Main layout */
.workspace {
  display: grid;
  grid-template-columns: minmax(440px, .92fr) minmax(650px, 1.38fr);
  gap: 18px;
  align-items: start;
  margin-top: 18px;
}

.panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(198, 214, 234, .92);
  border-radius: var(--radius-lg);
  background: var(--card);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 23px 24px 18px;
  border-bottom: 1px solid #e5edf6;
}

.panel-title-group {
  display: flex;
  align-items: flex-start;
  min-width: 0;
  gap: 13px;
}

.panel-title-group > div {
  min-width: 0;
}

.panel-icon {
  width: 43px;
  height: 43px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 14px;
  background: currentColor;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 18%, white);
}

.panel-icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: #fff;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.panel-icon-blue { color: var(--blue); }
.panel-icon-green { color: var(--green); }

.panel h2 {
  margin: 1px 0 5px;
  color: var(--text-strong);
  font-size: 25px;
  line-height: 1.18;
  letter-spacing: -.02em;
  font-weight: 600;
}

.panel-header p {
  margin: 0;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.45;
  font-weight: 400;
}

.save-indicator {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 8px;
  min-height: 32px;
  padding: 6px 11px;
  color: #64748b;
  border: 1px solid #dbe4ef;
  border-radius: 999px;
  background: #f8fafc;
  font-size: 12.5px;
  line-height: 1;
  font-weight: 500;
  white-space: nowrap;
  transition: color .18s ease, border-color .18s ease, background .18s ease;
}

.save-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #95a2b5;
  box-shadow: 0 0 0 4px rgba(149, 162, 181, .11);
}

.save-indicator[data-state="saving"] {
  color: #8a6414;
  border-color: #efdfb8;
  background: #fffaf0;
}

.save-indicator[data-state="saving"] .save-dot {
  background: #d49a20;
  box-shadow: 0 0 0 4px rgba(212, 154, 32, .12);
  animation: savePulse 1s ease infinite;
}

.save-indicator[data-state="saved"] {
  color: #147340;
  border-color: #c9ead8;
  background: #f0faf4;
}

.save-indicator[data-state="saved"] .save-dot {
  background: #1aa25a;
  box-shadow: 0 0 0 4px rgba(26, 162, 90, .12);
}

.save-indicator[data-state="error"] {
  color: var(--danger);
  border-color: #f1c9d0;
  background: var(--danger-soft);
}

.save-indicator[data-state="error"] .save-dot { background: var(--danger); }

@keyframes savePulse {
  50% { transform: scale(.68); opacity: .55; }
}

/* Form */
#calculatorForm {
  padding: 21px 24px 23px;
}

.form-section {
  display: grid;
  gap: 18px;
  min-width: 0;
  margin: 0;
  padding: 0 0 24px;
  border: 0;
  border-bottom: 1px solid #e6edf5;
}

.form-section-last {
  margin-top: 22px;
  padding-bottom: 2px;
  border-bottom: 0;
}

.form-section legend {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 11px;
  margin: 0 0 17px;
  padding: 0;
}

.form-section legend > span:last-child {
  display: grid;
  gap: 2px;
}

.form-section legend strong {
  color: var(--text-strong);
  font-size: 16px;
  line-height: 1.25;
  font-weight: 600;
}

.form-section legend small {
  color: var(--muted-2);
  font-size: 13px;
  line-height: 1.35;
  font-weight: 400;
}

.section-number {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: #fff;
  border-radius: 10px;
  background: linear-gradient(145deg, #2f7ada, #1554b4);
  box-shadow: 0 8px 18px rgba(30, 95, 197, .19);
  font-size: 14px;
  line-height: 1;
  font-weight: 600;
}

.field {
  min-width: 0;
}

label,
.field-label {
  display: block;
  margin: 0 0 8px;
  color: #344761;
  font-size: 14.5px;
  line-height: 1.35;
  font-weight: 500;
}

.control-wrap {
  position: relative;
}

input,
select {
  width: 100%;
  height: 51px;
  border: 1px solid #cbd8e8;
  border-radius: 13px;
  outline: none;
  color: #142642;
  background: #fff;
  box-shadow: inset 0 1px 2px rgba(29, 58, 101, .025);
  font-size: 16.5px;
  line-height: 1;
  font-weight: 400;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

input { padding: 0 47px 0 15px; }

select {
  appearance: none;
  -webkit-appearance: none;
  padding: 0 46px 0 15px;
  cursor: pointer;
}

input::placeholder { color: #98a5b6; }
input:hover,
select:hover { border-color: #b4c5da; }
input:focus,
select:focus { border-color: var(--blue); box-shadow: var(--focus); }

input[aria-invalid="true"] {
  border-color: var(--danger);
  background: #fffafb;
  box-shadow: 0 0 0 4px rgba(183, 50, 66, .11);
}

.currency-suffix {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: #607087;
  font-size: 18px;
  line-height: 1;
  font-weight: 600;
  pointer-events: none;
}

.select-icon {
  position: absolute;
  right: 14px;
  top: 50%;
  width: 20px;
  height: 20px;
  transform: translateY(-50%);
  color: #728199;
  pointer-events: none;
}

.select-icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.field-meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  min-height: 20px;
  margin-top: 7px;
  color: var(--muted-2);
  font-size: 12.5px;
  line-height: 1.45;
  font-weight: 400;
}

.field-error {
  color: var(--danger);
  font-weight: 500;
  text-align: right;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.segment-option,
.rate-option {
  position: relative;
  min-width: 0;
  margin: 0;
  cursor: pointer;
}

.segment-option input,
.rate-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.segment-content {
  display: flex;
  align-items: center;
  min-height: 84px;
  gap: 10px;
  padding: 12px 11px;
  border: 1px solid #d5dfeb;
  border-radius: 15px;
  background: #fbfcfe;
  transition: transform .16s ease, border-color .16s ease, background .16s ease, box-shadow .16s ease;
}

.segment-content > span:last-child { min-width: 0; }

.segment-content strong {
  display: block;
  color: #273a56;
  font-size: 14px;
  line-height: 1.25;
  font-weight: 600;
}

.segment-content small {
  display: block;
  margin-top: 4px;
  color: #748399;
  font-size: 12px;
  line-height: 1.32;
  font-weight: 400;
}

.segment-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 10px;
  background: currentColor;
}

.segment-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: #fff;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.segment-icon-blue { color: var(--blue); }
.segment-icon-green { color: var(--green); }
.segment-icon-gray { color: #718197; }

.segment-option:hover .segment-content {
  transform: translateY(-1px);
  border-color: #b9c9dc;
  box-shadow: var(--shadow-sm);
}

.segment-option input:focus-visible + .segment-content,
.rate-option input:focus-visible + span { box-shadow: var(--focus); }

.segment-option input:checked + .segment-content {
  border-color: #6fa1e1;
  background: linear-gradient(180deg, #f5f9ff, #edf4ff);
  box-shadow: 0 8px 21px rgba(30, 98, 200, .10), inset 0 0 0 1px rgba(30, 98, 200, .07);
}

.segment-option:nth-child(2) input:checked + .segment-content {
  border-color: #73bf91;
  background: linear-gradient(180deg, #f4fcf7, #ecf8f1);
  box-shadow: 0 8px 21px rgba(19, 136, 74, .10), inset 0 0 0 1px rgba(19, 136, 74, .07);
}

.segment-option:nth-child(3) input:checked + .segment-content {
  border-color: #a7b5c6;
  background: linear-gradient(180deg, #fafbfd, #f1f4f7);
  box-shadow: 0 8px 21px rgba(63, 80, 104, .08), inset 0 0 0 1px rgba(63, 80, 104, .05);
}

.rate-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.rate-option > span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 59px;
  gap: 9px;
  padding: 10px 13px;
  border: 1px solid #d5dfeb;
  border-radius: 14px;
  background: #fbfcfe;
  transition: transform .16s ease, border-color .16s ease, background .16s ease, box-shadow .16s ease;
}

.rate-option strong {
  color: #273a56;
  font-size: 22px;
  line-height: 1;
  font-weight: 600;
}

.rate-option small {
  max-width: 105px;
  color: #748399;
  font-size: 12.5px;
  line-height: 1.25;
  font-weight: 400;
}

.rate-option:hover > span { transform: translateY(-1px); box-shadow: var(--shadow-sm); }

.rate-option-blue input:checked + span {
  color: var(--blue);
  border-color: #6fa1e1;
  background: var(--blue-soft);
}

.rate-option-green input:checked + span {
  color: var(--green);
  border-color: #72bf90;
  background: var(--green-soft);
}

.rate-option input:checked + span strong,
.rate-option input:checked + span small { color: currentColor; }

.conditional-field {
  padding: 14px;
  border: 1px dashed #b7c8dc;
  border-radius: 15px;
  background: #f8fbff;
}

.format-preview,
.privacy-note {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  padding: 14px 15px;
  border-radius: 15px;
}

.format-preview {
  border: 1px solid #d7e4f2;
  background: linear-gradient(135deg, #f8fbff, #f1f6fd);
}

.format-preview-icon,
.privacy-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
}

.format-preview-icon { color: var(--blue); background: #e8f2ff; }
.privacy-icon { color: var(--green); background: #e5f7ec; }

.format-preview-icon svg,
.privacy-icon svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.format-preview small {
  display: block;
  color: #718096;
  font-size: 12px;
  line-height: 1.35;
  font-weight: 400;
}

.format-preview strong {
  display: block;
  margin-top: 4px;
  color: #263b5c;
  font-size: 14px;
  line-height: 1.48;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.form-actions {
  display: flex;
  margin-top: 21px;
}

.button {
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 10px 17px;
  border-radius: 13px;
  cursor: pointer;
  font-size: 14.5px;
  line-height: 1.2;
  font-weight: 500;
  transition: transform .16s ease, border-color .16s ease, background .16s ease, box-shadow .16s ease, opacity .16s ease;
}

.button svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.button-secondary {
  width: 100%;
  color: #1a4c99;
  border: 1px solid #c6d7eb;
  background: linear-gradient(180deg, #fff, #f5f8fc);
  box-shadow: 0 6px 15px rgba(40, 68, 111, .05);
}

.button-secondary:hover {
  transform: translateY(-1px);
  border-color: #a8c0de;
  background: #f8fbff;
  box-shadow: 0 10px 22px rgba(40, 68, 111, .09);
}

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

.button:disabled {
  cursor: wait;
  opacity: .62;
}

.button:focus-visible,
.toast button:focus-visible,
.copy-target:focus-visible,
.footer-domain:focus-visible,
.history-main:focus-visible,
.history-action:focus-visible,
.history-clear:focus-visible,
.history-section summary:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.privacy-note {
  margin-top: 15px;
  border: 1px solid #cce7d8;
  background: #f3fbf6;
}

.privacy-note strong {
  display: block;
  color: #19683d;
  font-size: 14px;
  line-height: 1.3;
  font-weight: 600;
}

.privacy-note span:last-child {
  display: block;
  margin-top: 3px;
  color: #5f7e6d;
  font-size: 12.5px;
  line-height: 1.45;
  font-weight: 400;
}

/* Results */
.results-panel {
  display: flex;
  flex-direction: column;
}

.results-header {
  align-items: center;
}

.results-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 9px;
}

.calculation-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 6px 12px;
  color: #17663d;
  border: 1px solid #c8e8d6;
  border-radius: 999px;
  background: #f0faf4;
  font-size: 12.5px;
  line-height: 1;
  font-weight: 500;
  white-space: nowrap;
}

.button-copy-all {
  min-height: 38px;
  padding: 7px 12px;
  color: #fff;
  border: 1px solid #1769c7;
  background: linear-gradient(180deg, #2a78d5, #1558b3);
  box-shadow: 0 8px 18px rgba(30, 98, 200, .17);
  font-size: 13px;
}

.button-copy-all svg { width: 20px; height: 20px; }
.button-copy-all:hover { transform: translateY(-1px); box-shadow: 0 11px 23px rgba(30, 98, 200, .23); }

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 13px;
  padding: 22px 23px 0;
}

.copy-target {
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

.summary-card {
  position: relative;
  min-width: 0;
  min-height: 190px;
  padding: 18px;
  overflow: hidden;
  border: 1px solid #d4dfec;
  border-radius: 18px;
  background: #f8fafc;
  transition: transform .17s ease, border-color .17s ease, box-shadow .17s ease, background .17s ease;
}

.summary-card::before {
  content: "";
  position: absolute;
  right: -34px;
  top: -38px;
  width: 112px;
  height: 112px;
  border-radius: 50%;
  background: currentColor;
  opacity: .045;
}

.summary-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 29px rgba(40, 68, 111, .10);
}

.summary-card-blue {
  --summary-accent: var(--blue);
  color: var(--blue);
  border-color: #c9daf0;
  background: linear-gradient(145deg, #f9fcff, #eef5ff);
}

.summary-card-green {
  --summary-accent: var(--green);
  color: var(--green);
  border-color: #c9e7d6;
  background: linear-gradient(145deg, #f8fdf9, #edf9f2);
}

.summary-card-slate {
  --summary-accent: var(--slate);
  color: var(--slate);
  border-color: #d5dfe9;
  background: linear-gradient(145deg, #fbfcfd, #f1f4f7);
}

.summary-card-blue:hover { border-color: #8db4e8; }
.summary-card-green:hover { border-color: #8acaa5; }
.summary-card-slate:hover { border-color: #aab9ca; }

.summary-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.summary-card-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  color: #fff;
  border-radius: 12px;
  background: var(--summary-accent);
  font-size: 20px;
  line-height: 1;
  font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.26);
}

.summary-copy-icon {
  width: 25px;
  height: 25px;
  color: currentColor;
  opacity: .58;
}

.summary-copy-icon svg,
.copy-chip svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
}

.summary-label {
  display: block;
  margin-top: 17px;
  color: #55677e;
  font-size: 14px;
  line-height: 1.3;
  font-weight: 500;
}

.summary-card > strong {
  display: block;
  margin-top: 7px;
  color: #162a4b;
  font-size: 16.5px;
  line-height: 1.48;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.summary-card > small {
  display: block;
  margin-top: 11px;
  color: #7b899b;
  font-size: 12px;
  line-height: 1.3;
  font-weight: 400;
}

.copy-target[data-copied="true"] {
  border-color: #57b77d !important;
  background: #effaf3 !important;
  box-shadow: 0 0 0 3px rgba(19, 136, 74, .10), 0 13px 28px rgba(40, 68, 111, .08);
}

.phrase-section {
  display: grid;
  gap: 13px;
  padding: 23px;
}

.phrase-section-heading h3 {
  margin: 0;
  color: #172a49;
  font-size: 18px;
  line-height: 1.3;
  font-weight: 600;
}

.phrase-section-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.45;
  font-weight: 400;
}

.phrase-card {
  position: relative;
  padding: 19px 20px;
  border: 1px solid #d5e1ee;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(40, 68, 111, .045);
  transition: transform .17s ease, border-color .17s ease, box-shadow .17s ease, background .17s ease;
}

.phrase-card:hover {
  transform: translateY(-1px);
  border-color: #b8cbe2;
  box-shadow: 0 12px 26px rgba(40, 68, 111, .09);
}

.phrase-card.is-recommended,
.phrase-card-primary.is-recommended {
  border-color: #9ec2ec;
  background: linear-gradient(145deg, #fbfdff, #f1f6ff);
  box-shadow: inset 4px 0 0 var(--blue), 0 7px 20px rgba(40, 68, 111, .06);
}

.phrase-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.phrase-kicker {
  display: block;
  margin-bottom: 4px;
  color: var(--green);
  font-size: 11.5px;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.phrase-card h4 {
  margin: 0;
  color: #1b3154;
  font-size: 17px;
  line-height: 1.3;
  font-weight: 600;
}

.copy-chip {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 6px;
  min-height: 33px;
  padding: 6px 10px;
  color: #285d9d;
  border: 1px solid #cfdded;
  border-radius: 10px;
  background: #f8fbff;
  font-size: 12px;
  line-height: 1;
  font-weight: 500;
}

.copy-chip svg { width: 17px; height: 17px; }

.phrase-card > p {
  margin: 14px 0 0;
  color: #243958;
  font-size: 16px;
  line-height: 1.62;
  font-weight: 400;
  overflow-wrap: anywhere;
}

/* History */
.history-section {
  margin: 0 23px 23px;
  overflow: hidden;
  border: 1px solid #d8e3ef;
  border-radius: 18px;
  background: #fbfcfe;
}

.history-section summary {
  display: grid;
  grid-template-columns: 39px minmax(0, 1fr) auto 22px;
  align-items: center;
  gap: 11px;
  padding: 15px 16px;
  cursor: pointer;
  list-style: none;
}

.history-section summary::-webkit-details-marker { display: none; }

.history-summary-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: var(--blue);
  border-radius: 12px;
  background: #eaf3ff;
}

.history-summary-icon svg,
.history-chevron svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.history-section summary strong {
  display: block;
  color: #203654;
  font-size: 15.5px;
  line-height: 1.25;
  font-weight: 600;
}

.history-section summary small {
  display: block;
  margin-top: 2px;
  color: #748399;
  font-size: 12.5px;
  line-height: 1.35;
  font-weight: 400;
}

.history-count {
  display: grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  color: #245a9c;
  border-radius: 999px;
  background: #eaf3ff;
  font-size: 12.5px;
  font-weight: 600;
}

.history-chevron {
  color: #708198;
  transition: transform .18s ease;
}

.history-section[open] .history-chevron { transform: rotate(180deg); }

.history-content {
  padding: 0 16px 16px;
  border-top: 1px solid #e4ebf4;
}

.history-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 0 10px;
}

.history-toolbar p {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.4;
}

.history-clear {
  flex: 0 0 auto;
  padding: 6px 9px;
  cursor: pointer;
  color: #8b3b48;
  border: 1px solid #efd0d5;
  border-radius: 9px;
  background: #fff7f8;
  font-size: 12px;
  font-weight: 500;
}

.history-list {
  display: grid;
  gap: 8px;
}

.history-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 8px;
  min-width: 0;
}

.history-main {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  cursor: pointer;
  text-align: left;
  color: inherit;
  border: 1px solid #dbe5f0;
  border-radius: 13px;
  background: #fff;
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.history-main:hover {
  transform: translateY(-1px);
  border-color: #b9cce2;
  box-shadow: 0 7px 17px rgba(40, 68, 111, .07);
}

.history-amount {
  min-width: 122px;
  color: #17335f;
  font-size: 15px;
  line-height: 1.25;
  font-weight: 600;
  white-space: nowrap;
}

.history-meta {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.history-meta strong {
  overflow: hidden;
  color: #344a67;
  font-size: 13.5px;
  line-height: 1.3;
  font-weight: 500;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.history-meta span {
  color: #7b899b;
  font-size: 12px;
  line-height: 1.3;
}

.history-item-actions {
  display: flex;
  gap: 6px;
}

.history-action {
  width: 42px;
  min-height: 42px;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: #49627f;
  border: 1px solid #dbe5f0;
  border-radius: 12px;
  background: #fff;
  transition: color .16s ease, border-color .16s ease, background .16s ease;
}

.history-action:hover {
  color: var(--blue);
  border-color: #abc4e1;
  background: #f5f9ff;
}

.history-action[data-action="delete"]:hover {
  color: var(--danger);
  border-color: #efc8ce;
  background: #fff6f7;
}

.history-action svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.history-empty {
  display: grid;
  place-items: center;
  gap: 3px;
  padding: 24px 12px;
  color: #75849a;
  text-align: center;
}

.history-empty strong {
  color: #435975;
  font-size: 14px;
  font-weight: 500;
}

.history-empty span {
  font-size: 12.5px;
  line-height: 1.4;
}

/* Feature strip and footer */
.feature-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin-top: 18px;
  overflow: hidden;
  border: 1px solid rgba(198, 214, 234, .92);
  border-radius: var(--radius-lg);
  background: #dbe5f1;
  box-shadow: var(--shadow-md);
}

.feature-strip article {
  display: grid;
  grid-template-columns: 45px minmax(0, 1fr);
  align-items: center;
  gap: 13px;
  min-width: 0;
  min-height: 96px;
  padding: 19px 22px;
  background: rgba(255, 255, 255, .97);
}

.feature-icon {
  width: 43px;
  height: 43px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: currentColor;
}

.feature-icon svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: #fff;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.feature-icon-blue { color: var(--blue); }
.feature-icon-green { color: var(--green); }
.feature-icon-slate { color: var(--slate); }

.feature-strip strong {
  display: block;
  color: #1a2e4e;
  font-size: 15px;
  line-height: 1.3;
  font-weight: 600;
}

.feature-strip article div > span {
  display: block;
  margin-top: 4px;
  color: #6d7c91;
  font-size: 13px;
  line-height: 1.4;
  font-weight: 400;
}

.footer {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  padding: 17px 8px 2px;
  color: #607087;
  font-size: 13px;
  line-height: 1.4;
  font-weight: 400;
}

.footer-item {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.footer-mark {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: var(--blue);
  border-radius: 50%;
  background: #eaf3ff;
  font-size: 16px;
  font-weight: 600;
}

.footer-item-center {
  justify-self: center;
  white-space: nowrap;
}

.footer-heart {
  width: 27px;
  height: 27px;
  color: #2c70c6;
}

.footer-heart svg {
  width: 100%;
  height: 100%;
  fill: rgba(44, 112, 198, .12);
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.footer-domain {
  justify-self: end;
  color: #245798;
  font-weight: 500;
  text-decoration: none;
}

.footer-domain:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Toast */
.toast {
  position: fixed;
  z-index: 100;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(560px, calc(100% - 28px));
  min-height: 56px;
  padding: 10px 10px 10px 14px;
  transform: translateX(-50%);
  color: #195b38;
  border: 1px solid #bee2cf;
  border-radius: 17px;
  background: rgba(245, 253, 248, .98);
  box-shadow: 0 22px 54px rgba(17, 49, 92, .18);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
}

.toast[data-tone="warn"] {
  color: #825d12;
  border-color: #ead9ad;
  background: rgba(255, 250, 239, .98);
}

.toast[data-tone="error"] {
  color: var(--danger);
  border-color: #efc6ce;
  background: rgba(255, 246, 248, .98);
}

.toast-message {
  min-width: 0;
  flex: 1;
  font-size: 13.5px;
  line-height: 1.4;
  font-weight: 500;
}

.toast-action,
.toast-close {
  cursor: pointer;
  color: currentColor;
  background: transparent;
}

.toast-action {
  flex: 0 0 auto;
  padding: 7px 10px;
  border: 1px solid currentColor;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 600;
}

.toast-close {
  width: 35px;
  height: 35px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  padding: 0;
  border-radius: 10px;
  font-size: 23px;
  line-height: 1;
  opacity: .7;
}

.toast-close:hover {
  background: rgba(50, 75, 110, .08);
  opacity: 1;
}

/* Responsive */
@media (max-width: 1320px) {
  .app-shell { width: min(1210px, calc(100% - 28px)); }
  .hero { grid-template-columns: 94px minmax(360px, 1fr) minmax(340px, .82fr); gap: 24px; }
  .hero-brand { width: 94px; height: 94px; font-size: 57px; }
  .workspace { grid-template-columns: minmax(420px, .98fr) minmax(570px, 1.3fr); }
  .summary-grid { grid-template-columns: 1fr; }
  .summary-card { min-height: 0; }
}

@media (max-width: 1080px) {
  .app-shell { width: min(920px, calc(100% - 24px)); }
  .hero { grid-template-columns: 88px 1fr; min-height: 182px; }
  .hero-brand { width: 88px; height: 88px; font-size: 53px; }
  .hero-visual { display: none; }
  .workspace { grid-template-columns: 1fr; }
  .input-panel,
  .results-panel { width: 100%; }
  .summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .feature-strip { grid-template-columns: 1fr; }
  .footer { grid-template-columns: 1fr auto; }
  .footer-item-center { display: none; }
}

@media (max-width: 760px) {
  body { font-size: 16px; }
  .app-shell { width: min(100% - 20px, 680px); padding-top: 10px; }
  .hero {
    grid-template-columns: 70px minmax(0, 1fr);
    gap: 14px;
    min-height: 0;
    padding: 20px;
    border-radius: 21px;
  }
  .hero-brand { width: 70px; height: 70px; border-radius: 22px; font-size: 43px; }
  .hero-kicker { font-size: 11px; }
  .hero h1 { font-size: clamp(34px, 9vw, 47px); line-height: 1; }
  .hero-subtitle { font-size: 15.5px; }
  .hero-tags { grid-column: 1 / -1; margin-top: 2px; }
  .hero-tags span { font-size: 12.5px; }
  .workspace { gap: 13px; margin-top: 13px; }
  .panel { border-radius: 18px; }
  .panel-header { flex-direction: column; align-items: stretch; padding: 19px 18px 15px; }
  .panel h2 { font-size: 23px; }
  .panel-header p { font-size: 14px; }
  .save-indicator { align-self: flex-start; }
  #calculatorForm { padding: 18px; }
  .segmented-control { grid-template-columns: 1fr; }
  .segment-content { min-height: 70px; }
  .results-header { align-items: stretch; }
  .results-actions { justify-content: flex-start; }
  .button-copy-all { flex: 1 1 240px; }
  .summary-grid { grid-template-columns: 1fr; padding: 18px 18px 0; }
  .summary-card > strong { font-size: 17px; }
  .phrase-section { padding: 20px 18px; }
  .phrase-card { padding: 17px; }
  .phrase-card > p { font-size: 16px; }
  .history-section { margin: 0 18px 18px; }
  .history-main { grid-template-columns: 1fr; gap: 4px; }
  .history-amount { min-width: 0; }
  .feature-strip { margin-top: 13px; border-radius: 18px; }
  .feature-strip article { min-height: 88px; padding: 17px 18px; }
  .footer { grid-template-columns: 1fr; gap: 10px; padding: 15px 4px 3px; }
  .footer-domain { justify-self: start; }
  .toast { bottom: max(10px, env(safe-area-inset-bottom)); }
}

@media (max-width: 480px) {
  .app-shell { width: min(100% - 14px, 440px); }
  .hero { grid-template-columns: 58px minmax(0, 1fr); gap: 11px; padding: 16px; }
  .hero-brand { width: 58px; height: 58px; border-radius: 18px; font-size: 36px; }
  .hero-kicker { display: none; }
  .hero h1 { font-size: clamp(28px, 8.7vw, 38px); letter-spacing: -.028em; }
  .hero-subtitle { margin-top: 7px; font-size: 13.5px; line-height: 1.38; }
  .hero-tags { gap: 6px; }
  .hero-tags span { min-height: 28px; padding: 5px 9px; font-size: 11.5px; }
  .panel-header { padding: 17px 15px 14px; }
  .panel-title-group { gap: 10px; }
  .panel-icon { width: 39px; height: 39px; }
  .panel h2 { font-size: 21px; }
  .panel-header p { font-size: 13px; }
  #calculatorForm { padding: 16px 15px 17px; }
  .form-section { gap: 16px; }
  .form-section legend strong { font-size: 15px; }
  .form-section legend small { font-size: 12px; }
  label,
  .field-label { font-size: 14px; }
  input,
  select { height: 49px; font-size: 16px; }
  .field-meta { font-size: 11.8px; }
  .rate-switch { grid-template-columns: 1fr; }
  .rate-option > span { justify-content: flex-start; padding-left: 18px; }
  .format-preview,
  .privacy-note { grid-template-columns: 36px minmax(0, 1fr); padding: 13px; }
  .format-preview-icon,
  .privacy-icon { width: 35px; height: 35px; }
  .results-actions { display: grid; grid-template-columns: 1fr; }
  .calculation-badge { justify-self: start; }
  .button-copy-all { width: 100%; }
  .summary-grid { padding: 16px 15px 0; }
  .summary-card { padding: 16px; }
  .summary-card > strong { font-size: 16px; }
  .phrase-section { padding: 18px 15px; }
  .phrase-card-top { display: grid; gap: 10px; }
  .copy-chip { justify-self: start; }
  .phrase-card > p { font-size: 15.5px; line-height: 1.6; }
  .history-section { margin: 0 15px 15px; }
  .history-section summary { grid-template-columns: 36px minmax(0, 1fr) auto 20px; padding: 13px; }
  .history-toolbar { align-items: flex-start; flex-direction: column; }
  .history-item { grid-template-columns: minmax(0, 1fr); }
  .history-item-actions { justify-content: flex-end; }
  .history-action { width: 40px; min-height: 40px; }
  .feature-strip article { grid-template-columns: 41px minmax(0, 1fr); gap: 11px; padding: 15px; }
  .feature-icon { width: 40px; height: 40px; }
}

@media (hover: none) {
  .summary-card:hover,
  .phrase-card:hover,
  .segment-option:hover .segment-content,
  .rate-option:hover > span,
  .button:hover,
  .history-main:hover { transform: none; }
}

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