:root {
  color-scheme: light;

  --sky-top: #e3f1fb;
  --bg: #f4f9fd;
  --card: #ffffff;
  --text: #16232f;
  --hint: #7c8b9a;
  --accent: #2b7fd1;
  --accent-text: #ffffff;
  --secondary-bg: #e6f0fa;
  --nav-line: #dce8f3;
  --green: #34c759;
  --amber: #ff9500;
  --red: #e5484d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--bg) 320px, var(--bg) 100%);
  transition: background 0.4s ease;
  color: var(--text);
  padding: 16px;
  padding-bottom: 96px;
  position: relative;
}

.bg-mountains {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 260px;
  z-index: -1;
  pointer-events: none;
  background-image: url("/mountains-bg-summer-day.jpg");
  background-size: cover;
  background-position: bottom center;
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, black 30%);
  mask-image: linear-gradient(180deg, transparent 0%, black 30%);
}

.hidden {
  display: none !important;
}

.brand-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--header-text, var(--text));
}

.brand-mark {
  width: 32px;
  height: auto;
  flex-shrink: 0;
  object-fit: contain;
  filter: var(--logo-filter, none);
}

.auto-icon {
  width: 24px;
  height: auto;
  object-fit: contain;
  display: block;
}

#loading {
  text-align: center;
  padding: 40px 0;
  color: var(--hint);
}

.card {
  background: var(--card);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 2px rgba(22, 35, 47, 0.06);
}

.card h2, .card h3 {
  margin: 0 0 8px 0;
}

.muted {
  color: var(--hint);
}

.small {
  font-size: 13px;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot.green {
  background: var(--green);
}

.dot.red {
  background: var(--red);
}

.dot.amber {
  background: var(--amber);
}

.status-card .btn.renew {
  margin-top: 12px;
}

.status-text {
  font-size: 17px;
  font-weight: 600;
}

.devices-text {
  margin-top: 8px;
}

.btn {
  display: block;
  width: 100%;
  padding: 12px;
  margin-top: 8px;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.btn.secondary {
  background: var(--secondary-bg);
  color: var(--text);
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(22, 35, 47, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-box {
  background: var(--card);
  border-radius: 16px;
  padding: 20px;
  text-align: center;
  max-width: 90vw;
}

.qr-box img {
  max-width: 260px;
  width: 100%;
  border-radius: 8px;
  margin-bottom: 12px;
}

.btn.tiny {
  width: auto;
  margin-top: 0;
  padding: 8px 12px;
  font-size: 13px;
  flex-shrink: 0;
}

.btn.danger {
  background: var(--red);
  color: #fff;
}

.danger-zone {
  border: 1px solid #e5484d33;
}

.server-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.server-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border-radius: 12px;
  padding: 12px 14px;
  flex-wrap: wrap;
  box-shadow: 0 1px 2px rgba(22, 35, 47, 0.06);
}

.server-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.server-flag {
  font-size: 24px;
  flex-shrink: 0;
}

.server-info {
  flex: 1;
  min-width: 0;
}

.server-name {
  font-weight: 600;
  font-size: 15px;
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.option-grid .option {
  margin-top: 0;
  padding: 10px 4px;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  line-height: 1.2;
}

.option-grid .option-sub {
  font-size: 11px;
  opacity: 0.75;
}

.option-grid .option.selected {
  background: var(--accent);
  color: var(--accent-text);
}

.option-grid.cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.option-grid.cols-5 {
  grid-template-columns: repeat(5, 1fr);
}

.option-grid.cols-2 {
  grid-template-columns: repeat(2, 1fr);
}

.step-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.step-row h3 {
  margin: 0;
}

.step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--secondary-bg);
  color: var(--accent);
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  background: var(--card);
  border-top: 1px solid var(--nav-line);
  padding: 8px 0 max(8px, env(safe-area-inset-bottom));
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: none;
  border: none;
  color: var(--hint);
  font-size: 11px;
  padding: 4px;
  cursor: pointer;
  font-family: inherit;
}

.nav-item.active {
  color: var(--accent);
}

.nav-icon {
  font-size: 20px;
}

.wallet-balance-block {
  margin-top: 14px;
  padding: 14px;
  border-radius: 12px;
  background: var(--secondary-bg);
  text-align: center;
}

.wallet-balance-label {
  margin-bottom: 2px;
}

.wallet-balance-amount {
  font-size: 32px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.wallet-history {
  list-style: none;
  padding: 0;
  margin: 12px 0 0 0;
  border-top: 1px solid var(--nav-line);
  padding-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
