:root {
  color-scheme: dark;
  --bg: #05070a;
  --bg-strong: #070b11;
  --surface: rgba(15, 19, 25, 0.96);
  --surface-alt: rgba(10, 13, 18, 0.92);
  --card-start: rgba(20, 25, 32, 0.98);
  --card-end: rgba(12, 16, 21, 0.95);
  --text: #eef5fb;
  --muted: #97a4b1;
  --border: rgba(139, 160, 176, 0.18);
  --border-strong: rgba(145, 226, 255, 0.28);
  --accent: #8dd8ff;
  --accent-strong: #dff7ff;
  --accent-alt: #7fe6d1;
  --danger: #f97373;
  --success: #4ade80;
  --warning: #f7b955;
  --brand-logo: url("/icons/capybara_splash_logo.png?v=capybara-favicon-20260509a");
  --radius: 8px;
  --radius-sm: 6px;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(5, 7, 10, 0.98) 0%, rgba(7, 11, 17, 1) 100%),
    repeating-linear-gradient(90deg, rgba(141, 216, 255, 0.035) 0 1px, transparent 1px 32px),
    repeating-linear-gradient(0deg, rgba(127, 230, 209, 0.025) 0 1px, transparent 1px 32px);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

html.has-notice-modal,
html.has-notice-modal body {
  overflow: hidden;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  min-height: 100dvh;
  padding: env(safe-area-inset-top) 12px calc(94px + env(safe-area-inset-bottom));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 -12px;
  padding: 12px 12px 10px;
  background: rgba(7, 10, 15, 0.84);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(20px) saturate(130%);
  -webkit-backdrop-filter: blur(20px) saturate(130%);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  min-width: 0;
  overflow: hidden;
}

.brand > span {
  min-width: 0;
  overflow: hidden;
}

.brand-mark {
  display: block;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  background-image: var(--brand-logo);
  background-position: center;
  background-repeat: no-repeat;
  background-size: 92% 92%;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background-color: rgba(255, 255, 255, 0.03);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.18);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 16px;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  display: flex;
  flex: 0 1 auto;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 6px;
  min-width: 0;
}

.app-main {
  display: grid;
  gap: 14px;
  width: min(100%, 760px);
  margin: 12px auto 0;
}

.hero-card,
.card,
.notice-card,
.article-body {
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--card-start), var(--card-end));
  box-shadow: var(--shadow);
}

.hero-card,
.card,
.notice-card {
  border-radius: var(--radius);
  padding: 16px;
}

.hero-card h1,
.card h2,
.card h3,
.article-body h1,
.article-body h2,
.article-body h3 {
  margin: 0;
  letter-spacing: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.hero-card h1 {
  font-size: 28px;
  line-height: 1.1;
}

.hero-card p,
.card p {
  margin: 8px 0 0;
  line-height: 1.6;
  font-size: 14px;
}

.muted {
  color: var(--muted);
}

.stack {
  display: grid;
  gap: 12px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(136px, 1fr));
  gap: 10px;
}

.metric {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 92px;
  padding: 12px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.metric small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metric strong {
  display: block;
  margin-top: 10px;
  font-size: 18px;
  line-height: 1.2;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.progress {
  overflow: hidden;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
}

.progress span {
  display: block;
  height: 100%;
  width: var(--progress, 0%);
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-strong) 100%);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: stretch;
}

.button-row > * {
  flex: 1 1 160px;
  min-width: 0;
}

