/* ============================================================
   Morids · shared styles
   Loaded by index.html, store.html and the /u/:name page.
   ============================================================ */

:root {
  --bg: #fcfcfd;
  --fg: #16161a;
  --mid: #808089;
  --faint: #b6b7be;
  --line: #ececef;
  --soft: #f4f4f6;
  --card: #ffffff;
  --max: 880px;
  --pad: 28px;
  --shadow-sm: 0 1px 2px rgba(16, 16, 24, 0.04), 0 8px 24px rgba(16, 16, 24, 0.06);
  --shadow-md: 0 2px 4px rgba(16, 16, 24, 0.05), 0 18px 48px rgba(16, 16, 24, 0.10);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; }
html { overflow: hidden; height: 100%; }

body {
  background-color: var(--bg);
  background-image: radial-gradient(rgba(0, 0, 0, 0.09) 1px, transparent 1px);
  background-size: 22px 22px;
  background-attachment: fixed;
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI",
               Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  height: 100%;
  overflow: hidden;
}

.scroll-wrap {
  position: fixed;
  inset: 0;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
}

.scroll-inner {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  will-change: transform;
  transform: translate3d(0, 0, 0);
}

.page {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--pad);
  width: 100%;
  position: relative;
}

/* ============================================================
   Header
   ============================================================ */
.site-header {
  padding: 44px 0 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 26px;
}

.nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  font-size: 14px;
  letter-spacing: -0.01em;
  color: var(--mid);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.25s ease;
}

.nav-link:hover { color: var(--fg); }
.nav-link.is-current { color: var(--fg); }

.nav-tag {
  position: absolute;
  left: 100%;
  top: -3px;
  margin-left: 4px;
  font-size: 9px;
  line-height: 1.5;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--faint);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 4px;
  white-space: nowrap;
  transition: color 0.25s ease, border-color 0.25s ease;
}

.nav-link:hover .nav-tag { color: var(--mid); border-color: #dcdce2; }

.logo-wrap {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  transition: opacity 0.25s ease;
  justify-self: start;
}

.logo-wrap:hover { opacity: 0.7; }

.logo-wrap img { height: 34px; width: auto; display: block; }

/* ---- shared pill button ---- */
.pill,
.account {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: inherit;
  font-size: 14px;
  color: var(--mid);
  text-decoration: none;
  height: 32px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  cursor: pointer;
  transition: color 0.25s ease, background 0.25s ease, border-color 0.25s ease;
}

.pill i,
.account i { font-size: 15px; }

.pill:hover,
.account:hover { color: #fff; background: var(--fg); border-color: var(--fg); }

.account { justify-self: end; }

/* ============================================================
   Sections / common
   ============================================================ */
.section { padding: 90px 0; position: relative; }

.section-label {
  font-size: 13px;
  font-weight: 400;
  color: var(--mid);
  margin-bottom: 36px;
}

.prose {
  font-size: 15px;
  line-height: 1.6;
  color: var(--mid);
  max-width: 620px;
}

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

/* ============================================================
   Account widget (header)
   ============================================================ */
.acct { justify-self: end; position: relative; }

.acct-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 12px 0 4px;
  font-family: inherit;
  font-size: 14px;
  color: var(--fg);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.25s ease, background 0.25s ease;
}

.acct-btn:hover { border-color: #dcdce2; }

.acct-btn i { font-size: 15px; color: var(--faint); }

.acct-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--mid);
  flex-shrink: 0;
  overflow: hidden;
}

.acct-avatar.lg { width: 34px; height: 34px; font-size: 13px; }

.acct-name { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* the dropdown itself (.acct-menu / .acct-item / .acct-head / .acct-sep)
   lives in apps.css next to the language menu — the two share one set of
   metrics so both header menus look and feel identical. */

.acct.open .acct-btn i { transform: rotate(180deg); }

/* ============================================================
   Custom UI: backdrop / modal / toast / select
   No native alert(), confirm() or <select> anywhere.
   ============================================================ */
.ui-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(16, 16, 24, 0.24);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.ui-backdrop.show { opacity: 1; }

.ui-modal {
  width: 100%;
  max-width: 420px;
  max-height: 84vh;
  overflow: auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-md);
  padding: 26px 26px 22px;
  transform: translateY(14px) scale(0.98);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.ui-backdrop.show .ui-modal { transform: translateY(0) scale(1); }
.ui-modal.wide { max-width: 520px; }

.ui-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 4px;
}

