/* ============================================================
 * subscribe_nav — Embedded App Console
 * Native H5 rewrite. Original accent #fa6400 preserved.
 * Designed for embedded iOS webview, media/TV app context.
 * ============================================================ */

/* --- Design Tokens --- */
:root {
  /* Surfaces — deep dark, not pure black */
  --bg:           #090b10;
  --surface:      #151822;
  --surface-2:    #1d2130;
  --surface-3:    #2b3143;
  --surface-hover:#343b51;

  /* Text */
  --fg:           #f5f6fa;
  --fg-2:         #c8cad4;
  --muted:        #7a7f92;
  --meta:         #4a4f60;

  /* Accent — original orange */
  --accent:       #fa6400;
  --accent-hover: #ff7a1f;
  --accent-active:#e55a00;
  --accent-soft:  rgba(250, 100, 0, 0.13);
  --accent-on:    #ffffff;

  /* Semantic */
  --success:      #2dd4bf;
  --warn:         #fbbf24;
  --danger:       #f87171;

  /* Typography */
  --font-display: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'PingFang SC', 'Helvetica Neue', sans-serif;
  --font-body:    -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'PingFang SC', 'Helvetica Neue', sans-serif;
  --font-mono:    'SF Mono', ui-monospace, 'JetBrains Mono', Menlo, monospace;

  /* Spacing */
  --sp-1:  4px;
  --sp-2:  8px;
  --sp-3:  12px;
  --sp-4:  16px;
  --sp-5:  20px;
  --sp-6:  24px;
  --sp-8:  32px;
  --sp-10: 40px;
  --sp-12: 48px;

  /* Radius */
  --r-sm:  8px;
  --r-md:  12px;
  --r-lg:  16px;
  --r-xl:  20px;
  --r-pill: 9999px;

  /* Elevation */
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.3);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.5);
  --shadow-accent: 0 4px 20px rgba(250, 100, 0, 0.3);

  /* Transitions */
  --t-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }

body {
  font-family: var(--font-body);
  background:
    radial-gradient(circle at 80% -12%, rgba(250, 100, 0, 0.18), transparent 30%),
    radial-gradient(circle at 0% 28%, rgba(45, 212, 191, 0.08), transparent 28%),
    linear-gradient(180deg, #11141c 0%, var(--bg) 42%);
  color: var(--fg);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  min-height: 100vh;
  min-height: 100dvh;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
input::placeholder, textarea::placeholder { color: var(--meta); }
img { display: block; max-width: 100%; }
a { color: var(--accent); text-decoration: none; }

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--surface-hover); }

/* --- App Shell --- */
#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

/* --- App Header --- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: calc(env(safe-area-inset-top, 0) + var(--sp-2)) var(--sp-4) var(--sp-2);
  background: linear-gradient(180deg, rgba(9, 11, 16, 0.98), rgba(9, 11, 16, 0.78));
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.app-kicker {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.app-header h1 {
  margin-top: 2px;
  font-size: 19px;
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-weight: 800;
}

.header-action {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-2);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.header-action svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* --- Tab Content --- */
.tab-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  animation: fadeIn var(--t-base);
  padding-bottom: calc(var(--sp-6) + env(safe-area-inset-bottom, 0));
}

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

.tab-content::-webkit-scrollbar { width: 0; }

/* --- Screen Wrapper --- */
.screen { padding: var(--sp-4) var(--sp-4) var(--sp-8); }

.shell-screen {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.overview-panel {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 28px;
  padding: var(--sp-5);
  background:
    linear-gradient(140deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02) 44%),
    radial-gradient(circle at 86% 18%, rgba(250, 100, 0, 0.26), transparent 34%),
    var(--surface);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.28);
}

.overview-panel::after {
  content: '';
  position: absolute;
  inset: auto -24px -58px auto;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  border: 32px solid rgba(255, 255, 255, 0.035);
  pointer-events: none;
}

