/* ================================================================
   Ally — Apple-inspired Design System
   遵循 Apple Human Interface Guidelines
   主题模式：深色为主，支持亮色切换
   ================================================================ */

/* ========== Design Tokens (Apple HIG) ========== */
:root {
  /* Brand - Apple System Blue */
  --brand-50: #e8f2ff;
  --brand-100: #cfe5ff;
  --brand-200: #9fcbff;
  --brand-300: #66abff;
  --brand-400: #2e8dff;
  --brand-500: #007aff;
  --brand-600: #0064d6;
  --brand-700: #004fad;
  --brand-800: #003b82;
  --brand-900: #00275a;

  /* Background scales */
  --bg-50: #ffffff;
  --bg-100: #f7f7fa;
  --bg-200: #f2f2f7;
  --bg-300: #e5e5ea;
  --bg-400: #d1d1d6;
  --bg-500: #aeaeb2;
  --bg-600: #8e8e93;
  --bg-700: #3a3a3c;
  --bg-800: #1c1c1e;
  --bg-850: #161618;
  --bg-900: #0b0b0d;
  --bg-950: #000000;

  /* Text scales */
  --text-50: #f5f5f7;
  --text-100: #e3e3e8;
  --text-200: #c7c7cc;
  --text-300: #aeaeb2;
  --text-400: #8e8e93;
  --text-500: #6e6e73;
  --text-600: #48484a;
  --text-700: #3c3c43;
  --text-800: #1d1d1f;
  --text-900: #000000;

  /* State colors (Apple System Colors) */
  --system-green: #30d158;
  --system-green-dark: #34c759;
  --system-red: #ff453a;
  --system-red-dark: #ff3b30;
  --system-orange: #ff9f0a;
  --system-orange-dark: #ff9500;
  --system-yellow: #ffd60a;
  --system-purple: #bf5af2;
  --system-purple-dark: #af52de;
  --system-pink: #ff375f;
  --system-teal: #64d2ff;
  --system-indigo: #5e5ce6;

  /* Semantic — Dark mode (default) */
  --background: var(--bg-900);
  --background-secondary: var(--bg-850);
  --foreground: var(--text-50);
  --foreground-secondary: var(--text-200);
  --foreground-tertiary: var(--text-400);
  --foreground-quaternary: var(--text-500);

  --card: var(--bg-800);
  --card-secondary: var(--bg-700);
  --card-foreground: var(--text-50);

  --primary: var(--brand-400);
  --primary-hover: var(--brand-300);
  --primary-foreground: var(--bg-900);

  --secondary: var(--bg-700);
  --secondary-hover: var(--bg-600);
  --secondary-foreground: var(--text-50);

  --muted: var(--bg-800);
  --muted-foreground: var(--text-400);

  --accent: var(--bg-700);
  --accent-foreground: var(--text-50);

  --destructive: var(--system-red);
  --destructive-foreground: #ffffff;
  --destructive-surface: rgba(255, 69, 58, 0.12);
  --destructive-border: rgba(255, 69, 58, 0.3);

  --success: var(--system-green);
  --success-foreground: #ffffff;
  --success-surface: rgba(48, 209, 88, 0.12);
  --success-border: rgba(48, 209, 88, 0.3);

  --warning-surface: rgba(255, 159, 10, 0.12);
  --warning-border: rgba(255, 159, 10, 0.3);
  --warning-foreground: var(--system-orange);

  --border: var(--bg-700);
  --border-strong: var(--bg-600);
  --input: var(--bg-700);
  --input-focus: var(--brand-400);
  --ring: var(--brand-400);

  --separator: rgba(84, 84, 88, 0.35);
  --separator-opaque: #38383a;

  /* Typography - Apple-style */
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
               "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "SF Mono", "JetBrains Mono", "Menlo", "Consolas", monospace;

  --text-xs: 11px;
  --text-sm: 13px;
  --text-base: 15px;
  --text-lg: 17px;
  --text-xl: 20px;
  --text-2xl: 24px;
  --text-3xl: 30px;
  --text-4xl: 40px;
  --text-5xl: 56px;

  --leading-tight: 1.2;
  --leading-normal: 1.5;
  --leading-relaxed: 1.7;

  --tracking-tight: -0.02em;
  --tracking-normal: 0;
  --tracking-wide: 0.04em;

  /* Radius - Apple-style rounded corners */
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-2xl: 28px;
  --radius-full: 9999px;

  /* Shadows - Apple-style depth */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.25), 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3), 0 2px 4px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.4), 0 4px 8px rgba(0, 0, 0, 0.25);
  --shadow-xl: 0 24px 64px rgba(0, 0, 0, 0.5), 0 8px 16px rgba(0, 0, 0, 0.3);

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* Transitions */
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light mode (可通过 .light class 启用) */
.light {
  --background: var(--bg-50);
  --background-secondary: var(--bg-100);
  --foreground: var(--text-800);
  --foreground-secondary: var(--text-600);
  --foreground-tertiary: var(--text-500);
  --foreground-quaternary: var(--text-400);

  --card: #ffffff;
  --card-secondary: var(--bg-100);
  --card-foreground: var(--text-800);

  --primary: var(--brand-500);
  --primary-hover: var(--brand-600);
  --primary-foreground: #ffffff;

  --secondary: var(--bg-200);
  --secondary-hover: var(--bg-300);
  --secondary-foreground: var(--text-800);

  --muted: var(--bg-100);
  --muted-foreground: var(--text-500);

  --border: var(--bg-300);
  --border-strong: var(--bg-400);
  --input: var(--bg-300);
  --input-focus: var(--brand-500);
  --ring: var(--brand-500);

  --separator: rgba(60, 60, 67, 0.18);
  --separator-opaque: #e5e5ea;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.1), 0 4px 8px rgba(0, 0, 0, 0.06);
  --shadow-xl: 0 24px 64px rgba(0, 0, 0, 0.12), 0 8px 16px rgba(0, 0, 0, 0.08);
}