.ui-title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.ui-desc {
  font-size: 13.5px;
  color: var(--mid);
  line-height: 1.55;
  margin-top: 6px;
}

.ui-close {
  border: none;
  background: none;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  color: var(--faint);
  padding: 4px;
  border-radius: 8px;
  transition: color 0.2s ease, background 0.2s ease;
}

.ui-close:hover { color: var(--fg); background: var(--soft); }

.ui-body { margin-top: 18px; }

.ui-field { margin-bottom: 14px; }

.ui-field > label {
  display: block;
  font-size: 12px;
  color: var(--mid);
  margin-bottom: 6px;
}

.ui-input,
.ui-textarea {
  width: 100%;
  font-family: inherit;
  font-size: 14px;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 13px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.ui-textarea { resize: vertical; min-height: 82px; line-height: 1.55; }

.ui-input:focus,
.ui-textarea:focus {
  border-color: #cfcfd6;
  box-shadow: 0 0 0 3px rgba(22, 22, 26, 0.06);
}

.ui-input::placeholder,
.ui-textarea::placeholder { color: var(--faint); }

.ui-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

.ui-btn {
  font-family: inherit;
  font-size: 14px;
  height: 36px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--mid);
  cursor: pointer;
  transition: color 0.22s ease, background 0.22s ease, border-color 0.22s ease, opacity 0.22s ease;
}

