:root {
  color: #1c2430;
  background: #f7f8fb;
  font-family: Inter, "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: #f7f8fb;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(20, 125, 100, 0.25);
  outline-offset: 2px;
}

.app-shell {
  min-height: 100vh;
  padding: 56px 24px 72px;
}

.workspace {
  width: min(100%, 1350px);
  margin: 0 auto;
}

.masthead {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 18px;
}

h1 {
  margin: 0;
  color: #1c2430;
  font-size: 48px;
  font-weight: 700;
  line-height: 1;
}

.product-selectors {
  display: grid;
  grid-template-columns: repeat(2, minmax(238px, 1fr));
  gap: 16px;
}

.product-select {
  position: relative;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 14px;
  align-items: center;
  min-height: 74px;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid #c8d0dc;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 10px 30px rgba(27, 36, 48, 0.06);
}

.product-select:has(select:disabled) {
  background: #fbfcfd;
  cursor: default;
}

.product-select:has(select:not(:disabled)),
.product-select:has(select:not(:disabled)) .select-icon,
.product-select:has(select:not(:disabled)) .select-copy,
.product-select:has(select:not(:disabled)) .select-chevron,
.product-select select:not(:disabled) {
  cursor: pointer;
}

.select-icon {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 6px;
  color: #6d7b8d;
  font-size: 17px;
  font-weight: 700;
  line-height: 1;
}

.service-icon {
  position: relative;
  border: 2px solid #a9b7c9;
  border-radius: 50%;
}

.service-icon::after {
  position: absolute;
  width: 12px;
  height: 12px;
  border: 2px solid #a9b7c9;
  border-radius: 50%;
  content: "";
}

.flag-icon {
  border: 1px solid #d6dde7;
  background: #eef2f6;
}

.select-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.select-caption {
  color: #58708b;
  font-size: 14px;
  line-height: 18px;
}

.product-select select {
  width: 100%;
  min-width: 0;
  padding: 0 2px 0 0;
  border: 0;
  appearance: none;
  background: transparent;
  color: #172337;
  font-size: 20px;
  font-weight: 700;
  line-height: 26px;
  text-overflow: ellipsis;
}

.product-select select:disabled {
  color: #1c2430;
  cursor: default;
  opacity: 1;
}

.select-chevron {
  width: 11px;
  height: 11px;
  margin-top: -4px;
  border-right: 2px solid #64748b;
  border-bottom: 2px solid #64748b;
  transform: rotate(45deg);
}

.control-panel {
  padding: 24px;
  border: 1px solid #d9dee7;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 18px 60px rgba(27, 36, 48, 0.08);
}

.field-label {
  display: block;
  margin-bottom: 8px;
  color: #506a89;
  font-size: 16px;
  line-height: 22px;
}

.card-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px;
  gap: 10px;
}

#cardInput {
  width: 100%;
  min-height: 64px;
  padding: 0 18px;
  border: 1px solid #c8d0dc;
  border-radius: 7px;
  color: #172337;
  background: #ffffff;
  font-size: 20px;
  line-height: 1;
}

.paste-button,
.actions button {
  min-height: 52px;
  border: 1px solid #c8d0dc;
  border-radius: 7px;
  background: #ffffff;
  color: #172337;
  font-weight: 700;
}

.paste-button {
  align-self: stretch;
  font-size: 18px;
}

.actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.actions button {
  padding: 0 14px;
  font-size: 18px;
  white-space: nowrap;
}

.actions .primary-action {
  border-color: #0f6b55;
  background: #147d64;
  color: #ffffff;
}

.actions .danger-action {
  border-color: #ffc9c2;
  background: #fff1f0;
  color: #b42318;
}

button:hover:not(:disabled) {
  filter: brightness(0.98);
}

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

.notice {
  min-height: 24px;
  margin: 10px 2px 0;
  color: #147d64;
  font-size: 15px;
  line-height: 22px;
}

.notice.error {
  color: #b42318;
}

.status-area {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.primary-results,
.meta-results {
  display: grid;
  gap: 14px;
}

.primary-results {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.meta-results {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.result-card,
.meta-card {
  display: grid;
  align-content: space-between;
  min-width: 0;
  border-radius: 8px;
  box-shadow: 0 12px 34px rgba(27, 36, 48, 0.06);
}

.result-card {
  position: relative;
  min-height: 166px;
  padding: 24px;
}

.result-card > span {
  padding-right: 48px;
}

.result-card span,
.meta-card span {
  color: #506a89;
  font-size: 16px;
  line-height: 22px;
}

.result-card strong {
  overflow-wrap: anywhere;
  color: #172337;
  font-size: 42px;
  font-weight: 700;
  line-height: 1.08;
}

.result-copy-button {
  position: absolute;
  top: 16px;
  right: 16px;
  display: grid;
  width: 34px;
  height: 34px;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(80, 106, 137, 0.24);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.82);
  color: #506a89;
  box-shadow: 0 4px 12px rgba(27, 36, 48, 0.08);
}

.result-copy-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.result-copy-button:hover:not(:disabled) {
  background: #ffffff;
}

.result-copy-button:focus-visible {
  outline: 2px solid #2f6fed;
  outline-offset: 2px;
}

.phone-result .result-copy-button {
  color: #08705b;
}

.code-result .result-copy-button {
  color: #365fba;
}

.phone-result {
  border: 1px solid #c8d7d2;
  background: #f8fcfa;
}

.phone-result strong:not(:empty) {
  color: #08705b;
}

.code-result {
  border: 1px solid #b8cdfd;
  background: #e8f0ff;
}

.meta-card {
  min-height: 122px;
  padding: 20px 22px;
  border: 1px solid #d9dee7;
  background: #ffffff;
}

.meta-card strong {
  overflow-wrap: anywhere;
  color: #172337;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.12;
}

.toast {
  position: fixed;
  z-index: 10;
  left: 50%;
  top: 50%;
  min-width: 166px;
  padding: 22px 24px;
  border-radius: 8px;
  background: rgba(28, 36, 48, 0.86);
  color: #ffffff;
  font-size: 16px;
  line-height: 22px;
  text-align: center;
  transform: translate(-50%, -50%);
}

@media (max-width: 980px) {
  .app-shell {
    padding-top: 36px;
  }

  .masthead {
    align-items: start;
    flex-direction: column;
  }

  .product-selectors {
    width: 100%;
  }

  .product-select {
    min-width: 0;
  }

  .actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .app-shell {
    padding: 28px 16px 40px;
  }

  h1 {
    font-size: 40px;
  }

  .product-selectors,
  .primary-results,
  .meta-results {
    grid-template-columns: 1fr;
  }

  .control-panel {
    padding: 18px;
  }

  .card-input-row {
    grid-template-columns: minmax(0, 1fr) 78px;
  }

  #cardInput {
    min-height: 56px;
    font-size: 18px;
  }

  .paste-button,
  .actions button {
    min-height: 50px;
    font-size: 16px;
  }

  .result-card {
    min-height: 138px;
    padding: 20px;
  }

  .result-card strong {
    font-size: 34px;
  }
}

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

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

  .paste-button {
    min-height: 46px;
  }
}
