:root {
  color-scheme: dark;
  --bg: #181818;
  --panel: #222222;
  --panel-2: #282828;
  --field: #2b2b2b;
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.18);
  --text: #f4f4f4;
  --muted: #9d9d9d;
  --blue: #4aa7ff;
  --blue-2: #228cff;
  --shadow: 0 26px 70px rgba(0, 0, 0, 0.5);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  overflow: hidden;
  background: #050505;
  color: var(--text);
  letter-spacing: 0;
}

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

button {
  border: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

svg {
  display: block;
}

.app {
  position: relative;
  width: min(100%, 430px);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 38%, rgba(74, 167, 255, 0.12), transparent 24%),
    linear-gradient(180deg, #1a1a1a 0%, var(--bg) 100%);
  box-shadow: var(--shadow);
}

.market-view {
  min-height: 100vh;
  min-height: 100dvh;
}

.market-view {
  display: none;
  flex-direction: column;
  padding: calc(18px + env(safe-area-inset-top)) 22px calc(22px + env(safe-area-inset-bottom));
}

.market-view.active {
  display: flex;
}

.market-header,
.account-row,
.tool-row,
.buy-row,
.market-footer,
.info-head {
  display: flex;
  align-items: center;
}

.market-header {
  justify-content: space-between;
  min-height: 48px;
}

.market-header strong {
  font-size: 24px;
  font-weight: 950;
  line-height: 1;
}

.window-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 14px;
  background: transparent;
  color: #c8c8c8;
}

.icon-button svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.4;
}

.account-row {
  justify-content: space-between;
  gap: 16px;
  margin-top: 22px;
}

.account-pill,
.balance-pill,
.search-box,
.square-tool,
.market-card,
.dock,
.avatar-button {
  border: 1px solid var(--line-strong);
  background: rgba(38, 38, 38, 0.86);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.account-pill,
.balance-pill {
  min-height: 48px;
  border-radius: 24px;
  padding: 0 20px;
  color: #f2f2f2;
  font-size: 16px;
  font-weight: 950;
}

.account-pill {
  min-width: 102px;
}

.balance-pill {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.balance-pill span {
  color: var(--blue);
  font-size: 24px;
  line-height: 1;
}

.news-banner {
  position: relative;
  display: flex;
  min-height: 78px;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  overflow: hidden;
  border: 1px solid rgba(50, 95, 255, 0.7);
  border-radius: 22px;
  background:
    radial-gradient(circle at 80% 30%, rgba(91, 152, 255, 0.28), transparent 28%),
    linear-gradient(90deg, rgba(18, 54, 101, 0.88), rgba(29, 75, 130, 0.62));
  padding: 13px 18px;
  text-align: left;
}

.news-banner::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 55% 28%, rgba(255, 255, 255, 0.16) 0 1px, transparent 2px),
    radial-gradient(circle at 64% 61%, rgba(255, 255, 255, 0.14) 0 1px, transparent 2px);
}

.news-banner span,
.news-banner i {
  position: relative;
  z-index: 1;
}

.news-banner span {
  display: grid;
  gap: 3px;
  color: #fff;
  font-size: 20px;
  font-weight: 950;
  line-height: 1.08;
  transform: rotate(2deg);
}

.news-banner strong {
  display: block;
  font: inherit;
}

.news-banner i {
  display: grid;
  width: 66px;
  height: 58px;
  place-items: center;
  border-radius: 18px;
  background: #1b79d3;
  transform: rotate(8deg);
}

.news-banner svg {
  width: 35px;
  height: 35px;
  fill: none;
  stroke: #e7e5ff;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.tool-row {
  gap: 8px;
  margin-top: 14px;
}

.search-box {
  display: flex;
  min-width: 0;
  height: 58px;
  flex: 1;
  align-items: center;
  gap: 13px;
  border-radius: 22px;
  padding: 0 15px;
}

.search-box svg {
  width: 27px;
  height: 27px;
  flex: 0 0 auto;
  fill: none;
  stroke: #909090;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.5;
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #e9e9e9;
  font-size: 17px;
  font-weight: 850;
}

.search-box input::placeholder {
  color: #7b7b7b;
}

.square-tool {
  display: grid;
  width: 58px;
  height: 58px;
  flex: 0 0 58px;
  place-items: center;
  border-radius: 20px;
  color: #9f9f9f;
}

.square-tool svg {
  width: 27px;
  height: 27px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.4;
}

.text-tool {
  font-size: 12px;
  font-weight: 950;
}

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

.market-card {
  display: grid;
  min-height: 268px;
  align-content: end;
  border-radius: 23px;
  padding: 16px 14px 14px;
  text-align: left;
  transition: transform 150ms ease, border-color 150ms ease;
}