.overview-copy {
  position: relative;
  z-index: 1;
  max-width: 31rem;
}

.overview-kicker {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: var(--sp-3);
}

.overview-copy h2 {
  font-size: clamp(25px, 7vw, 42px);
  line-height: 1.02;
  letter-spacing: -0.055em;
  font-weight: 850;
  color: var(--fg);
}

.overview-copy p {
  margin-top: var(--sp-3);
  color: var(--fg-2);
  font-size: 14px;
  line-height: 1.55;
}

.overview-metrics {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-2);
  margin-top: var(--sp-5);
}

.overview-metric {
  min-width: 0;
  text-align: left;
  padding: var(--sp-3);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.07);
  color: var(--fg);
  -webkit-tap-highlight-color: transparent;
}

.overview-metric.active {
  background: rgba(250, 100, 0, 0.15);
  border-color: rgba(250, 100, 0, 0.34);
}

.overview-metric strong,
.overview-metric span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.overview-metric strong {
  font-size: 18px;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.overview-metric span {
  margin-top: var(--sp-1);
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.segment-nav {
  display: flex;
  gap: var(--sp-2);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: var(--sp-1);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.07);
  scrollbar-width: none;
}

.segment-nav::-webkit-scrollbar { display: none; }

.segment-pill {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 var(--sp-4);
  border-radius: 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
  transition: color var(--t-fast), background var(--t-fast), transform var(--t-fast);
  -webkit-tap-highlight-color: transparent;
}

.segment-pill:active { transform: scale(0.97); }

.segment-pill.active {
  background: var(--surface);
  color: var(--fg);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07);
}

.content-panel {
  min-width: 0;
}

/* --- Cards --- */
.card {
  background: var(--surface);
  border: 1px solid var(--surface-3);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  transition: border-color var(--t-fast), background var(--t-fast);
}

.card-elevated {
  background: var(--surface);
  border: 1px solid var(--surface-3);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  box-shadow: var(--shadow-md);
}

.card-clickable { cursor: pointer; }
.card-clickable:hover, .card-clickable:active {
  border-color: var(--surface-hover);
  background: var(--surface-2);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--r-sm);
  font-size: 14px;
  font-weight: 600;
  transition: all var(--t-fast);
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--accent);
  color: var(--accent-on);
  box-shadow: var(--shadow-accent);
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-outline {
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--surface-3);
}
.btn-outline:hover { border-color: var(--surface-hover); background: var(--surface-2); }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  padding: var(--sp-2) var(--sp-3);
}
.btn-ghost:hover { color: var(--fg); }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--fg-2);
  transition: all var(--t-fast);
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}
.btn-icon:hover { background: var(--surface-3); color: var(--fg); }
.btn-icon:active { transform: scale(0.92); }

.btn-icon svg {
  width: 20px; height: 20px;
  stroke: currentColor; fill: none;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}

.btn-icon-sm {
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
}
.btn-icon-sm svg { width: 16px; height: 16px; }

/* --- Inputs --- */
.input-field {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.input-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-2);
}

.input {
  background: var(--surface-2);
  border: 1px solid var(--surface-3);
  border-radius: var(--r-sm);
  padding: var(--sp-3) var(--sp-4);
  color: var(--fg);
  font-size: 14px;
  outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  width: 100%;
}

.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.input-error {
  font-size: 12px;
  color: var(--danger);
}

/* --- Login Screen --- */
.login-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 70vh;
  padding: var(--sp-8) var(--sp-5);
  text-align: center;
}

.login-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--sp-6);
}

.login-icon svg {
  width: 40px; height: 40px;
  stroke: var(--accent); fill: none;
  stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round;
}

.login-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: var(--sp-8);
  color: var(--fg);
}

.login-btn {
  padding: var(--sp-4) var(--sp-12);
}

/* --- My Screen --- */
.my-header {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
}

.hero-panel {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(150deg, rgba(250, 100, 0, 0.12), rgba(255, 255, 255, 0.025) 45%),
    var(--surface);
}

