:root {
  --bg: #0f1115;
  --bg-card: #1c1f26;
  --bg-card-2: #262a33;
  --bg-input: #14171c;
  --fg: #f1f3f7;
  --fg-muted: #8a92a0;
  --fg-dim: #5a6271;
  --accent-green: #2ecc71;
  --accent-green-2: #27ae60;
  --green-glow: rgba(46, 204, 113, 0.35);
  --accent-blue: #4dabf7;
  --red: #ff5757;
  --red-bg: rgba(255, 87, 87, 0.10);
  --red-border: rgba(255, 87, 87, 0.30);
  --green-bg: rgba(46, 204, 113, 0.10);
  --green-border: rgba(46, 204, 113, 0.30);
  --hint-bg: rgba(77, 171, 247, 0.08);
  --hint-border: rgba(77, 171, 247, 0.25);
  --border: #2a2e38;
  --radius: 18px;
  --radius-sm: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Roboto, sans-serif;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

#root { padding: 14px 14px 32px; max-width: 600px; margin: 0 auto; }

.loader { padding: 60px 0; text-align: center; color: var(--fg-muted); }

/* Header */
.header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; padding: 0 4px; }
.header h1 { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: 0.3px; flex: 1; text-align: center; }
.header .left, .header .right { width: 70px; display: flex; align-items: center; }
.header .right { justify-content: flex-end; }
.header button { background: none; border: none; color: var(--accent-blue); font-size: 16px; cursor: pointer; font-family: inherit; padding: 0; }

/* Card */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
}

.card-title-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.card-title { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.3px; }

.badge {
  display: inline-block;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.badge.active { background: var(--green-bg); color: var(--accent-green); }
.badge.expired { background: var(--red-bg); color: var(--red); }
.badge.muted { background: rgba(138, 146, 160, 0.15); color: var(--fg-muted); }

.theme-toggle {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--bg-card-2); border: 1px solid var(--border);
  padding: 5px 8px; border-radius: 999px;
  font-size: 13px;
}

.statusbox {
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  margin-bottom: 14px;
}
.statusbox.expired {
  background: var(--red-bg);
  border: 1px solid var(--red-border);
}
.statusbox.active {
  background: var(--green-bg);
  border: 1px solid var(--green-border);
}
.statusbox .lbl { font-size: 11px; color: var(--fg-muted); text-transform: uppercase; letter-spacing: 0.7px; margin-bottom: 4px; }
.statusbox .val { font-weight: 700; font-size: 15px; }
.statusbox .val.red { color: var(--red); }
.statusbox .val.green { color: var(--accent-green); }

.progress-block .progress-meta { display: flex; justify-content: space-between; font-size: 13px; color: var(--fg-muted); margin-bottom: 7px; }
.progress { height: 5px; background: var(--bg-card-2); border-radius: 3px; overflow: hidden; }
.progress > .bar { height: 100%; background: linear-gradient(90deg, var(--accent-green), var(--accent-green-2)); border-radius: 3px; transition: width 0.4s; }
.progress-foot { display: flex; justify-content: space-between; font-size: 12px; color: var(--fg-dim); margin-top: 6px; }

/* Hint */
.hint {
  background: var(--hint-bg);
  border: 1px solid var(--hint-border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 18px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 14px;
  line-height: 1.4;
}
.hint .lamp { font-size: 20px; flex-shrink: 0; line-height: 1; }
.hint b { color: var(--accent-blue); font-weight: 600; }

/* Section title */
.section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--fg-muted);
  margin: 18px 4px 10px;
  font-weight: 700;
}

/* Action list */
.btn-list {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}
.btn-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--border);
  width: 100%;
  text-align: left;
  color: var(--fg);
  font-size: 15px;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  font-weight: 500;
}
.btn-row:last-child { border-bottom: 0; }
.btn-row:active { background: var(--bg-card-2); }
.btn-row .label { flex: 1; }
.btn-row .arrow { color: var(--fg-dim); font-size: 18px; flex-shrink: 0; }
.btn-row .badge-tag {
  font-size: 11px;
  background: var(--green-bg); color: var(--accent-green);
  padding: 2px 7px; border-radius: 6px;
  font-weight: 600;
  margin-left: 6px;
}

/* Icon squares (App Store / Play / Happ / etc.) */
.iconsq {
  width: 36px; height: 36px;
  border-radius: 9px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: #0072e3; /* App Store-blue default */
  font-size: 22px;
  color: #fff;
  font-weight: 700;
  overflow: hidden;
}
.iconsq svg { width: 26px; height: 26px; }

.iconsq.appstore {
  background: linear-gradient(135deg, #0eaff9 0%, #0072e3 100%);
}
.iconsq.gplay { background: #fff; }
.iconsq.happ { background: #1a1a1a; color: #fff; }
.iconsq.windows { background: #0078d4; }
.iconsq.macos { background: #2c2c2e; }
.iconsq.apk { background: #3ddc84; color: #000; }
.iconsq.tv { background: #424f63; }

/* Big green CTA (Add subscription) */
.cta-green {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 16px;
  border-radius: var(--radius);
  border: 1.5px solid var(--green-border);
  background:
    linear-gradient(135deg, rgba(46,204,113,0.18) 0%, rgba(39,174,96,0.10) 100%);
  box-shadow: 0 0 24px var(--green-glow);
  color: var(--fg);
  font-family: inherit;
  font-size: 15px;
  cursor: pointer;
  text-decoration: none;
  margin-bottom: 14px;
}
.cta-green .iconsq { width: 40px; height: 40px; border-radius: 11px; }
.cta-green .body { flex: 1; }
.cta-green .ttl { font-weight: 700; font-size: 16px; margin-bottom: 2px; }
.cta-green .sub { font-size: 12px; color: var(--fg-muted); }
.cta-green .arrow { color: var(--accent-green); font-size: 22px; }
.cta-green:active { opacity: 0.85; }

/* Tabs */
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.tab {
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  color: var(--fg-muted);
  display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: all 0.15s;
}
.tab.active { background: var(--bg); border-color: var(--accent-blue); color: var(--fg); }
.tab .star { color: #ffa94d; font-size: 12px; }

/* Sheet */
.sheet-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 100;
  animation: fadeIn 0.2s ease;
}
.sheet {
  background: var(--bg);
  width: 100%;
  max-width: 600px;
  border-radius: 24px 24px 0 0;
  padding: 18px 14px calc(28px + env(safe-area-inset-bottom));
  animation: slideUp 0.25s ease;
  max-height: 92vh;
  overflow-y: auto;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

/* Copy row */
.copy-row {
  display: flex; gap: 8px; align-items: center;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  word-break: break-all;
  margin-bottom: 10px;
}
.copy-btn {
  background: var(--accent-blue); color: #fff; border: 0;
  padding: 6px 12px; border-radius: 8px; font-size: 13px; cursor: pointer;
  flex-shrink: 0; font-family: inherit;
}