.market-card:active {
  transform: scale(0.985);
}

.market-card.hidden {
  display: none;
}

.card-art {
  display: grid;
  min-height: 130px;
  align-content: center;
  justify-items: center;
  margin-bottom: 20px;
}

.card-art svg {
  width: min(100%, 150px);
  height: 105px;
  overflow: visible;
  filter: drop-shadow(0 14px 26px rgba(0, 0, 0, 0.28));
}

.stars-art svg {
  filter: drop-shadow(0 0 18px rgba(255, 208, 77, 0.32));
}

.premium-art svg {
  filter: drop-shadow(0 0 18px rgba(120, 120, 255, 0.34));
}

.card-art em {
  margin-top: -6px;
  color: #fff;
  font-size: 11px;
  font-style: normal;
  font-weight: 950;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
}

.market-card > strong {
  color: #fff;
  font-size: 19px;
  font-weight: 950;
  line-height: 1.08;
}

.buy-row {
  justify-content: space-between;
  gap: 10px;
  margin-top: 15px;
}

.buy-row b {
  display: grid;
  min-width: 110px;
  min-height: 44px;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(180deg, #63b7ff 0%, #258cff 100%);
  color: #fff;
  font-size: 19px;
  font-weight: 950;
  box-shadow: 0 10px 22px rgba(36, 140, 255, 0.26);
}

.buy-row i {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 15px;
  background: rgba(48, 48, 48, 0.88);
  color: #a6a6a6;
  font-style: normal;
}

.buy-row svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.3;
}

.market-footer {
  gap: 12px;
  margin-top: auto;
  padding-top: 26px;
}

.dock {
  display: grid;
  min-height: 66px;
  flex: 1;
  grid-template-columns: 0.9fr 1.2fr 1.1fr;
  align-items: center;
  border-radius: 33px;
  padding: 8px;
}

.dock button {
  min-width: 0;
  min-height: 48px;
  border-radius: 24px;
  background: transparent;
  color: #8d8d8d;
  font-size: 15px;
  font-weight: 950;
}

.dock button.active {
  background: linear-gradient(180deg, #6bbdff, #2790ff);
  color: #fff;
}

.dock button:nth-child(3) {
  color: #5faeff;
}

.avatar-button {
  display: grid;
  width: 66px;
  height: 66px;
  flex: 0 0 66px;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  padding: 5px;
}

.avatar-button svg {
  width: 100%;
  height: 100%;
  border-radius: 50%;
}

.home-indicator {
  width: 86px;
  height: 8px;
  margin: 34px auto 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #777, #3f3f3f);
  opacity: 0.8;
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.1);
}

.sheet-layer {
  position: absolute;
  z-index: 8;
  inset: 0;
  display: flex;
  align-items: flex-end;
  padding-top: calc(136px + env(safe-area-inset-top));
}

.sheet-layer[hidden] {
  display: none;
}

.sheet-scrim {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(1.4px);
}

.checkout,
.info-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-height: calc(100dvh - 150px);
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-bottom: 0;
  border-radius: 24px 24px 0 0;
  background: var(--panel);
  padding: 12px 16px calc(24px + env(safe-area-inset-bottom));
  box-shadow: 0 -18px 44px rgba(0, 0, 0, 0.38);
}

.grabber {
  width: 42px;
  height: 5px;
  margin: 0 auto 20px;
  border-radius: 999px;
  background: #777;
}

.checkout h2,
.info-head h2 {
  margin: 0;
  color: #fff;
  font-size: 16px;
  font-weight: 950;
  line-height: 1.2;
}

.checkout h2 {
  margin-bottom: 18px;
  text-align: center;
}

.info-head {
  justify-content: space-between;
  margin-bottom: 16px;
}

.small-close {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: #303030;
  color: #bdbdbd;
}

.small-close svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.info-body {
  display: grid;
  gap: 12px;
}

.empty-state,
.copy-card,
.sheet-actions,
.profile-card,
.balance-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  padding: 15px;
}

.empty-state strong,
.copy-card strong,
.profile-card strong,
.balance-card strong {
  display: block;
  color: #fff;
  font-size: 18px;
  font-weight: 950;
}

.empty-state p,
.copy-card p,
.profile-card p,
.balance-card p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.copy-code {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  border-radius: 14px;
  background: #303030;
  padding: 12px;
  color: #fff;
  font-size: 14px;
  font-weight: 950;
}

