:root {
  --accent: #1717ff;
  --text: #202024;
  --muted: #68686d;
  --line: #ceced3;
  --danger: #c52b2b;
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
}

body {
  margin: 0;
  background: #ffffff;
  color: var(--text);
}

button,
input,
textarea {
  font: inherit;
}

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

.wallet-app {
  --control-height: clamp(48px, 6.5dvh, 55px);
  --description-height: clamp(76px, 11dvh, 96px);
  --phrase-height: clamp(150px, 24dvh, 220px);
  --section-gap: clamp(16px, 2.4dvh, 22px);
  position: relative;
  display: flex;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  padding: 0 16px 6px;
  overflow-x: hidden;
  overflow-y: auto;
  background: #ffffff;
}

.app-header {
  position: absolute;
  z-index: 2;
  top: 0;
  right: 11px;
  left: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 65px;
}

.app-header h1 {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  letter-spacing: -0.25px;
}

.brand-mark {
  flex: 0 0 auto;
  width: 22px;
  height: 25px;
}

.paste-button:focus-visible,
.learn-more-button:focus-visible,
.dialog-close:focus-visible {
  outline: 3px solid rgb(23 23 255 / 22%);
  outline-offset: 2px;
}

.restore-form {
  display: flex;
  flex: 1;
  flex-direction: column;
  width: 100%;
  min-width: 0;
  padding-top: clamp(66px, 8.8dvh, 76px);
}

.form-field label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
  line-height: 18px;
}

.phrase-input-wrap {
  position: relative;
}