.hero-panel::before {
  content: '';
  position: absolute;
  width: 160px;
  height: 160px;
  right: -70px;
  top: -80px;
  background: rgba(250, 100, 0, 0.18);
  filter: blur(12px);
  border-radius: 50%;
  pointer-events: none;
}

.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  flex-shrink: 0;
}

.my-username {
  font-size: 17px;
  font-weight: 700;
  color: var(--fg);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.my-actions {
  display: flex;
  gap: var(--sp-2);
  margin-bottom: var(--sp-5);
  flex-wrap: wrap;
}

.action-bar {
  display: flex;
  gap: var(--sp-2);
  margin-bottom: var(--sp-5);
  flex-wrap: wrap;
}

.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-2);
}

.quick-actions .btn,
.quick-actions .btn-icon {
  width: 100%;
  min-height: 46px;
}

.quick-actions .btn-icon {
  gap: var(--sp-2);
  border-radius: var(--r-sm);
}

.quick-actions .btn-icon::after {
  content: attr(aria-label);
  font-size: 13px;
  font-weight: 650;
  color: currentColor;
}

.section-header {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}

.section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--fg);
}

.screen-heading {
  margin-bottom: var(--sp-4);
}

.screen-heading-title {
  font-size: 22px;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--fg);
}

.screen-heading-copy {
  margin-top: var(--sp-2);
  color: var(--muted);
  font-size: 14px;
}

/* --- Subscribe List (My screen) --- */
.sub-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.sub-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  background: color-mix(in oklab, var(--surface), transparent 18%);
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 18px;
  padding: var(--sp-3);
  transition: border-color var(--t-fast);
}

.sub-item:hover { border-color: var(--surface-hover); }

.sub-item-info {
  flex: 1;
  min-width: 0;
}

.sub-item-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: var(--sp-1);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sub-item-url {
  font-size: 12px;
  color: var(--muted);
  font-family: var(--font-mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sub-item-actions {
  display: flex;
  gap: var(--sp-1);
  flex-shrink: 0;
}

/* --- Empty State --- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-12) var(--sp-5);
  text-align: center;
  color: var(--muted);
}

.empty-state svg {
  width: 48px; height: 48px;
  stroke: var(--meta); fill: none;
  stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round;
  margin-bottom: var(--sp-4);
}

.empty-state-text {
  font-size: 14px;
}

/* --- Subscribe Grid (Subscribe screen) --- */
.sub-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-3);
}

@media (max-width: 600px) {
  .sub-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 768px) {
  .sub-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (min-width: 1024px) {
  .sub-grid { grid-template-columns: repeat(5, 1fr); }
}

.sub-card {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 20px;
  overflow: hidden;
  cursor: pointer;
  transition: all var(--t-fast);
  -webkit-tap-highlight-color: transparent;
}

.sub-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.sub-card:active { transform: scale(0.97); }

.sub-card-img {
  width: 100%;
  aspect-ratio: 1.08;
  object-fit: cover;
  background: var(--surface-2);
}

.sub-card-img-placeholder {
  width: 100%;
  aspect-ratio: 1.08;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sub-card-img-placeholder svg {
  width: 32px; height: 32px;
  stroke: var(--meta); fill: none;
  stroke-width: 1.5;
}

.sub-card-title {
  padding: var(--sp-3) var(--sp-2);
  font-size: 15px;
  font-weight: 760;
  text-align: center;
  color: var(--fg-2);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* --- Membership Screen --- */
.membership-table {
  width: 100%;
  border-collapse: collapse;
  border-radius: 18px;
  overflow: hidden;
  background: var(--surface);
}

.membership-table-wrap {
  overflow-x: auto;
  margin-bottom: var(--sp-5);
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.075);
}

.membership-table th, .membership-table td {
  padding: var(--sp-4) var(--sp-3);
  text-align: center;
  border-bottom: 1px solid var(--surface-3);
  border-right: 1px solid var(--surface-3);
}

.membership-table th,
.membership-table td {
  min-width: 86px;
}

.membership-table th:first-child,
.membership-table td:first-child {
  min-width: 118px;
}

.membership-table th:last-child, .membership-table td:last-child { border-right: none; }
.membership-table tr:last-child td { border-bottom: none; }

.membership-table thead th {
  background: var(--accent-soft);
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
}

.membership-table thead th:first-child { background: var(--surface-2); color: var(--muted); }

.membership-table tbody td:first-child {
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-2);
  text-align: center;
}

.feature-icon {
  width: 24px; height: 24px;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  fill: none;
}
.feature-check { stroke: var(--success); }
.feature-cross { stroke: var(--danger); }

.offer-banner {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: 18px;
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.3);
  margin-bottom: var(--sp-4);
}