.ui-btn:hover { color: #fff; background: var(--fg); border-color: var(--fg); }
.ui-btn.primary { color: #fff; background: var(--fg); border-color: var(--fg); }
.ui-btn.primary:hover { opacity: 0.85; }
.ui-btn[disabled] { opacity: 0.5; cursor: default; }
.ui-btn[disabled]:hover { color: var(--mid); background: var(--card); border-color: var(--line); }

/* custom select ------------------------------------------------ */
.ui-select { position: relative; }

.ui-select-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  font-family: inherit;
  font-size: 14px;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px 12px;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.ui-select-btn:hover { border-color: #dcdce2; }
.ui-select-btn i { font-size: 17px; color: var(--faint); transition: transform 0.25s ease; }
.ui-select.open .ui-select-btn i { transform: rotate(180deg); }

.ui-select-list {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 5;
  padding: 6px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

.ui-select.open .ui-select-list {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.ui-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--mid);
  text-align: left;
  border: none;
  background: none;
  padding: 8px 10px;
  border-radius: 9px;
  cursor: pointer;
  transition: color 0.18s ease, background 0.18s ease;
}

.ui-option:hover { color: var(--fg); background: var(--soft); }
.ui-option.selected { color: var(--fg); }
.ui-option i { font-size: 15px; opacity: 0; }
.ui-option.selected i { opacity: 1; }

/* toast -------------------------------------------------------- */
.ui-toasts {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.ui-toast {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  max-width: 90vw;
  font-size: 13.5px;
  color: #fff;
  background: var(--fg);
  padding: 10px 16px;
  border-radius: 999px;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(12px) scale(0.96);
  transition: opacity 0.3s ease, transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.ui-toast.show { opacity: 1; transform: translateY(0) scale(1); }
.ui-toast b { font-weight: 500; }
.ui-toast i { font-size: 15px; }
.ui-toast .sep { opacity: 0.45; }
.ui-toast.ok i { color: #7ee2b8; }
.ui-toast.err i { color: #ff8f8f; }

/* list rows inside modals -------------------------------------- */
.ui-list { display: flex; flex-direction: column; }

.ui-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

.ui-row:first-child { border-top: 1px solid var(--line); }
.ui-row-main { min-width: 0; }
.ui-row-title { font-size: 14.5px; font-weight: 500; }
.ui-row-sub { font-size: 12.5px; color: var(--faint); margin-top: 2px; }

.ui-state {
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--mid);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 9px;
  white-space: nowrap;
}

.ui-state.pro { color: #fff; background: var(--fg); border-color: var(--fg); }

.ui-empty {
  padding: 26px 0;
  text-align: center;
  font-size: 13.5px;
  color: var(--faint);
}

/* ============================================================
   reveal
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  will-change: transform, opacity;
  transition: opacity 1s cubic-bezier(0.22, 1, 0.36, 1),
              transform 1s cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal.in { opacity: 1; transform: translateY(0); }

/* ============================================================
   mini page (/u/:name)
   ============================================================ */
.mini-page {
  max-width: 480px;
  margin: 0 auto;
  padding: 120px 28px;
  text-align: center;
}

.mini-page .brand {
  display: inline-block;
  font-size: 15px;
  font-weight: 600;
  color: var(--mid);
  text-decoration: none;
  margin-bottom: 34px;
}

.mini-page h1 { font-size: 30px; font-weight: 500; letter-spacing: -0.02em; }
.mini-page .handle { font-size: 14px; color: var(--faint); margin-top: 4px; }
.mini-page .bio { font-size: 15px; color: var(--mid); margin-top: 14px; }
.mini-page .avatar { width: 72px; height: 72px; border-radius: 50%; margin: 0 auto 18px; object-fit: cover; }
.mini-page .pill { margin-top: 20px; }

/* ============================================================
   footer
   ============================================================ */
footer {
  padding: 28px 0 48px;
  font-size: 13px;
  color: var(--faint);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

/* ============================================================
   Store page
   ============================================================ */
.store-head { padding: 108px 0 0; }

.store-kick {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--faint);
}

.store-title {
  font-size: 42px;
  line-height: 1.22;
  font-weight: 500;
  letter-spacing: -0.03em;
  margin-top: 14px;
}

.store-title strong { font-weight: 600; }

.store-sub {
  font-size: 16px;
  color: var(--mid);
  margin-top: 12px;
  max-width: 520px;
}

.store-ver {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 18px;
  font-size: 12px;
  color: var(--mid);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 11px;
  background: var(--card);
}

.store-ver i { font-size: 13px; color: var(--faint); }

.store-ver b {
  font-weight: 500;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--fg);
}

/* app switcher ------------------------------------------------ */
.app-switch {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 0 2px;
  scrollbar-width: none;
}

.app-switch::-webkit-scrollbar { display: none; }

.asw {
  position: relative;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: inherit;
  font-size: 14px;
  color: var(--mid);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.25s ease, border-color 0.25s ease, background 0.25s ease,
              transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.asw img,
.asw .fallback {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--mid);
}

.asw:hover { color: var(--fg); border-color: #dcdce2; }
.asw.is-active { color: var(--fg); border-color: var(--fg); background: var(--card); }
.asw.is-locked { color: var(--faint); }
.asw.is-locked:hover { transform: translateY(-2px); }

.asw-tag {
  position: absolute;
  right: -4px;
  top: -6px;
  font-size: 9px;
  line-height: 1.5;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--mid);
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0 4px;
}

/* plans -------------------------------------------------------- */
.plans {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.plan {
  position: relative;
  display: flex;
  flex-direction: column;
  text-align: left;
  font-family: inherit;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px 18px 18px;
  cursor: pointer;
  transition: border-color 0.3s ease, box-shadow 0.35s ease,
              transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.plan:hover { transform: translateY(-3px); border-color: #dcdce2; }
.plan.is-active { border-color: var(--fg); box-shadow: var(--shadow-sm); }

.plan-name { font-size: 13px; color: var(--mid); }

.plan-price {
  display: flex;
  align-items: baseline;
  gap: 3px;
  margin-top: 8px;
  font-size: 30px;
  font-weight: 500;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.plan-price .cur { font-size: 15px; color: var(--mid); }
.plan-per { font-size: 12.5px; color: var(--faint); margin-top: 3px; }
.plan-note { font-size: 12px; color: var(--mid); margin-top: 12px; }
.plan-best {
  position: absolute;
  right: 14px;
  top: 14px;
  font-size: 9.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff;
  background: var(--fg);
  border-radius: 5px;
  padding: 1px 6px;
}

/* checkout bar ------------------------------------------------- */
.buy-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 24px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
}

.buy-sum { font-size: 14px; color: var(--mid); }
.buy-sum b { color: var(--fg); font-weight: 500; }

.buy-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
  font-size: 15px;
  color: #fff;
  background: var(--fg);
  border: none;
  border-radius: 999px;
  padding: 12px 24px;
  cursor: pointer;
  transition: opacity 0.25s ease, transform 0.2s ease;
}

.buy-btn:hover { opacity: 0.88; }
.buy-btn:active { transform: scale(0.97); }
.buy-btn[disabled] { opacity: 0.45; cursor: default; }

/* comparison --------------------------------------------------- */
.cmp {
  display: grid;
  grid-template-columns: 1fr 130px 150px;
  border-top: 1px solid var(--line);
}

.cmp > div { padding: 14px 0; border-bottom: 1px solid var(--line); }
.cmp > div + div { padding-left: 16px; }

.cmp-head {
  font-size: 11px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--faint) !important;
  border-bottom: 1px solid var(--line) !important;
}

.cmp-feat { font-size: 15px; }
.cmp-feat small { display: block; font-size: 12.5px; color: var(--faint); margin-top: 2px; }
.cmp-val { font-size: 14.5px; color: var(--mid); }
.cmp-val.pro { color: var(--fg); }
.cmp-val i { font-size: 15px; margin-right: 5px; }

/* notice ------------------------------------------------------- */
.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 22px;
  padding: 13px 16px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--mid);
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.notice i { font-size: 15px; color: var(--faint); margin-top: 2px; }
.notice b { color: var(--fg); font-weight: 500; }

/* ============================================================
   responsive
   ============================================================ */
@media (max-width: 900px) {
  .plans { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  :root { --pad: 22px; }
  .page { padding: 0 var(--pad); }

  .site-header { padding: 30px 0 0; grid-template-columns: 1fr auto; }
  .logo-wrap img { height: 30px; }
  .site-nav {
    grid-column: 1 / -1;
    order: 3;
    gap: 20px;
    margin-top: 16px;
  }
  .nav-link { font-size: 13px; }
  .account { height: 30px; padding: 0 13px; font-size: 13px; }
  .acct-btn { height: 30px; font-size: 13px; }

  .section { padding: 64px 0; }
  .store-head { padding: 74px 0 0; }
  .store-title { font-size: 30px; }
  .store-sub { font-size: 15px; }

  .cmp { grid-template-columns: 1fr 96px 110px; }
  .cmp > div + div { padding-left: 10px; }
  .cmp-feat { font-size: 14px; }
  .cmp-val { font-size: 13px; }

  .buy-row { flex-direction: column; align-items: stretch; text-align: center; }
  .buy-btn { justify-content: center; }

}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}

/* ============================================================
   Translation veil
   i18n-head.js adds .i18n-pending to <html> before the body is
   painted whenever the page needs translating. The page stays
   covered until translate.js has rendered, then the veil fades
   out and the translated page fades in — no word-by-word flip.
   ============================================================ */
.i18n-veil { display: none; }

html.i18n-pending .i18n-veil,
html.i18n-veiling .i18n-veil {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: var(--bg);
  opacity: 1;
  transition: opacity 0.45s ease;
}

/* the page itself while it is being translated */
html.i18n-pending > body > *:not(.i18n-veil) {
  opacity: 0;
  visibility: hidden;
}

html.i18n-veiling > body > *:not(.i18n-veil) {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.5s ease;
}

html.i18n-veiling .i18n-veil { opacity: 0; pointer-events: none; }
html.i18n-done .i18n-veil { display: none; }

.i18n-veil .iv-spin {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--line);
  border-top-color: var(--mid);
  animation: i18n-spin 0.85s linear infinite;
}

.i18n-veil .iv-txt {
  font-size: 13px;
  letter-spacing: 0.02em;
  color: var(--mid);
}

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