/* ========== Base Reset ========== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--foreground);
  background: var(--background);
  min-height: 100vh;
  letter-spacing: var(--tracking-normal);
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-fast);
}

img, svg {
  display: block;
  max-width: 100%;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* ========== Navigation ========== */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
  padding: 0 var(--space-6);
  background: rgba(28, 28, 30, 0.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--separator);
}

.light .nav {
  background: rgba(255, 255, 255, 0.72);
}

.nav .logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: var(--tracking-tight);
}

.nav .logo .mark {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--brand-400), var(--system-purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.nav .links {
  display: flex;
  gap: var(--space-1);
  align-items: center;
}

.nav .links a {
  color: var(--foreground-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
  padding: 6px var(--space-3);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.nav .links a:hover {
  color: var(--foreground);
  background: var(--secondary);
}

.nav .links a.on {
  color: var(--foreground);
  background: var(--accent);
}

.nav .userbox {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.nav .uname {
  font-size: var(--text-sm);
  color: var(--foreground-secondary);
}

.nav .logout {
  color: var(--system-red);
  font-size: var(--text-sm);
  font-weight: 500;
}

/* ========== Layout Wrapper ========== */
.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: var(--space-8) var(--space-5) var(--space-16);
}

.page-title {
  font-size: var(--text-3xl);
  font-weight: 700;
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-tight);
  margin-bottom: var(--space-2);
}

.page-sub {
  color: var(--foreground-tertiary);
  font-size: var(--text-base);
  margin-bottom: var(--space-6);
}

/* ========== Buttons ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: 40px;
  padding: 0 var(--space-5);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: var(--font-sans);
  letter-spacing: var(--tracking-tight);
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  text-decoration: none;
}

.btn:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Primary */
.btn-primary, .btn {
  background: var(--primary);
  color: var(--primary-foreground);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover, .btn:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn:active {
  transform: translateY(0);
}

/* Secondary / Ghost */
.btn-ghost {
  background: var(--secondary);
  color: var(--secondary-foreground);
  box-shadow: none;
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: var(--secondary-hover);
  border-color: var(--border-strong);
}

/* Destructive */
.btn-red {
  background: var(--destructive-surface);
  color: var(--destructive);
  border: 1px solid var(--destructive-border);
  box-shadow: none;
}

.btn-red:hover {
  background: rgba(255, 69, 58, 0.2);
}

.btn-sm {
  height: 32px;
  padding: 0 var(--space-3);
  font-size: var(--text-sm);
  border-radius: var(--radius-sm);
}

.btn-lg {
  height: 50px;
  padding: 0 var(--space-6);
  font-size: var(--text-base);
  border-radius: var(--radius-md);
}

/* ========== Cards ========== */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin-bottom: var(--space-5);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card h2 {
  font-size: var(--text-lg);
  font-weight: 600;
  margin-bottom: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  letter-spacing: var(--tracking-tight);
}

.card h2 .dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--primary);
}

/* ========== Form Elements ========== */
input, select, textarea {
  padding: 10px 14px;
  border: 1px solid var(--input);
  border-radius: var(--radius-md);
  background: var(--background-secondary);
  color: var(--foreground);
  font-size: var(--text-sm);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

input:focus, select:focus, textarea:focus {
  border-color: var(--input-focus);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15);
}

textarea {
  width: 100%;
  resize: vertical;
  min-height: 120px;
  line-height: var(--leading-relaxed);
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

label {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--foreground-secondary);
}

.form-col {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  max-width: 420px;
}

/* ========== Messages / Alerts ========== */
.msg {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  margin-bottom: var(--space-4);
  border: 1px solid transparent;
}

.msg.err {
  background: var(--destructive-surface);
  border-color: var(--destructive-border);
  color: var(--system-red);
}

.msg.ok {
  background: var(--success-surface);
  border-color: var(--success-border);
  color: var(--system-green);
}

/* ========== Badges & Tags ========== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.01em;
}

.badge.pin {
  background: var(--warning-surface);
  color: var(--system-orange);
}

.badge.feat {
  background: rgba(191, 90, 242, 0.15);
  color: var(--system-purple);
}

.badge.hot {
  background: var(--success-surface);
  color: var(--system-green);
}

.badge.admin {
  background: var(--warning-surface);
  color: var(--system-orange);
}

.badge.user {
  background: var(--secondary);
  color: var(--foreground-tertiary);
}

.badge.on {
  background: var(--success-surface);
  color: var(--system-green);
}

.badge.off {
  background: var(--destructive-surface);
  color: var(--system-red);
}

.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 500;
  background: var(--secondary);
  color: var(--foreground-secondary);
}

.st {
  font-size: var(--text-xs);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-weight: 600;
  white-space: nowrap;
}

/* ========== Stats ========== */
.stats {
  display: flex;
  gap: var(--space-8);
  margin: var(--space-2) 0 var(--space-6);
}

.stats .item {
  text-align: left;
}

.stats .num {
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--primary);
  letter-spacing: var(--tracking-tight);
  line-height: 1;
}

