/* Blixt Wallet — shared UI */

:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --blixt-orange: #d37506;
  --blixt-orange-dark: #a86205;
  --blixt-orange-light: #e8942e;
  --bg: #0d0d0f;
  --surface: #161618;
  --surface-elevated: #1e1e22;
  --surface-inset: #121214;
  --text: #f5f5f7;
  --muted: #9ca3af;
  --line: #2a2a30;
  --line-soft: #222228;
  --positive: #3ddc84;
  --negative: #ff6b6b;
  --info: #6eb5ff;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --shadow-card: 0 2px 8px rgb(0 0 0 / 28%), 0 1px 0 rgb(255 255 255 / 4%) inset;
  --shadow-btn: 0 4px 14px rgb(211 117 6 / 28%);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur: 180ms;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

html[data-theme="light"] {
  --bg: #f4f4f6;
  --surface: #ffffff;
  --surface-elevated: #ffffff;
  --surface-inset: #f0f0f3;
  --text: #111114;
  --muted: #5c6370;
  --line: #e3e5ea;
  --line-soft: #eceef2;
  --shadow-card: 0 2px 12px rgb(15 23 42 / 8%), 0 1px 0 rgb(255 255 255 / 80%) inset;
  --shadow-btn: 0 4px 14px rgb(211 117 6 / 22%);
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  color-scheme: dark;
  touch-action: manipulation;
}

html[data-theme="light"] { color-scheme: light; }

body {
  margin: 0;
  min-height: 100dvh;
  background: #050506;
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
  overscroll-behavior: none;
}

a { color: inherit; text-decoration: none; }

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

select, textarea,
input[type="text"], input[type="email"], input[type="search"],
input[type="password"], input[type="number"], input[type="tel"] {
  font-size: 16px;
}

button { cursor: pointer; }

select, textarea,
input[type="text"], input[type="email"], input[type="search"] {
  appearance: none;
  -webkit-appearance: none;
}

/* Shell */

.app-shell {
  width: 100%;
  max-width: 430px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.page-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Top bar */

.blixt-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: calc(var(--safe-top) + 10px) 16px 10px;
  background: var(--bg);
  border-bottom: 1px solid var(--line-soft);
}

.blixt-topbar__brand {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--blixt-orange);
  text-transform: uppercase;
}

.blixt-topbar__actions,
.blixt-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.theme-toggle,
.language-picker__trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}

.theme-toggle:hover,
.language-picker__trigger:hover {
  border-color: color-mix(in oklab, var(--blixt-orange) 45%, var(--line));
}

.language-picker { position: relative; min-width: 112px; }

.language-picker__trigger {
  width: 100%;
  justify-content: space-between;
  gap: 6px;
}

.language-picker__menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 30;
  width: 168px;
  max-height: 240px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-elevated);
  display: none;
  box-shadow: 0 16px 40px rgb(0 0 0 / 45%);
}

.language-picker.is-open .language-picker__menu { display: block; }

.language-picker__option {
  width: 100%;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 9px 10px;
  font-size: 13px;
}

.language-picker__option.is-active {
  background: color-mix(in oklab, var(--blixt-orange) 18%, transparent);
  color: var(--blixt-orange-light);
}

/* Hero (home) */

.blixt-hero {
  background: linear-gradient(165deg, var(--blixt-orange) 0%, var(--blixt-orange-dark) 100%);
  color: #fff;
  padding: calc(var(--safe-top) + 14px) 20px 22px;
  box-shadow: 0 1px 0 rgb(0 0 0 / 12%) inset;
}

.blixt-hero .theme-toggle,
.blixt-hero .language-picker__trigger {
  border-color: rgb(255 255 255 / 28%);
  background: rgb(0 0 0 / 14%);
  color: #fff;
}

.blixt-hero .language-picker__menu {
  background: var(--surface-elevated);
  color: var(--text);
}

.blixt-hero__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 18px;
}

.blixt-hero__brand {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.95;
}

.blixt-hero__title {
  margin: 0;
  font-size: clamp(24px, 5.5vw, 30px);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.blixt-hero__subtitle {
  margin: 10px 0 0;
  font-size: 14px;
  line-height: 1.5;
  opacity: 0.92;
  max-width: 36ch;
}

/* Page header (inner screens) */

.blixt-page-header {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: calc(var(--safe-top) + 6px) 16px 14px;
  background: linear-gradient(180deg, var(--blixt-orange) 0%, var(--blixt-orange-dark) 100%);
  color: #fff;
  box-shadow: 0 4px 20px rgb(0 0 0 / 22%);
}

.blixt-page-header__back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgb(255 255 255 / 22%);
  border-radius: 50%;
  background: rgb(0 0 0 / 12%);
  color: #fff;
  font-size: 18px;
  line-height: 1;
  transition: background-color var(--dur) var(--ease);
}

.blixt-page-header__back:hover {
  background: rgb(0 0 0 / 22%);
}

.blixt-page-header__title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* Page body */

.blixt-page-body {
  flex: 1;
  padding: 16px;
  background: var(--bg);
}

.blixt-page-body--flush {
  padding: 0;
}

.blixt-page-body__section {
  padding: 0 16px 14px;
}

/* Cards & notices */

.blixt-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: 18px;
  box-shadow: var(--shadow-card);
}

.blixt-card__title {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.blixt-card__subtitle {
  margin: 0 0 16px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}

.blixt-notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface-inset);
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
}

.blixt-notice::before {
  content: "◆";
  flex-shrink: 0;
  margin-top: 1px;
  font-size: 10px;
  color: var(--blixt-orange);
}

.blixt-notice--info {
  border-color: color-mix(in oklab, var(--info) 35%, var(--line));
  background: color-mix(in oklab, var(--info) 8%, var(--surface-inset));
}