.email-input {
  display: block;
  width: 100%;
  height: var(--control-height);
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  background: #ffffff;
  color: #2c2c30;
  font-size: 17px;
  font-weight: 600;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.email-input::placeholder {
  color: #85858a;
}

.email-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.email-input[aria-invalid="true"] {
  border-color: var(--danger);
  box-shadow: 0 0 0 1px rgb(197 43 43 / 12%);
}

.issue-field,
.phrase-field {
  margin-top: var(--section-gap);
}

.select-wrap {
  position: relative;
}

.issue-select {
  display: block;
  width: 100%;
  height: var(--control-height);
  padding: 0 50px 0 18px;
  overflow: hidden;
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  background: #ffffff;
  color: #2c2c30;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.issue-select:required:invalid {
  color: #77777c;
}

.issue-select option {
  color: #2c2c30;
}

.issue-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.issue-select[aria-invalid="true"] {
  border-color: var(--danger);
  box-shadow: 0 0 0 1px rgb(197 43 43 / 12%);
}

.select-chevron {
  position: absolute;
  top: 50%;
  right: 17px;
  width: 20px;
  height: 20px;
  transform: translateY(-50%);
  fill: none;
  stroke: #626267;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  pointer-events: none;
}

.issue-description-field {
  margin-top: 14px;
}

.optional-label {
  color: #85858a;
  font-weight: 400;
}

.issue-description-field textarea {
  display: block;
  width: 100%;
  height: var(--description-height);
  min-height: var(--description-height);
  padding: 12px 16px;
  resize: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  background: #ffffff;
  color: #2c2c30;
  font-size: 16px;
  line-height: 1.45;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.issue-description-field textarea::placeholder {
  color: #85858a;
}

.issue-description-field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.phrase-input-wrap {
  height: var(--phrase-height);
}

.phrase-input-wrap textarea {
  display: block;
  width: 100%;
  height: 100%;
  padding: 14px 17px 46px;
  resize: none;
  border: 1.5px solid var(--accent);
  border-radius: 10px;
  outline: none;
  background: #ffffff;
  color: #252529;
  font-size: 16px;
  line-height: 1.55;
  transition: box-shadow 160ms ease;
}

.phrase-input-wrap textarea:focus {
  box-shadow: 0 0 0 1px rgb(23 23 255 / 16%);
}

.paste-button {
  position: absolute;
  right: 10px;
  bottom: 9px;
  min-width: 58px;
  min-height: 35px;
  padding: 6px 2px;
  border: 0;
  border-radius: 7px;
  background: #ffffff;
  color: var(--accent);
  font-size: 17px;
  font-weight: 650;
  cursor: pointer;
}

.paste-button:hover,
.learn-more-button:hover {
  color: #0000d1;
}

.helper-text {
  margin: clamp(8px, 1.4dvh, 12px) 10px 0;
  color: #737378;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.25;
  text-align: center;
}

.field-error {
  min-height: 0;
  margin: 0;
  color: var(--danger);
  font-size: 13px;
  line-height: 1.25;
}

.field-error:not(:empty) {
  margin-top: 6px;
}

.phrase-error {
  text-align: center;
}

.form-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  margin-top: auto;
}

.restore-button {
  width: 100%;
  min-height: 52px;
  padding: 12px 24px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: none;
  color: #ffffff;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  transition: background 140ms ease, transform 80ms ease;
}

.restore-button:hover {
  background: #0000e8;
}

.restore-button:active {
  transform: scale(0.992);
}

.restore-button:focus-visible,
.dialog-done:focus-visible {
  outline: 3px solid rgb(23 23 255 / 25%);
  outline-offset: 3px;
}

.learn-more-button {
  align-self: center;
  margin: clamp(12px, 2dvh, 20px) 0 0;
  padding: 6px;
  border: 0;
  background: transparent;
  color: #1010ce;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
}

.info-dialog {
  width: min(390px, calc(100% - 32px));
  padding: 24px;
  border: 0;
  border-radius: 18px;
  box-shadow: 0 20px 70px rgb(0 0 0 / 22%);
  color: var(--text);
}

.info-dialog::backdrop {
  background: rgb(20 20 25 / 42%);
  backdrop-filter: blur(2px);
}

.dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.dialog-heading h2 {
  margin: 0;
  font-size: 21px;
}

.dialog-close {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #eeeeF1;
  color: #333338;
  font-size: 25px;
  line-height: 1;
  cursor: pointer;
}

.info-dialog p {
  margin: 18px 0 22px;
  color: #5d5d62;
  font-size: 15px;
  line-height: 1.55;
}

.dialog-done {
  width: 100%;
  min-height: 46px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 650;
  cursor: pointer;
}

.toast {
  position: fixed;
  z-index: 20;
  bottom: 24px;
  left: 50%;
  max-width: calc(100% - 40px);
  padding: 10px 16px;
  transform: translate(-50%, 20px);
  border-radius: 999px;
  background: #29292e;
  color: #ffffff;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
  white-space: nowrap;
}

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

@media (max-height: 720px) {
  .wallet-app {
    --control-height: 48px;
    --description-height: 72px;
    --phrase-height: 128px;
    --section-gap: 14px;
  }

  .app-header {
    height: 60px;
  }

  .restore-form {
    padding-top: 58px;
  }

  .issue-description-field {
    margin-top: 10px;
  }

  .issue-description-field textarea {
    padding: 10px 14px;
  }

  .phrase-input-wrap textarea {
    padding: 10px 14px 40px;
  }

  .paste-button {
    right: 8px;
    bottom: 5px;
    min-height: 32px;
    font-size: 16px;
  }

  .helper-text {
    margin-top: 7px;
    font-size: 14px;
    line-height: 1.2;
  }

  .restore-button {
    min-height: 50px;
    padding-block: 11px;
  }

  .learn-more-button {
    margin-top: 8px;
    padding: 5px;
    font-size: 16px;
  }
}

@media (max-width: 360px) {
  .wallet-app {
    padding-inline: 12px;
  }

  .app-header {
    right: 7px;
    left: 7px;
  }

  .app-header h1 {
    font-size: 18px;
  }

  .brand-mark {
    width: 20px;
    height: 23px;
  }

  .helper-text {
    margin-inline: 2px;
    font-size: 14px;
  }

  .mobile-break {
    display: none;
  }
}

@media (max-height: 620px) {
  .wallet-app {
    --control-height: 43px;
    --description-height: 54px;
    --phrase-height: 82px;
    --section-gap: 8px;
    padding-bottom: 4px;
  }

  .app-header {
    height: 54px;
  }

  .restore-form {
    padding-top: 52px;
  }

  .form-field label {
    margin-bottom: 5px;
    font-size: 14px;
    line-height: 17px;
  }

  .email-input,
  .issue-select {
    font-size: 15px;
  }

  .email-input {
    padding-inline: 13px;
  }

  .issue-select {
    padding-right: 42px;
    padding-left: 13px;
  }

  .issue-description-field {
    margin-top: 7px;
  }

  .issue-description-field textarea {
    padding: 7px 11px;
    font-size: 14px;
    line-height: 1.25;
  }

  .phrase-input-wrap textarea {
    padding: 7px 11px 33px;
    font-size: 14px;
    line-height: 1.35;
  }

  .paste-button {
    right: 7px;
    bottom: 3px;
    min-width: 52px;
    min-height: 29px;
    padding-block: 4px;
    font-size: 15px;
  }

  .helper-text {
    margin: 4px 1px 0;
    font-size: 12.5px;
    line-height: 1.15;
  }

  .restore-button {
    min-height: 44px;
    padding-block: 9px;
    font-size: 16px;
  }

  .learn-more-button {
    margin-top: 3px;
    padding: 3px;
    font-size: 15px;
    line-height: 1.1;
  }
}

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