.stats .lbl {
  font-size: var(--text-sm);
  color: var(--foreground-tertiary);
  margin-top: var(--space-2);
}

/* ========== Tables ========== */
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--text-sm);
}

.table th, .table td {
  padding: var(--space-3) var(--space-3);
  text-align: left;
  border-bottom: 1px solid var(--separator);
  vertical-align: middle;
}

.table th {
  color: var(--foreground-tertiary);
  font-weight: 500;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  white-space: nowrap;
}

.table tr:last-child td {
  border-bottom: none;
}

.table tr:hover td {
  background: var(--background-secondary);
}

.table .t-title {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--foreground);
}

.table .t-title:hover {
  color: var(--primary);
}

/* ========== Pagination ========== */
.pager {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  justify-content: center;
  margin-top: var(--space-6);
  flex-wrap: wrap;
}

.pager a, .pager span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 500;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--foreground-secondary);
  transition: all var(--transition-fast);
}

.pager a:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.pager .cur {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-foreground);
}

/* ========== Utility Classes ========== */
.mono { font-family: var(--font-mono); }
.muted { color: var(--foreground-tertiary); }
.small { font-size: var(--text-sm); }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; gap: var(--space-3); align-items: center; }

.empty {
  color: var(--foreground-tertiary);
  font-size: var(--text-sm);
  padding: var(--space-8) 0;
  text-align: center;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--brand-400), var(--system-purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: #fff;
  font-size: 15px;
  flex-shrink: 0;
  box-shadow: var(--shadow-xs);
}

/* ========== Auth Pages (Login / Register) ========== */
.auth-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 52px - 80px);
  padding: var(--space-8) var(--space-5);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  box-shadow: var(--shadow-lg);
}

.auth-card h1 {
  font-size: var(--text-2xl);
  font-weight: 700;
  letter-spacing: var(--tracking-tight);
  margin-bottom: var(--space-1);
}

.auth-card .sub {
  color: var(--foreground-tertiary);
  font-size: var(--text-sm);
  margin-bottom: var(--space-6);
}

.auth-card .btn {
  width: 100%;
  height: 46px;
  font-size: var(--text-base);
  margin-top: var(--space-2);
}