.button-row.compact > * {
  flex-basis: 140px;
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 10px 12px;
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.primary-button {
  color: #041018;
  background: linear-gradient(135deg, #e8fbff 0%, #9fe1ff 56%, #7fe6d1 100%);
  border-color: rgba(145, 226, 255, 0.48);
  box-shadow: 0 10px 24px rgba(141, 216, 255, 0.18);
}

.secondary-button {
  color: var(--text);
  background: rgba(255, 255, 255, 0.035);
  border-color: var(--border);
}

.ghost-button {
  min-height: 36px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--border);
  white-space: nowrap;
  font-size: 13px;
  padding-inline: 10px;
}

.danger-button {
  color: #ffd6d6;
  background: rgba(249, 115, 115, 0.12);
  border-color: rgba(249, 115, 115, 0.28);
}

button:hover:not(:disabled),
a:hover:not(:disabled) {
  border-color: var(--border-strong);
}

.primary-button:hover:not(:disabled),
.secondary-button:hover:not(:disabled),
.ghost-button:hover:not(:disabled),
.danger-button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.form {
  display: grid;
  gap: 16px;
}

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

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

.field input {
  width: 100%;
  min-height: 48px;
  border-radius: 8px;
  border: 1px solid rgba(145, 226, 255, 0.12);
  outline: none;
  padding: 12px 14px;
  color: var(--text);
  background: rgba(6, 9, 13, 0.82);
}

.field input:focus {
  border-color: rgba(145, 226, 255, 0.48);
  box-shadow: 0 0 0 3px rgba(141, 216, 255, 0.12);
}

.card > p + .button-row,
.notice-card > p + .button-row,
.card > .muted + .button-row {
  margin-top: 16px;
}

.client-section > strong + .button-row,
.coupon-box > .button-row {
  margin-top: 8px;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 4px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
}

.tabs button {
  border: 0;
  border-radius: 6px;
  padding: 10px 8px;
  color: var(--muted);
  background: transparent;
  font-weight: 700;
  min-height: 40px;
  overflow-wrap: anywhere;
}

.tabs button.is-active {
  color: #041018;
  background: linear-gradient(135deg, #e8fbff 0%, #9fe1ff 52%, #dff7ff 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.32);
}

.tabs + .form {
  margin-top: 12px;
}

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

.card > h2 + .list {
  margin-top: 12px;
}

.list-button {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  text-align: left;
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
}

.list-button strong {
  display: block;
  font-size: 16px;
}

.list-button small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
}

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

.section-head p {
  margin-top: 6px;
  max-width: 42ch;
}

.notice-list,
.plan-list,
.payment-list {
  display: grid;
  gap: 10px;
}

.notice-body {
  margin-top: 12px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

.notice-body p {
  margin: 0 0 10px;
}

.notice-body p:last-child {
  margin-bottom: 0;
}

.notice-modal-layer {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: max(18px, env(safe-area-inset-top)) 14px max(18px, env(safe-area-inset-bottom));
  background: rgba(3, 6, 10, 0.72);
  backdrop-filter: blur(18px) saturate(130%);
  -webkit-backdrop-filter: blur(18px) saturate(130%);
}

.notice-modal-scrim {
  position: absolute;
  inset: 0;
  border: 0;
  background: transparent;
}

.notice-modal-card {
  position: relative;
  z-index: 1;
  width: min(100%, 430px);
  max-height: min(78dvh, 620px);
  overflow: auto;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 16px;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(20, 25, 32, 0.99), rgba(9, 13, 18, 0.98)),
    var(--surface);
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.48),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  -webkit-overflow-scrolling: touch;
}

.notice-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.notice-modal-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.notice-modal-close {
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 7px 10px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  font-size: 12px;
  font-weight: 800;
}

.notice-modal-card h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.notice-modal-date {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.notice-modal-body {
  margin-top: 14px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.75;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.notice-modal-body p {
  margin: 0 0 10px;
}

.notice-modal-body p:last-child {
  margin-bottom: 0;
}

.notice-modal-actions {
  display: grid;
  margin-top: 16px;
}

.plan-card,
.period-button,
.payment-button {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
  text-align: left;
  cursor: pointer;
}

.plan-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.plan-card span,
.payment-button span {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.plan-card strong,
.payment-button strong {
  font-size: 15px;
}

.plan-card small,
.payment-button small {
  color: var(--muted);
  font-size: 13px;
}

.plan-card b {
  flex: 0 0 auto;
  color: var(--accent-strong);
}

.period-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 10px;
}

.period-button {
  display: grid;
  gap: 6px;
  text-align: center;
}

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

.period-button strong {
  font-size: 17px;
}

.plan-card.is-selected,
.period-button.is-selected,
.payment-button.is-selected {
  color: #05070b;
  background: var(--accent-strong);
  border-color: rgba(226, 230, 237, 0.88);
}

.plan-card.is-selected small,
.period-button.is-selected span,
.payment-button.is-selected small {
  color: rgba(5, 7, 11, 0.72);
}

.plan-card.is-selected b {
  color: #05070b;
}

.summary-box,
.inline-payment {
  display: grid;
  gap: 6px;
  padding: 14px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
}

.summary-box {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.coupon-box {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border);
}

.summary-box span,
.summary-item small {
  color: var(--muted);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 10px;
}

.summary-item {
  display: grid;
  gap: 6px;
  padding: 12px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.summary-item strong {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.inline-payment code {
  color: var(--accent-strong);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.inline-payment a {
  color: var(--accent-strong);
}

.full-width {
  width: 100%;
}

.client-grid {
  display: grid;
  gap: 12px;
}

.client-card {
  display: grid;
  gap: 14px;
}

.client-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.client-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  color: #05070b;
  background: linear-gradient(145deg, var(--accent-strong), var(--accent));
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.18);
  font-size: 18px;
  font-weight: 850;
}

.client-icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.platform-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 7px;
}

.platform-row span {
  padding: 4px 8px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.045);
  font-size: 12px;
  font-weight: 750;
}

.client-section {
  display: grid;
  gap: 8px;
}

.client-section > strong {
  color: var(--text);
  font-size: 13px;
}

.button-row.compact {
  gap: 8px;
}

.button-row.compact .primary-button,
.button-row.compact .secondary-button {
  min-height: 40px;
  padding: 9px 12px;
  font-size: 14px;
}

.primary-button:disabled,
.secondary-button:disabled,
.ghost-button:disabled,
.danger-button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

.client-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.client-note.is-success {
  color: #86efac;
}

.link-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.link-code {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
}

.link-code strong {
  font-size: 14px;
}

.link-code code {
  color: var(--accent-strong);
  font-size: 13px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.article-body {
  border-radius: var(--radius-sm);
  padding: 16px;
  color: #333;
  background: #fff;
}

.article-body :where(img, video) {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
}

.article-body :where(a) {
  color: #1677ff;
}

.article-body :where(*) {
  max-width: 100%;
}

.status-line {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--success);
}

.alert {
  border-radius: var(--radius);
  padding: 12px 14px;
  color: #fecaca;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.success {
  color: #bbf7d0;
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.22);
}

