:root {
  --bg: #071015;
  --surface: #101c22;
  --surface-2: #162831;
  --ink: #edf7f4;
  --muted: #8aa09d;
  --line: rgba(226, 246, 238, .12);
  --accent: #18a7c9;
  --accent-2: #f2b84b;
  --danger: #e36b54;
  --shadow: 0 14px 38px rgba(0, 0, 0, .24);
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  background: #050b0f;
  overscroll-behavior-y: auto;
}

body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  background:
    radial-gradient(circle at 20% -8%, rgba(24, 167, 201, .32), transparent 18rem),
    radial-gradient(circle at 92% 8%, rgba(242, 184, 75, .18), transparent 17rem),
    linear-gradient(160deg, #050b0f 0%, #0b1b22 52%, #05090c 100%);
  font-family: ui-rounded, "SF Pro Rounded", "Avenir Next", Verdana, sans-serif;
  overscroll-behavior-y: auto;
  -webkit-overflow-scrolling: touch;
}

button, input {
  font: inherit;
}

button {
  border: 0;
  border-radius: 18px;
  padding: 11px 13px;
  background: var(--accent);
  color: #041017;
  font-weight: 800;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transform: translateY(0) scale(1);
  transition: transform .12s ease, filter .12s ease, background-color .12s ease;
  will-change: transform;
}

button:active {
  transform: translateY(1px) scale(.975);
  filter: brightness(.92);
}

.shell {
  width: min(720px, 100%);
  margin: 0 auto;
  padding: calc(58px + env(safe-area-inset-top, 0px)) 12px 40px;
  min-height: 118vh;
}

.ptr {
  position: fixed;
  top: calc(14px + env(safe-area-inset-top, 0px));
  left: 50%;
  z-index: 5;
  transform: translate(-50%, -42px);
  opacity: 0;
  padding: 8px 13px;
  border-radius: 999px;
  background: rgba(237, 247, 244, .12);
  border: 1px solid rgba(237, 247, 244, .16);
  color: #edf7f4;
  font-size: 12px;
  font-weight: 900;
  pointer-events: none;
  transition: transform .16s ease, opacity .16s ease;
}

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

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 2px 0 14px;
  color: #fbf7ea;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  position: relative;
  z-index: 1;
  width: 58px;
  height: 58px;
  display: block;
  object-fit: cover;
  object-position: center;
  border-radius: 14px;
  box-shadow: 0 10px 28px rgba(24, 167, 201, .28);
}

.brand-logo-fallback,
.menu-logo-fallback {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: linear-gradient(135deg, #18a7c9, #f2b84b);
  color: #041017;
  font-weight: 950;
}

.brand-logo-fallback {
  width: 58px;
  height: 58px;
  border-radius: 14px;
  margin-right: -70px;
}

.brand p {
  margin: 0;
  font-weight: 900;
  font-size: 19px;
}

.menu-btn {
  width: 48px;
  height: 48px;
  display: grid;
  align-content: center;
  gap: 5px;
  padding: 0 13px;
  border-radius: 15px;
  background: rgba(237, 247, 244, .09);
  border: 1px solid rgba(237, 247, 244, .14);
}

.menu-btn span {
  display: block;
  height: 3px;
  border-radius: 999px;
  background: #edf7f4;
}

.hero-card, .add-card, .device, .empty, .notice {
  background: rgba(16, 28, 34, .92);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.hero-card {
  padding: 14px;
  margin-bottom: 10px;
  background:
    linear-gradient(135deg, rgba(24, 167, 201, .35), rgba(242, 184, 75, .18)),
    var(--surface);
}

.section-title {
  color: #fbf7ea;
  margin: 4px 0 12px;
}

.section-title h1 {
  margin: 6px 0 0;
  font-size: clamp(26px, 8vw, 42px);
  line-height: 1;
  letter-spacing: -.04em;
}

.hero-card div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
}

.label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.hero-card strong {
  font-size: 30px;
  line-height: 1;
  letter-spacing: -.06em;
}

.hero-card p {
  margin: 12px 0 0;
  color: rgba(17, 21, 16, .68);
  font-weight: 700;
}

.add-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
  margin-bottom: 12px;
}

.faq-card {
  margin-bottom: 10px;
  padding: 14px;
  border-radius: 20px;
  background: rgba(16, 28, 34, .92);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.faq-card h2 {
  margin: 0 0 8px;
  font-size: 18px;
  letter-spacing: -.03em;
}

.faq-card p {
  margin: 0;
  color: var(--muted);
  font-weight: 650;
  line-height: 1.42;
}

label {
  display: block;
  margin: 0 0 7px 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .06em;
}

input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: var(--surface-2);
  color: var(--ink);
  font-weight: 850;
  outline: none;
}