.auth-alt {
  margin-top: var(--space-5);
  text-align: center;
  font-size: var(--text-sm);
  color: var(--foreground-tertiary);
}

.auth-alt a {
  color: var(--primary);
  font-weight: 500;
}

.auth-alt a:hover {
  text-decoration: underline;
}

/* ========== Forum — Board Grid ========== */
.board-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-4);
}

.board-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.board-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.board-card .bname {
  font-size: var(--text-lg);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  letter-spacing: var(--tracking-tight);
}

.board-card .bname a:hover {
  color: var(--primary);
}

.board-card .bdesc {
  color: var(--foreground-tertiary);
  font-size: var(--text-sm);
  margin-top: var(--space-2);
  line-height: var(--leading-relaxed);
}

.board-card .binfo {
  display: flex;
  gap: var(--space-4);
  margin-top: var(--space-3);
  font-size: var(--text-xs);
  color: var(--foreground-tertiary);
}

.board-card .blast {
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--separator);
  font-size: var(--text-xs);
  color: var(--foreground-tertiary);
}

.board-card .blast a {
  color: var(--primary);
  font-weight: 500;
}

/* ========== Forum Subheader ========== */
.forum-sub {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-5);
  gap: var(--space-4);
}

.forum-sub .page-title {
  margin-bottom: var(--space-1);
}

.forum-sub .page-sub {
  margin-bottom: 0;
}

.topic-title {
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--foreground);
}

.topic-title:hover {
  color: var(--primary);
}

.topic-meta {
  font-size: var(--text-xs);
  color: var(--foreground-tertiary);
  margin-top: var(--space-1);
}

/* ========== Post Cards (Thread Detail) ========== */
.post-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-4);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.post-card .phead {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--separator);
}

.post-card .pname {
  font-weight: 600;
  font-size: var(--text-sm);
}

.post-card .ptime {
  color: var(--foreground-tertiary);
  font-size: var(--text-xs);
  margin-top: 2px;
}

.post-card .floor {
  margin-left: auto;
  color: var(--foreground-tertiary);
  font-size: var(--text-xs);
  font-weight: 500;
}

.post-card .pbody {
  padding: var(--space-5);
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  word-break: break-word;
  white-space: pre-wrap;
  color: var(--foreground);
}

.post-card .pfoot {
  padding: var(--space-2) var(--space-5);
  border-top: 1px solid var(--separator);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* Like Button */
.like-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  background: transparent;
  border: 1px solid var(--border);
  color: var(--foreground-tertiary);
  transition: all var(--transition-fast);
}

.like-btn:hover {
  border-color: var(--system-red);
  color: var(--system-red);
  background: var(--destructive-surface);
}

.like-btn.liked {
  background: var(--destructive-surface);
  border-color: var(--system-red);
  color: var(--system-red);
}

/* ========== Product Grid (Store) ========== */
.prod-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-5);
}

.prod {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.prod:hover {
  border-color: var(--border-strong);
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.prod .pname {
  font-size: var(--text-xl);
  font-weight: 600;
  letter-spacing: var(--tracking-tight);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.prod .pdesc {
  color: var(--foreground-tertiary);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  margin: var(--space-3) 0 var(--space-5);
  flex: 1;
}

.prod .pprice {
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--primary);
  letter-spacing: var(--tracking-tight);
  line-height: 1;
}

.prod .pprice small {
  font-size: var(--text-sm);
  color: var(--foreground-tertiary);
  font-weight: 500;
  margin-left: 4px;
}

.prod .pdays {
  font-size: var(--text-sm);
  color: var(--foreground-tertiary);
  margin: var(--space-2) 0 var(--space-5);
}

.prod .pfoot {
  display: flex;
  gap: var(--space-3);
}

.prod .pfoot .btn {
  flex: 1;
}

/* ========== News List (Announcements) ========== */
.news-list {
  display: flex;
  flex-direction: column;
}

.news-item {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--separator);
  transition: background var(--transition-fast);
  border-radius: var(--radius-sm);
}

.news-item:last-child {
  border-bottom: none;
}

.news-item:hover {
  background: var(--background-secondary);
  margin: 0 calc(var(--space-2) * -1);
  padding-left: var(--space-2);
  padding-right: var(--space-2);
}

.news-item .nmark {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 18px;
}

.news-item .ntitle {
  font-size: var(--text-base);
  font-weight: 500;
}

.news-item .ntitle:hover {
  color: var(--primary);
}

.news-item .nmeta {
  color: var(--foreground-tertiary);
  font-size: var(--text-xs);
  margin-top: var(--space-1);
}

/* ========== User Profile — Info Grid ========== */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-3);
}