.offer-banner svg {
  width: 20px; height: 20px;
  stroke: var(--warn); fill: none;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
  flex-shrink: 0;
}

.offer-banner-text {
  font-size: 13px;
  color: var(--warn);
  font-weight: 600;
}

.unlock-card {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.1), rgba(250, 100, 0, 0.05));
  border: 1px solid rgba(251, 191, 36, 0.2);
}

.unlock-icon {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(251, 191, 36, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.unlock-icon svg {
  width: 24px; height: 24px;
  stroke: var(--warn); fill: none;
  stroke-width: 1.5;
}

.purchase-row {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
}

.purchase-row .btn {
  min-height: 44px;
}

.purchase-row-title {
  flex: 1;
  font-size: 15px;
  font-weight: 600;
  color: var(--fg);
}

/* --- VOD Screen --- */
.vod-banner {
  position: relative;
  border-radius: 22px;
  overflow: hidden;
  cursor: pointer;
  margin-bottom: var(--sp-4);
  aspect-ratio: 16/9;
  background: var(--surface-2);
}

.vod-feature-card {
  background:
    linear-gradient(135deg, rgba(250, 100, 0, 0.16), rgba(45, 212, 191, 0.08)),
    var(--surface);
}

.vod-banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.vod-banner-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  color: var(--meta);
  font-size: 13px;
}

.vod-banner-error svg {
  width: 32px; height: 32px;
  stroke: var(--meta); fill: none;
  stroke-width: 1.5;
}

.vod-card {
  border-radius: 22px;
  overflow: hidden;
  cursor: pointer;
  transition: all var(--t-fast);
  background: var(--surface);
  border: 1px solid var(--surface-3);
}

.vod-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.vod-card:active { transform: scale(0.98); }

.vod-card-img {
  width: 100%;
  aspect-ratio: 1.75;
  object-fit: cover;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.vod-card-img svg {
  width: 48px; height: 48px;
  stroke: var(--accent); fill: none;
  stroke-width: 1;
}

.vod-card-text {
  padding: var(--sp-4);
  font-size: 14px;
  color: var(--muted);
  text-align: center;
}

/* --- Carousel --- */
.carousel {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-lg);
}

.carousel-track {
  display: flex;
  transition: transform var(--t-slow);
  will-change: transform;
}

.carousel-slide {
  flex: 0 0 100%;
  padding: 0 var(--sp-1);
}

.carousel-dots {
  display: flex;
  justify-content: center;
  gap: var(--sp-2);
  margin-top: var(--sp-3);
}

.carousel-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--surface-3);
  transition: all var(--t-fast);
  cursor: pointer;
}

.carousel-dot.active {
  background: var(--accent);
  width: 20px;
  border-radius: 3px;
}

