:root {
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #eef4f1;
  --surface-3: #f1f3f6;
  --text: #17181c;
  --muted: #69707d;
  --line: #dde2e8;
  --accent: #0c8f6f;
  --accent-2: #1f6feb;
  --danger: #b42318;
  --warning: #a15c00;
  --success: #137333;
  --shadow: 0 18px 50px rgb(28 35 48 / 12%);
  --radius: 8px;
  --tap: 44px;
}

[data-theme="dark"] {
  --bg: #111214;
  --surface: #1b1d21;
  --surface-2: #202823;
  --surface-3: #262930;
  --text: #f4f6f8;
  --muted: #a4abb6;
  --line: #343941;
  --accent: #4bd1a0;
  --accent-2: #7fb0ff;
  --danger: #ff877d;
  --warning: #ffc46b;
  --success: #75df91;
  --shadow: 0 18px 50px rgb(0 0 0 / 30%);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background:
    linear-gradient(135deg, rgb(12 143 111 / 10%), transparent 30%),
    linear-gradient(315deg, rgb(231 78 72 / 8%), transparent 34%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
}

button {
  min-height: var(--tap);
  border: 0;
  cursor: pointer;
}

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

.app-shell {
  width: min(100vw, 460px);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.screen {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
}

.topbar {
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  place-items: center;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

.brand h1,
.brand h2,
.hero h1,
.page-title {
  margin: 0;
  letter-spacing: 0;
}

.brand h1,
.brand h2 {
  overflow: hidden;
  font-size: 17px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand p,
.muted,
.field-hint,
.asset-meta,
.tx-meta,
.small {
  margin: 0;
  color: var(--muted);
}

.brand p {
  margin-top: 2px;
  font-size: 12px;
}

.icon-button,
.tab-button {
  display: inline-grid;
  min-width: var(--tap);
  height: var(--tap);
  place-items: center;
  border-radius: var(--radius);
  background: var(--surface-3);
  color: var(--text);
}

.icon-button:hover,
.tab-button:hover,
.secondary-button:hover {
  filter: brightness(0.98);
}

[data-theme="dark"] .icon-button:hover,
[data-theme="dark"] .tab-button:hover,
[data-theme="dark"] .secondary-button:hover {
  filter: brightness(1.1);
}

.content {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 18px;
  padding: 20px 18px 24px;
}

.hero {
  display: flex;
  min-height: 190px;
  flex-direction: column;
  justify-content: flex-end;
  gap: 14px;
  padding: 22px;
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 12% 20%, rgb(255 255 255 / 44%), transparent 26%),
    linear-gradient(135deg, #0c8f6f, #1f6feb 58%, #e74e48);
  color: #fff;
}

.hero h1 {
  max-width: 12ch;
  font-size: 34px;
  line-height: 0.98;
}

.hero p {
  max-width: 34ch;
  margin: 0;
  color: rgb(255 255 255 / 86%);
  line-height: 1.45;
}

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

.primary-button,
.secondary-button,
.danger-button,
.ghost-button {
  display: inline-flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-radius: var(--radius);
  padding: 0 16px;
  font-weight: 700;
  text-align: center;
}

.primary-button {
  background: var(--accent);
  color: #fff;
}

.secondary-button {
  border: 1px solid var(--line);
  background: var(--surface-3);
  color: var(--text);
}

.danger-button {
  border: 1px solid rgb(180 35 24 / 35%);
  background: rgb(180 35 24 / 10%);
  color: var(--danger);
}

.ghost-button {
  background: transparent;
  color: var(--accent-2);
}

.toolbar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.tool {
  display: flex;
  min-height: 78px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius);
  background: var(--surface-3);
  color: var(--text);
  font-weight: 700;
}

.tool .symbol,
.icon-button .symbol,
.tab-button .symbol {
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
}

.lock-icon {
  position: relative;
  display: block;
  width: 18px;
  height: 16px;
  border: 3px solid currentColor;
  border-radius: 4px;
  transform: translateY(4px);
}

.lock-icon::before {
  position: absolute;
  right: 2px;
  bottom: 11px;
  left: 2px;
  height: 12px;
  border: 3px solid currentColor;
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
  content: "";
}

.balance-panel {
  padding: 20px;
  border-radius: var(--radius);
  background: var(--surface-2);
}

.balance-label {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
}

.balance-value {
  margin: 0;
  font-size: 36px;
  font-weight: 850;
  line-height: 1;
}

.balance-sub {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.asset-list,
.tx-list,
.settings-list,
.admin-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.asset-row,
.tx-row,
.setting-row,
.admin-row,
.notice,
.form-panel,
.seed-panel,
.network-row {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.asset-row,
.tx-row,
.setting-row,
.admin-row,
.network-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
}

.asset-left,
.tx-left,
.network-left {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.coin {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--accent);
  font-weight: 850;
}

.asset-name,
.tx-title,
.network-name {
  margin: 0;
  overflow-wrap: anywhere;
  font-weight: 800;
}

.asset-meta,
.tx-meta,
.field-hint,
.small {
  font-size: 12px;
  line-height: 1.35;
}

.asset-balance,
.tx-amount,
.network-status {
  flex: 0 0 auto;
  font-weight: 850;
  text-align: right;
}

.positive {
  color: var(--success);
}

.negative {
  color: var(--danger);
}

.warning {
  color: var(--warning);
}

.tabs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.tab-button {
  width: 100%;
  height: 54px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.tab-button.active {
  background: var(--accent);
  color: #fff;
}

.tab-button span {
  display: block;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.page-title {
  font-size: 24px;
  line-height: 1.1;
}

.form-panel,
.seed-panel,
.notice {
  padding: 16px;
}

.notice {
  display: flex;
  gap: 12px;
  background: var(--surface-2);
}

.notice strong {
  display: block;
  margin-bottom: 4px;
}

.notice p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.seed-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.seed-word {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-3);
  overflow-wrap: anywhere;
}

.seed-word b {
  min-width: 22px;
  color: var(--muted);
  font-size: 12px;
}

.field-stack {
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 7px;
}

.verify-card {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

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

.choice-button {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-3);
  color: var(--text);
  font-weight: 800;
  overflow-wrap: anywhere;
  padding: 0 10px;
}

.choice-button.selected {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.field label {
  font-size: 13px;
  font-weight: 800;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: var(--tap);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  outline: 0;
  padding: 0 12px;
}

.textarea {
  min-height: 118px;
  padding: 12px;
  resize: vertical;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(12 143 111 / 18%);
}

.pin-dots {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 14px 0 4px;
}

.pin-dot {
  width: 12px;
  height: 12px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
}

.pin-dot.filled {
  border-color: var(--accent);
  background: var(--accent);
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.keypad button {
  height: 58px;
  border-radius: var(--radius);
  background: var(--surface-3);
  font-size: 22px;
  font-weight: 850;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.switch {
  position: relative;
  width: 52px;
  height: 30px;
  flex: 0 0 auto;
}

.switch input {
  position: absolute;
  opacity: 0;
}

.switch span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--line);
  transition: 160ms ease;
}

.switch span::after {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgb(0 0 0 / 18%);
  content: "";
  transition: 160ms ease;
}

.switch input:checked + span {
  background: var(--accent);
}

.switch input:checked + span::after {
  transform: translateX(22px);
}

.address-box {
  display: grid;
  gap: 10px;
}

.address-value {
  min-height: 64px;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface-3);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.qr-placeholder {
  display: grid;
  width: min(220px, 70vw);
  aspect-ratio: 1;
  place-items: center;
  margin: 0 auto;
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, var(--text) 12px, transparent 12px) 0 0 / 28px 28px,
    linear-gradient(var(--text) 12px, transparent 12px) 0 0 / 28px 28px,
    var(--surface);
  border: 14px solid var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
}

.qr-placeholder span {
  padding: 8px;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.qr-code {
  display: grid;
  width: min(240px, 72vw);
  aspect-ratio: 1;
  place-items: center;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 14px;
}

.qr-code svg {
  display: block;
  width: 100%;
  height: 100%;
}

.toast {
  position: fixed;
  bottom: 16px;
  left: 50%;
  z-index: 10;
  width: max-content;
  max-width: min(428px, calc(100vw - 32px));
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--text);
  font-weight: 750;
  text-align: center;
  transform: translateX(-50%);
}

.wallet-screen .toast {
  bottom: 96px;
}

.hidden {
  display: none !important;
}

@media (min-width: 720px) {
  body {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 24px;
  }

  .app-shell,
  .screen {
    min-height: min(820px, calc(100vh - 48px));
  }

  .app-shell {
    border: 1px solid var(--line);
    border-radius: var(--radius);
  }
}

@media (max-width: 360px) {
  .content,
  .topbar {
    padding-right: 14px;
    padding-left: 14px;
  }

  .hero h1,
  .balance-value {
    font-size: 30px;
  }

  .toolbar {
    grid-template-columns: 1fr;
  }

  .choice-grid {
    grid-template-columns: 1fr;
  }
}