input:focus {
  border-color: rgba(17, 21, 16, .55);
  box-shadow: 0 0 0 4px rgba(187, 243, 107, .22);
}

.notice {
  margin-bottom: 10px;
  padding: 11px 13px;
  color: var(--accent-2);
  font-weight: 800;
}

.notice.bad {
  color: var(--danger);
}

.hidden {
  display: none !important;
}

.devices {
  display: grid;
  gap: 10px;
}

.device {
  padding: 13px;
  animation: rise .26s ease both;
}

@keyframes rise {
  from { transform: translateY(8px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.device-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.device h2 {
  margin: 0 0 3px;
  font-size: 21px;
  letter-spacing: -.03em;
}

.device p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.country-badge {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 7px 9px;
  background: rgba(242, 184, 75, .16);
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 900;
}

.countries {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 12px 0;
  padding: 4px;
  border-radius: 16px;
  background: rgba(237, 247, 244, .07);
}

.countries button {
  padding: 9px 7px;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
}

.countries button.active {
  background: rgba(24, 167, 201, .22);
  color: #edf7f4;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .1);
}

.actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 7px;
}

.secondary {
  background: rgba(237, 247, 244, .09);
  color: #edf7f4;
}

.danger {
  background: rgba(227, 107, 84, .13);
  color: var(--danger);
}

.empty {
  padding: 18px;
  text-align: center;
  color: var(--muted);
  font-weight: 850;
}

.sheet {
  position: fixed;
  inset: 0;
  z-index: 20;
}

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

.menu {
  position: fixed;
  inset: 0;
  z-index: 30;
}

.menu-panel {
  position: absolute;
  top: 10px;
  right: 10px;
  width: min(320px, calc(100% - 20px));
  padding: 14px;
  border-radius: 22px;
  background:
    linear-gradient(150deg, rgba(16, 28, 34, .98), rgba(11, 27, 34, .98)),
    var(--surface);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .36);
  animation: menuIn .18s ease both;
}

@keyframes menuIn {
  from { transform: translateY(-10px) scale(.97); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.menu-head {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 2px 2px 10px;
}

.menu-head img {
  width: 48px;
  height: 48px;
  position: relative;
  z-index: 1;
  object-fit: cover;
  border-radius: 17px;
}

.menu-logo-fallback {
  width: 48px;
  height: 48px;
  border-radius: 17px;
  margin-right: -59px;
}

.menu-head strong,
.menu-head span {
  display: block;
}

.menu-head strong {
  font-size: 19px;
  letter-spacing: -.02em;
}

.menu-head span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.menu-panel button {
  width: 100%;
  margin-top: 8px;
  text-align: left;
  background: rgba(237, 247, 244, .08);
  color: #edf7f4;
}

.menu-panel button:not(.secondary) {
  background: rgba(24, 167, 201, .22);
  color: #edf7f4;
}

.sheet-card {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  max-width: 520px;
  margin: 0 auto;
  padding: 14px 16px 18px;
  border-radius: 24px;
  background: #101c22;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .35);
  text-align: center;
  animation: sheetUp .22s ease both;
}

@keyframes sheetUp {
  from { transform: translateY(32px); opacity: .2; }
  to { transform: translateY(0); opacity: 1; }
}

.grabber {
  width: 42px;
  height: 5px;
  margin: 0 auto 10px;
  border-radius: 999px;
  background: rgba(17, 21, 16, .18);
}

.sheet-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 12px;
  background: rgba(237, 247, 244, .08);
  color: #edf7f4;
  font-size: 21px;
}

.sheet-card h2 {
  margin: 4px 44px 12px;
  font-size: 24px;
}

.sheet-card img {
  width: min(100%, 330px);
  border-radius: 18px;
  background: #fff;
  padding: 10px;
  image-rendering: pixelated;
}

.sheet-card p {
  margin: 12px auto 14px;
  max-width: 340px;
  color: var(--muted);
  font-weight: 750;
}

#sheet-config {
  width: 100%;
}

@media (max-width: 520px) {
  .shell {
    padding: calc(58px + env(safe-area-inset-top, 0px)) 9px 34px;
  }

  .hero-card strong {
    font-size: 28px;
  }

  .add-card {
    grid-template-columns: 1fr;
  }

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