.info-cell {
  background: var(--background-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
}

.info-cell .il {
  font-size: var(--text-xs);
  color: var(--foreground-tertiary);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  margin-bottom: var(--space-2);
  font-weight: 600;
}

.info-cell .iv {
  font-size: var(--text-sm);
  font-weight: 500;
  word-break: break-all;
}

.key-box {
  background: var(--success-surface);
  border: 1px solid var(--success-border);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--system-green);
  letter-spacing: 1px;
}

/* ========== Footer ========== */
.footer {
  text-align: center;
  padding: var(--space-6) var(--space-5);
  border-top: 1px solid var(--separator);
  color: var(--foreground-tertiary);
  font-size: var(--text-sm);
}

/* ========== Hero Section (Home) ========== */
.hero {
  text-align: center;
  padding: var(--space-16) var(--space-5) var(--space-12);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 400px;
  background: radial-gradient(ellipse at center, rgba(0, 122, 255, 0.15) 0%, transparent 70%);
  pointer-events: none;
}

.hero h1 {
  font-size: var(--text-5xl);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
  position: relative;
  z-index: 1;
}

.hero h1 span {
  background: linear-gradient(135deg, var(--brand-400), var(--system-purple));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero p {
  color: var(--foreground-tertiary);
  font-size: var(--text-lg);
  margin-top: var(--space-4);
  line-height: var(--leading-relaxed);
  max-width: 580px;
  margin-left: auto;
  margin-right: auto;
  position: relative;
  z-index: 1;
}

.hero .badges {
  margin-top: var(--space-6);
  display: flex;
  gap: var(--space-2);
  justify-content: center;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}

.badge-pill {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--foreground-secondary);
  font-size: var(--text-sm);
  padding: 6px var(--space-4);
  border-radius: var(--radius-full);
  backdrop-filter: blur(10px);
}

/* ========== Home — Game Cards ========== */
.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-4);
}

.game-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.game-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.game-card .head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

.game-card .name {
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: var(--tracking-tight);
}

.game-card .desc {
  color: var(--foreground-tertiary);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  min-height: 40px;
}

.game-card .foot {
  margin-top: var(--space-4);
  font-size: var(--text-sm);
  color: var(--foreground-tertiary);
}

.game-card .foot a {
  color: var(--primary);
  font-weight: 500;
}

.game-card .foot a:hover {
  text-decoration: underline;
}

/* ========== Modal ========== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: var(--space-5);
}

.modal-content {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  max-width: 420px;
  width: 100%;
  box-shadow: var(--shadow-xl);
}

.modal-content h2 {
  font-size: var(--text-xl);
  font-weight: 600;
  margin-bottom: var(--space-3);
  letter-spacing: var(--tracking-tight);
}

/* ========== Action Links ========== */
.act-link {
  background: none;
  border: none;
  cursor: pointer;
  font-size: var(--text-sm);
  color: var(--primary);
  padding: 0;
}

.act-link:hover {
  text-decoration: underline;
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
  .nav {
    padding: 0 var(--space-4);
    height: 48px;
  }

  .nav .links {
    gap: 2px;
  }

  .nav .links a {
    padding: 6px 10px;
    font-size: var(--text-xs);
  }

  .wrap {
    padding: var(--space-6) var(--space-4) var(--space-12);
  }

  .page-title {
    font-size: var(--text-2xl);
  }

  .hero h1 {
    font-size: var(--text-4xl);
  }

  .hero p {
    font-size: var(--text-base);
  }

  .stats {
    gap: var(--space-6);
  }

  .stats .num {
    font-size: var(--text-2xl);
  }

  .forum-sub {
    flex-direction: column;
    align-items: flex-start;
  }

  .auth-card {
    padding: var(--space-6);
  }

  .board-grid,
  .prod-grid,
  .home-grid {
    grid-template-columns: 1fr;
  }

  .info-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 480px) {
  .info-grid {
    grid-template-columns: 1fr;
  }

  .hero h1 {
    font-size: var(--text-3xl);
  }

  .stats {
    flex-wrap: wrap;
    gap: var(--space-4);
  }
}