.copy-code button,
.sheet-actions button {
  min-height: 40px;
  border-radius: 12px;
  background: linear-gradient(180deg, #64b8ff, #268dff);
  padding: 0 14px;
  color: #fff;
  font-weight: 950;
}

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

.sheet-actions button.secondary {
  border: 1px solid var(--line-strong);
  background: #303030;
  color: #d4d4d4;
}

.balance-card .balance-big {
  margin-top: 10px;
  color: var(--blue);
  font-size: 34px;
  font-weight: 950;
  line-height: 1;
}

.mode-tabs,
.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.mode-tabs {
  margin-bottom: 18px;
}

.mode-tabs button,
.segmented button,
.quick-row button,
.premium-option {
  border: 1px solid transparent;
  border-radius: 12px;
  background: #303030;
  color: #bdbdbd;
  font-weight: 900;
}

.mode-tabs button {
  min-height: 42px;
  font-size: 14px;
}

.mode-tabs button.active,
.segmented button.active {
  border-color: rgba(74, 167, 255, 0.85);
  color: var(--blue);
  background: rgba(74, 167, 255, 0.08);
}

.form-block {
  margin-top: 16px;
}

.form-block label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
  color: #dedede;
  font-size: 12px;
  font-weight: 950;
}

.form-block small {
  color: #8f8f8f;
  font-weight: 800;
}

.segmented button {
  min-height: 40px;
  font-size: 13px;
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

.quick-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
}

.quick-row button {
  min-height: 32px;
  border-radius: 10px;
  font-size: 12px;
}

.quick-row button.active,
.premium-option.active {
  border-color: var(--blue);
  color: #fff;
  background: rgba(74, 167, 255, 0.18);
}

#starsInput {
  width: 100%;
  height: 50px;
  margin-top: 11px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  outline: none;
  background: #292929;
  padding: 0 16px;
  color: #f0f0f0;
  font-size: 15px;
  font-weight: 800;
}

#starsInput:focus {
  border-color: rgba(74, 167, 255, 0.72);
}

.premium-grid {
  display: grid;
  gap: 9px;
}

.premium-option {
  display: flex;
  min-height: 56px;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  text-align: left;
}

.premium-option span,
.premium-option strong {
  font-size: 14px;
}

.summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.04);
  padding: 13px 14px;
}

.summary span {
  color: var(--muted);
  font-size: 13px;
}

.summary strong {
  font-size: 17px;
}

.continue-button {
  width: 100%;
  min-height: 52px;
  margin-top: 14px;
  border-radius: 15px;
  background: linear-gradient(180deg, #64b8ff 0%, #268dff 100%);
  color: #fff;
  font-size: 15px;
  font-weight: 950;
}

.continue-button:disabled {
  opacity: 0.56;
  cursor: not-allowed;
}

.toast {
  position: fixed;
  z-index: 10;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  width: min(360px, calc(100% - 28px));
  transform: translate(-50%, 16px);
  border: 1px solid var(--line-strong);
  border-radius: 15px;
  background: #242424;
  padding: 13px 14px;
  color: var(--text);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

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

@media (max-width: 390px) {
  .market-view {
    padding-right: 17px;
    padding-left: 17px;
  }

  .news-banner span {
    font-size: 18px;
  }

  .search-box {
    height: 54px;
    gap: 10px;
    padding: 0 13px;
  }

  .search-box input {
    font-size: 15px;
  }

  .square-tool {
    width: 52px;
    height: 52px;
    flex-basis: 52px;
  }

  .market-card {
    min-height: 248px;
    padding-right: 10px;
    padding-left: 10px;
  }

  .buy-row b {
    min-width: 92px;
    font-size: 17px;
  }

  .dock button {
    font-size: 13px;
  }
}

@media (max-width: 340px) {
  .tool-row {
    gap: 6px;
  }

  .search-box {
    height: 50px;
    gap: 8px;
    padding: 0 11px;
  }

  .search-box svg {
    width: 23px;
    height: 23px;
  }

  .search-box input {
    font-size: 13px;
  }

  .square-tool {
    width: 46px;
    height: 46px;
    flex-basis: 46px;
  }

  .account-row {
    gap: 8px;
  }

  .account-pill,
  .balance-pill {
    min-height: 44px;
    padding: 0 14px;
    font-size: 14px;
  }

  .product-grid {
    gap: 10px;
  }

  .market-card {
    min-height: 238px;
    padding-right: 8px;
    padding-left: 8px;
  }

  .market-card > strong {
    font-size: 17px;
  }

  .buy-row {
    gap: 6px;
  }

  .buy-row b {
    min-width: 82px;
    min-height: 40px;
    font-size: 16px;
  }

  .buy-row i {
    width: 40px;
    height: 40px;
    border-radius: 13px;
  }

  .avatar-button {
    width: 58px;
    height: 58px;
    flex-basis: 58px;
  }
}
