:root {
  --bg: #ffffff;
  --bg-soft: #f5f5f7;
  --surface: #ffffff;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --line: rgba(0, 0, 0, 0.12);
  --line-soft: rgba(0, 0, 0, 0.08);
  --blue: #1473e6;
  --blue-hover: #0d66d0;
  --apple-green: #1f7a36;
  --apple-green-dot: #34c759;
  --apple-green-bg: #eaf7ee;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
.hidden { display: none !important; }

.wrap {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
}

.nav-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line-soft);
}

.announce-ribbon {
  background: #eef5ff;
  border-bottom: 1px solid rgba(20, 115, 230, 0.16);
  padding: 9px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--ink);
}

.announce-inner {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.announce-badge {
  background: var(--blue);
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.02em;
}

.announce-ribbon a {
  color: var(--blue);
  font-weight: 600;
  text-decoration: none;
}

.announce-ribbon a:hover {
  text-decoration: underline;
}

.announce-hint {
  color: var(--muted);
  font-size: 12px;
}

.announce-save-btn {
  appearance: none;
  border: 1px solid rgba(20, 115, 230, 0.35);
  background: #ffffff;
  color: var(--blue);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  cursor: pointer;
}

.announce-save-btn:hover {
  background: rgba(20, 115, 230, 0.08);
}

.announce-tip {
  margin: 7px auto 0;
  font-size: 12px;
  color: var(--ink);
}

.announce-tip code {
  background: rgba(255, 255, 255, 0.8);
  padding: 1px 5px;
  border-radius: 5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.nav-inner {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.015em;
}

.brand img {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: #1d1d1f;
  padding: 4px;
  object-fit: contain;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
}

.nav-btn-ghost,
.nav-pill {
  appearance: none;
  border: 0;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 7px 15px;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.16s ease, border-color 0.16s ease;
}

.nav-btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.nav-btn-ghost:hover { background: rgba(0, 0, 0, 0.04); }

.nav-pill {
  background: var(--blue);
  color: #ffffff;
}

.nav-pill:hover { background: var(--blue-hover); }

.account-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  appearance: none;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 5px 12px 5px 6px;
  border-radius: 999px;
  cursor: pointer;
}

.account-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--ink);
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
  display: grid;
  place-items: center;
}

.account-email-short {
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 240px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.12);
  display: grid;
  gap: 10px;
  z-index: 60;
}

.account-meta {
  font-size: 12px;
  color: var(--muted);
  word-break: break-word;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line-soft);
}

.account-meta strong {
  display: block;
  color: var(--ink);
  font-size: 13px;
  margin-bottom: 2px;
}

.dropdown-btn {
  width: 100%;
  text-align: left;
  appearance: none;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
}

.dropdown-btn:hover { background: #eaecef; }

main { flex: 1; }

.hero-banner {
  padding: 44px 0 36px;
  text-align: center;
  background:
    radial-gradient(circle at 15% 40%, rgba(20, 115, 230, 0.10), transparent 45%),
    radial-gradient(circle at 85% 30%, rgba(168, 85, 247, 0.10), transparent 45%),
    #f8f9fb;
  border-bottom: 1px solid var(--line-soft);
}

.hero-banner h1 {
  margin: 0 auto 8px;
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.12;
  letter-spacing: -0.025em;
  font-weight: 700;
}

.hero-banner p {
  margin: 0 auto;
  max-width: 520px;
  font-size: 16px;
  color: var(--muted);
}

.catalog-section {
  padding: 36px 0 84px;
}

.catalog-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 300px));
  gap: 20px;
}

.product-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 256px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  transition: box-shadow 0.18s ease, border-color 0.18s ease;
}

.product-card:hover {
  border-color: rgba(0, 0, 0, 0.22);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.app-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: #1d1d1f;
  display: grid;
  place-items: center;
  overflow: hidden;
  flex: 0 0 auto;
}

.app-icon img {
  width: 26px;
  height: 26px;
  object-fit: contain;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--apple-green-bg);
  color: var(--apple-green);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--apple-green-dot);
}

.product-card h2 {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.card-desc {
  margin: 0 0 10px;
  font-size: 13px;
  line-height: 1.48;
  color: var(--muted);
}

.learn-link {
  display: inline-block;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.learn-link:hover {
  color: var(--blue);
}

.card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 24px;
}

.btn-pill-blue,
.btn-pill-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 16px;
  border-radius: 999px;
  white-space: nowrap;
  transition: background 0.16s ease, border-color 0.16s ease;
}

.btn-pill-blue {
  background: var(--blue);
  color: #ffffff;
}

.btn-pill-blue:hover { background: var(--blue-hover); }

.btn-pill-outline {
  background: #ffffff;
  color: var(--ink);
  border: 1.5px solid #2c2c2e;
}

.btn-pill-outline:hover { background: var(--bg-soft); }

/* Auth Modal */
dialog.auth-dialog {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 28px;
  width: min(420px, calc(100% - 28px));
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.2);
}

dialog.auth-dialog::backdrop {
  background: rgba(29, 29, 31, 0.45);
  backdrop-filter: blur(6px);
}

.auth-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.auth-head h2 {
  margin: 0 0 4px;
  font-size: 22px;
  letter-spacing: -0.02em;
}

.auth-head p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.auth-close {
  appearance: none;
  border: 0;
  background: var(--bg-soft);
  color: var(--ink);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  border-radius: 10px;
  background: var(--bg-soft);
  margin-bottom: 16px;
}

.auth-tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
}

.auth-tab.is-active {
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.auth-msg {
  font-size: 13px;
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 14px;
}

.auth-msg.is-error {
  background: rgba(255, 59, 48, 0.1);
  color: #b91c1c;
}

.auth-msg.is-ok {
  background: var(--apple-green-bg);
  color: var(--apple-green);
}

.auth-form {
  display: grid;
  gap: 13px;
}

.field {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
}

.field input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.16);
  background: #ffffff;
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
}

.field input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(20, 115, 230, 0.15);
}

.auth-submit {
  height: 42px;
  border: 0;
  border-radius: 999px;
  background: var(--blue);
  color: #ffffff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.auth-submit:disabled {
  opacity: 0.6;
  cursor: wait;
}

.auth-links {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 10px;
}

.auth-link-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--blue);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 4px;
}

.site-footer {
  padding: 24px 0 36px;
  border-top: 1px solid var(--line-soft);
  font-size: 13px;
  color: var(--muted);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.footer-links a { text-decoration: none; }
.footer-links a:hover { color: var(--ink); }

@media (max-width: 600px) {
  .catalog-grid { grid-template-columns: 1fr; }
  .account-email-short { max-width: 110px; }
}