.blixt-notice--info::before {
  content: "i";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: color-mix(in oklab, var(--info) 25%, transparent);
  color: var(--info);
  font-size: 11px;
  font-weight: 800;
  font-style: italic;
}

.blixt-notice--accent {
  border-color: color-mix(in oklab, var(--blixt-orange) 40%, var(--line));
  background: color-mix(in oklab, var(--blixt-orange) 10%, var(--surface-inset));
  color: color-mix(in oklab, var(--text) 75%, var(--muted));
}

.blixt-notice--accent::before {
  color: var(--blixt-orange-light);
}

/* Form controls */

.blixt-section-label {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.blixt-choice-group {
  display: grid;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-inset);
  overflow: hidden;
}

.blixt-choice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 15px;
  line-height: 1.35;
  color: var(--text);
  transition: background-color var(--dur) var(--ease);
}

.blixt-choice:last-child { border-bottom: 0; }

.blixt-choice:has(input:checked) {
  background: color-mix(in oklab, var(--blixt-orange) 12%, var(--surface-inset));
}

.blixt-choice small {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
}

.blixt-choice input[type="radio"] {
  appearance: none;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  border-radius: 50%;
  border: 2px solid var(--line);
  flex-shrink: 0;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.blixt-choice input[type="radio"]:checked {
  border-color: var(--blixt-orange);
  box-shadow: inset 0 0 0 4px var(--blixt-orange);
}

.blixt-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.blixt-field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.blixt-input,
.blixt-textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-inset);
  color: var(--text);
  text-align: left;
  font-size: 15px;
  line-height: 1.45;
  padding: 13px 14px;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.blixt-input { min-height: 50px; }

.blixt-textarea {
  min-height: 148px;
  resize: vertical;
}

.blixt-input::placeholder,
.blixt-textarea::placeholder {
  color: color-mix(in oklab, var(--muted) 88%, transparent);
  opacity: 1;
}

.blixt-input:focus,
.blixt-textarea:focus {
  outline: none;
  border-color: var(--blixt-orange);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--blixt-orange) 22%, transparent);
}

.blixt-form-row {
  display: grid;
  grid-template-columns: minmax(0, 40%) minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--surface);
}

.blixt-form-row label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.blixt-form-row select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-inset);
  color: var(--text);
  text-align: right;
  font-size: 14px;
}

.blixt-form-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.blixt-field-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px 16px;
  background: transparent;
}

.blixt-field-block label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.blixt-form-panel .blixt-field-block {
  border-bottom: 0;
}

.blixt-field-row-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.blixt-field-row-toolbar label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.blixt-btn-ghost {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}

.blixt-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0 2px;
  font-size: 14px;
  color: var(--text);
}

.blixt-toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--blixt-orange);
}

.blixt-trust-list {
  margin: 16px 0 0;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-soft);
  background: var(--surface-inset);
  list-style: none;
}

.blixt-trust-list li {
  position: relative;
  padding: 4px 0 4px 18px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
}

.blixt-trust-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--blixt-orange);
}

/* Buttons */

.blixt-actions {
  margin-top: 18px;
}

.blixt-actions--sticky {
  margin-top: auto;
  padding: 12px 16px calc(var(--safe-bottom) + 12px);
  background: linear-gradient(180deg, transparent 0%, var(--bg) 24%);
  border-top: 1px solid var(--line-soft);
}

.blixt-btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 50px;
  border: 0;
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, var(--blixt-orange-light) 0%, var(--blixt-orange) 100%);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-shadow: var(--shadow-btn);
  transition: transform var(--dur) var(--ease), filter var(--dur) var(--ease);
}

.blixt-btn-primary:hover {
  filter: brightness(1.05);
}

.blixt-btn-primary:active {
  transform: scale(0.99);
  filter: brightness(0.95);
}

.blixt-btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.blixt-btn-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

/* Helper / error text */

.blixt-helper {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
}

.blixt-error {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--negative);
  display: none;
}

/* Success screen */

.blixt-success {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 20px calc(var(--safe-bottom) + 20px);
  text-align: center;
  background: var(--bg);
}

.blixt-success__icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: color-mix(in oklab, var(--positive) 18%, transparent);
  border: 2px solid color-mix(in oklab, var(--positive) 45%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  color: var(--positive);
  margin-bottom: 16px;
}

.blixt-success__title {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.blixt-success__message {
  margin: 0 0 24px;
  max-width: 28ch;
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
}

.blixt-success__actions {
  width: 100%;
  display: grid;
  gap: 10px;
}

/* Modal */

.blixt-modal {
  position: fixed;
  inset: 0;
  background: rgb(0 0 0 / 62%);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}

.blixt-modal__card {
  width: 100%;
  max-width: 340px;
  background: var(--surface-elevated);
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  padding: 20px;
  box-shadow: 0 24px 48px rgb(0 0 0 / 45%);
}

.blixt-modal__title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
}

.blixt-modal__text {
  margin: 10px 0 0;
  font-size: 14px;
  line-height: 1.45;
  color: var(--muted);
}

.blixt-progress {
  margin-top: 16px;
  height: 6px;
  border-radius: 99px;
  background: var(--line);
  overflow: hidden;
}

.blixt-progress > div {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--blixt-orange-dark), var(--blixt-orange-light));
  transition: width var(--dur) var(--ease);
}

.amount-positive { color: var(--positive); }
.amount-negative { color: var(--negative); }

@media (min-width: 901px) {
  .app-shell {
    max-width: 430px;
    margin: 28px auto;
    min-height: calc(100dvh - 56px);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--line);
    box-shadow: 0 32px 64px rgb(0 0 0 / 55%);
  }
}