/* --- Modal (Bottom Sheet) --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-base);
}

.modal-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-sheet {
  background: var(--surface);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: var(--sp-6) var(--sp-5) var(--sp-8);
  width: 100%;
  max-width: 500px;
  max-height: 85vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform var(--t-base);
  padding-bottom: calc(var(--sp-8) + env(safe-area-inset-bottom, 0));
}

.modal-overlay.show .modal-sheet {
  transform: translateY(0);
}

.modal-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--surface-3);
  margin: 0 auto var(--sp-5);
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: var(--sp-5);
  text-align: center;
}

.help-sheet {
  padding-top: var(--sp-5);
}

.help-list {
  margin: 0 0 var(--sp-6);
  padding-left: 1.25em;
  color: var(--fg-2);
  font-size: 14px;
  line-height: 1.65;
}

.help-list li + li {
  margin-top: var(--sp-3);
}

.help-close {
  width: 100%;
  justify-content: center;
}

.modal-field {
  margin-bottom: var(--sp-4);
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) 0;
}

.toggle {
  position: relative;
  width: 48px;
  height: 28px;
  background: var(--surface-3);
  border-radius: 14px;
  cursor: pointer;
  transition: background var(--t-fast);
  flex-shrink: 0;
}

.toggle.on { background: var(--accent); }

.toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: white;
  transition: transform var(--t-fast);
}

.toggle.on::after { transform: translateX(20px); }

/* --- Dialog (Alert) --- */
.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-5);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-base);
}

.dialog-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.dialog {
  background: var(--surface);
  border: 1px solid var(--surface-3);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
  max-width: 340px;
  width: 100%;
  transform: scale(0.9);
  transition: transform var(--t-base);
}

.dialog-overlay.show .dialog { transform: scale(1); }

.dialog-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: var(--sp-3);
}

.dialog-body {
  font-size: 14px;
  color: var(--fg-2);
  margin-bottom: var(--sp-5);
  line-height: 1.5;
}

.dialog-actions {
  display: flex;
  gap: var(--sp-3);
  justify-content: flex-end;
}

/* --- Toast --- */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface-3);
  color: var(--fg);
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--r-pill);
  font-size: 14px;
  font-weight: 500;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: all var(--t-base);
  max-width: 90%;
  white-space: nowrap;
  box-shadow: var(--shadow-lg);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* --- Loading Spinner --- */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--surface-3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-center {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-12);
}

/* --- VIP Badge --- */
.vip-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 2px var(--sp-2);
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.vip-badge-gu { background: var(--surface-3); color: var(--muted); }
.vip-badge-hu { background: rgba(45, 212, 191, 0.15); color: var(--success); }
.vip-badge-vip { background: var(--accent-soft); color: var(--accent); }
.vip-badge-svip { background: linear-gradient(135deg, rgba(251,191,36,0.15), rgba(250,100,0,0.15)); color: var(--warn); }

/* --- Responsive --- */
@media (max-width: 480px) {
  .app-header {
    padding-inline: var(--sp-4);
  }

  .screen {
    padding-inline: var(--sp-3);
  }

  .card,
  .card-elevated {
    padding: var(--sp-4);
    border-radius: var(--r-lg);
  }

  .sub-item {
    align-items: flex-start;
    padding: var(--sp-3);
  }

  .sub-item-actions {
    flex-direction: column;
  }

  .sub-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--sp-3);
  }

  .sub-card-title {
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .purchase-row {
    align-items: stretch;
    flex-direction: column;
  }

  .purchase-row .btn {
    width: 100%;
  }

  .toast {
    bottom: calc(28px + env(safe-area-inset-bottom, 0));
  }
}

@media (min-width: 768px) {
  .app-header {
    padding-inline: var(--sp-6);
  }

  .screen { padding: var(--sp-6) var(--sp-6) var(--sp-8); }

  .overview-panel {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: var(--sp-6);
    align-items: end;
  }

  .overview-metrics { margin-top: 0; }
}

@media (min-width: 1024px) {
  .app-header {
    padding-inline: calc((100vw - 900px) / 2 + var(--sp-6));
  }

  .screen { max-width: 900px; margin: 0 auto; padding: var(--sp-8) var(--sp-6) var(--sp-8); }
}