.bottom-nav {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(10px + env(safe-area-inset-bottom));
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(8, 11, 16, 0.95);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(130%);
  -webkit-backdrop-filter: blur(18px) saturate(130%);
}

.bottom-nav.is-visual-viewport-bound {
  top: var(--bottom-nav-top);
  bottom: auto;
}

.nav-item {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font-weight: 700;
  padding: 10px 6px;
  font-size: 12px;
  white-space: nowrap;
  letter-spacing: 0;
}

.nav-item.is-active {
  color: #041018;
  background: linear-gradient(135deg, #e8fbff 0%, #9fe1ff 52%, #dff7ff 100%);
  border-color: rgba(145, 226, 255, 0.35);
}

.hidden {
  display: none !important;
}

@media (hover: hover) and (pointer: fine) {
  .nav-item:hover:not(:disabled),
  .tabs button:hover:not(:disabled),
  .list-button:hover:not(:disabled),
  .plan-card:hover:not(:disabled),
  .period-button:hover:not(:disabled),
  .payment-button:hover:not(:disabled) {
    border-color: var(--border-strong);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

@media (max-width: 420px) {
  .app-shell {
    padding-left: 10px;
    padding-right: 10px;
  }

  .topbar {
    margin-left: -10px;
    margin-right: -10px;
  }

  .hero-card,
  .card,
  .notice-card,
  .article-body {
    padding: 14px;
  }

  .hero-card h1 {
    font-size: 24px;
  }

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

  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .bottom-nav {
    left: 10px;
    right: 10px;
  }
}

@media (max-width: 460px) {
  .topbar {
    gap: 6px;
    padding-top: 10px;
    padding-bottom: 9px;
  }

  .brand {
    gap: 8px;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
  }

  .brand strong {
    font-size: 15px;
  }

  .brand small {
    font-size: 11px;
  }

  .topbar-actions {
    gap: 4px;
  }

  .topbar-actions .ghost-button {
    min-width: 0;
    flex: 0 1 auto;
    min-height: 34px;
    padding-inline: 7px;
    font-size: 12px;
  }
}

@media (max-width: 360px) {
  .brand strong {
    font-size: 14px;
  }

  .brand small {
    font-size: 10px;
  }

  .topbar-actions .ghost-button {
    padding-inline: 6px;
    font-size: 11px;
  }
}

@media (min-width: 720px) {
  .app-shell {
    padding-left: 24px;
    padding-right: 24px;
  }

  .topbar {
    margin-left: -24px;
    margin-right: -24px;
    padding-left: 24px;
    padding-right: 24px;
  }

  .app-main {
    width: min(100%, 880px);
  }

  .client-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1080px) {
  .app-main {
    width: min(100%, 960px);
  }

  .hero-card,
  .card,
  .notice-card {
    padding: 18px;
  }
}
