/* =========================================================
   Kron Arcade - Google Playground Inspired Interface System
   Layout Reference: playground.google/explore/all
   Precision Vector SVGs, Tall Poster Cards, Restrained Typography
   ========================================================= */

:root {
  --bg-app: #0E121B;
  --bg-rail: #0A0D14;
  --bg-topbar: rgba(14, 18, 27, 0.85);
  --bg-card: #161C28;
  --bg-card-hover: #1C2433;
  --bg-pill: rgba(255, 255, 255, 0.06);
  --bg-pill-hover: rgba(255, 255, 255, 0.12);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.2);
  --text-primary: #FFFFFF;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  --accent-purple: #8B5CF6;
  --accent-purple-glow: rgba(139, 92, 246, 0.35);
  --accent-blue: #0A84FF;
  --duo-green: #58CC02;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "PingFang SC", "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg-app);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

/* ================= 1. 左侧 Slim Dock / Navigation Rail ================= */
.pg-rail {
  width: 76px;
  background: var(--bg-rail);
  border-right: 1px solid var(--border-subtle);
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 0;
  z-index: 100;
  user-select: none;
}

.pg-rail-brand {
  width: 44px;
  height: 44px;
  margin-bottom: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pg-rail-brand svg.kron-head {
  width: 100%;
  height: 100%;
}

.pg-rail-menu {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  flex: 1;
}

.pg-rail-item {
  width: 60px;
  height: 56px;
  border-radius: 16px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
}

.pg-rail-item span {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.pg-rail-item:hover {
  color: var(--text-primary);
  background: var(--bg-pill);
}

.pg-rail-item.is-active {
  background: rgba(139, 92, 246, 0.18);
  color: #C084FC;
}

.pg-rail-item.is-active svg {
  stroke: #C084FC;
}

/* ================= 2. 主视口区域 ================= */
.pg-viewport {
  margin-left: 76px;
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-app);
}

/* ================= 3. 顶部 App Bar ================= */
.pg-topbar {
  height: 64px;
  background: var(--bg-topbar);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  gap: 20px;
}

.pg-topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 180px;
}

.pg-logo-text {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.4px;
  color: #FFFFFF;
}

.pg-topbar-center {
  flex: 1;
  max-width: 600px;
  position: relative;
}

.pg-search-box {
  width: 100%;
  height: 42px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  padding: 0 16px 0 42px;
  color: #FFFFFF;
  font-size: 13.5px;
  font-weight: 500;
  outline: none;
  transition: all 0.2s ease;
}

.pg-search-box:focus {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

.pg-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.pg-topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 200px;
  justify-content: flex-end;
}

.pg-bank-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #1E293B;
  border: 2px solid #334155;
  border-bottom: 4px solid #0F172A;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  color: #E2E8F0;
  cursor: pointer;
  transition: all 0.08s ease;
}

.pg-bank-pill:hover {
  background: #283548;
}

.pg-bank-pill:active {
  transform: translateY(2px);
  border-bottom-width: 2px;
}

.pg-bank-badge {
  background: var(--accent-purple);
  color: #FFF;
  font-size: 10.5px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 5px;
}

.pg-btn-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: #1E293B;
  border: 2px solid #334155;
  border-bottom: 4px solid #0F172A;
  color: #CBD5E1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.08s ease;
}

.pg-btn-icon:hover {
  background: #283548;
  color: #FFF;
}

.pg-btn-icon:active {
  transform: translateY(2px);
  border-bottom-width: 2px;
}

.pg-avatar-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #1E293B;
  border: 2px solid #334155;
  border-bottom: 4px solid #0F172A;
  padding: 4px 12px 4px 4px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.08s ease;
  user-select: none;
}

.pg-avatar-chip:hover {
  background: #283548;
}

.pg-avatar-chip:active {
  transform: translateY(2px);
  border-bottom-width: 2px;
}

.user-chip-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #A855F7, #EC4899);
  color: #FFF;
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-chip-info {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.user-chip-name {
  font-size: 11.5px;
  font-weight: 700;
  color: #F1F5F9;
  line-height: 1.2;
}

.user-chip-role {
  font-size: 9.5px;
  color: #94A3B8;
  line-height: 1.1;
}

/* ================= 4. 次级栏 (Subheader & Filter Carousel) ================= */
.pg-sub-section {
  padding: 20px 32px 12px;
}

.pg-subheader-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.pg-sub-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
}

.pg-sort-pill {
  background: #7038DB;
  color: #FFFFFF;
  border: none;
  border-bottom: 4px solid #5524B5;
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.08s ease;
}

.pg-sort-pill:hover {
  background: #7E42EA;
}

.pg-sort-pill:active {
  transform: translateY(2px);
  border-bottom-width: 2px;
}

/* 横向圆形分类图标轮播条 (Google Playground Circle Stack) */
.pg-category-rail {
  display: flex;
  align-items: center;
  gap: 18px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: none;
}

.pg-category-rail::-webkit-scrollbar {
  display: none;
}

.pg-cat-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: none;
  cursor: pointer;
  user-select: none;
  padding: 4px;
}

.pg-cat-circle {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 1.5px solid var(--border-subtle);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.pg-cat-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  transition: color 0.15s ease;
}

.pg-cat-btn:hover .pg-cat-circle {
  background: rgba(255, 255, 255, 0.1);
  color: #FFF;
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

.pg-cat-btn:hover .pg-cat-label {
  color: #FFF;
}

.pg-cat-btn.is-active .pg-cat-circle {
  background: #7038DB;
  border-color: #A855F7;
  color: #FFFFFF;
  box-shadow: 0 4px 16px rgba(112, 56, 219, 0.4);
}

.pg-cat-btn.is-active .pg-cat-label {
  color: #FFFFFF;
  font-weight: 700;
}

/* ================= 5. Google Playground 4:5 画报海报卡片网格 ================= */
.pg-content-area {
  padding: 10px 32px 60px;
  flex: 1;
}

.pg-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 22px;
}

.pg-game-card {
  position: relative;
  background: var(--bg-card);
  border: 1.5px solid var(--border-subtle);
  border-radius: 26px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  user-select: none;
}

.pg-game-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-purple);
  transform: translateY(-5px);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.4), 0 0 24px var(--accent-purple-glow);
}

/* 顶部画报封面 (4:5 街机黄金海报比例) */
.pg-card-cover-wrap {
  width: 100%;
  aspect-ratio: 4 / 5;
  position: relative;
  background: #111622;
  overflow: hidden;
}

.pg-card-cover-wrap img.game-cover-art,
.pg-card-cover-wrap svg.game-cover-art {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.pg-game-card:hover img.game-cover-art,
.pg-game-card:hover svg.game-cover-art {
  transform: scale(1.05);
}

/* 封面浮动标签 */
.pg-cover-pills {
  position: absolute;
  bottom: 10px;
  left: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}

.pg-pill-tag {
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #E2E8F0;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* 右上角悬浮动作按键 */
.pg-card-share-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #1E293B;
  border: 1.5px solid #334155;
  border-bottom: 3.5px solid #0F172A;
  color: #FFF;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.85);
  transition: all 0.15s ease;
}

.pg-card-share-btn:hover {
  background: #283548;
}

.pg-card-share-btn:active {
  transform: translateY(2px) scale(0.95);
  border-bottom-width: 1.5px;
}

.pg-game-card:hover .pg-card-share-btn {
  opacity: 1;
  transform: scale(1);
}

/* 下半部内容区 */
.pg-card-body {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex: 1;
}

.pg-card-title {
  font-size: 16.5px;
  font-weight: 800;
  color: #FFFFFF;
  margin-bottom: 2px;
  letter-spacing: -0.2px;
}

.pg-card-sub {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 14px;
}

/* 底部作者与热度统计行 */
.pg-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 11.5px;
  color: var(--text-muted);
}

.pg-card-author {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: #CBD5E1;
}

.pg-author-avatar {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-purple);
  color: #FFF;
  font-size: 9px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pg-card-stats {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pg-stat-item {
  display: flex;
  align-items: center;
  gap: 3px;
}

/* ================= 6. 未登录锁止置灰层 ================= */
.pg-game-card.is-locked {
  filter: grayscale(0.85);
  opacity: 0.65;
}

.pg-game-card.is-locked:hover {
  filter: grayscale(0.4);
  opacity: 0.85;
}

.pg-locked-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #FBBF24;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  z-index: 5;
}

/* ================= 7. 响应式微调 ================= */
@media (max-width: 900px) {
  .pg-rail {
    width: 64px;
  }
  .pg-viewport {
    margin-left: 64px;
  }
  .pg-topbar {
    padding: 0 18px;
  }
  .pg-sub-section {
    padding: 16px 18px 8px;
  }
  .pg-content-area {
    padding: 8px 18px 40px;
  }
  .pg-cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }
}

@media (max-width: 640px) {
  .pg-rail {
    display: none;
  }
  .pg-viewport {
    margin-left: 0;
  }
  .pg-topbar-left {
    min-width: auto;
  }
  .pg-topbar-center {
    display: none;
  }
}

/* ================= 8. 教材选择弹窗与抽屉系统 (Apple Frosted Glass) ================= */
.curriculum-modal,
.custom-deck-drawer,
.word-preview-drawer {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(10, 13, 20, 0.72);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.curriculum-modal.is-open,
.custom-deck-drawer.is-open,
.word-preview-drawer.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* 教材弹窗卡片 */
.curriculum-sheet {
  width: min(740px, 94vw);
  max-height: 85vh;
  background: #161C28;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 28px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.96) translateY(10px);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.curriculum-modal.is-open .curriculum-sheet {
  transform: scale(1) translateY(0);
}

.curriculum-sheet-header {
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.curriculum-sheet-title {
  font-size: 18px;
  font-weight: 800;
  color: #FFFFFF;
}

.curriculum-sheet-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.curriculum-select-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.curriculum-field-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #94A3B8;
  margin-bottom: 6px;
}

.curriculum-select {
  width: 100%;
  height: 42px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  padding: 0 14px;
  color: #FFFFFF;
  font-size: 13.5px;
  font-weight: 600;
  outline: none;
  transition: border-color 0.15s ease;
}

.curriculum-select:focus {
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.25);
}

.curriculum-select option {
  background: #161C28;
  color: #FFFFFF;
}

/* 单元卡片网格 */
.unit-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 4px;
}

.unit-card {
  background: #1A2234;
  border: 2px solid #2A364E;
  border-bottom: 4px solid #141B2A;
  border-radius: 16px;
  padding: 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 90px;
  transition: all 0.08s ease;
}

.unit-card:hover {
  background: #222C42;
  border-color: #3B4B6C;
  transform: translateY(-1px);
}

.unit-card:active {
  transform: translateY(2px);
  border-bottom-width: 2px;
}

.unit-card.is-active {
  background: #8B5CF6;
  border-color: #A78BFA;
  border-bottom: 4px solid #6D28D9;
  box-shadow: 0 0 18px rgba(139, 92, 246, 0.4);
}

.unit-card.is-active .unit-card-title {
  color: #FFFFFF;
}

.unit-card.is-active .unit-card-meta {
  color: #E9D5FF;
}

.unit-card-title {
  font-size: 14px;
  font-weight: 700;
  color: #FFFFFF;
  line-height: 1.3;
}

.unit-card-meta {
  font-size: 11.5px;
  color: #94A3B8;
  margin-top: 4px;
}

/* 自建词库抽屉 & 词表抽屉 (右侧滑入) */
.custom-deck-drawer,
.word-preview-drawer {
  justify-content: flex-end;
  padding: 0;
}

.custom-deck-sheet,
.word-preview-sheet {
  width: min(440px, 100vw);
  height: 100vh;
  background: #161C28;
  border-left: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: -16px 0 40px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  padding: 28px 24px;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.custom-deck-drawer.is-open .custom-deck-sheet,
.word-preview-drawer.is-open .word-preview-sheet {
  transform: translateX(0);
}

.custom-textarea {
  width: 100%;
  height: 220px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  padding: 12px 14px;
  color: #FFFFFF;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  outline: none;
  margin-bottom: 16px;
}

.custom-textarea:focus {
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.25);
}

/* 词表预览项 */
.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.preview-body {
  flex: 1;
  overflow-y: auto;
}

.preview-word-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  margin-bottom: 8px;
}

.preview-word-en {
  font-size: 14px;
  font-weight: 700;
  color: #FFFFFF;
}

.preview-word-cn {
  font-size: 12.5px;
  color: #94A3B8;
  margin-top: 2px;
}

/* 按钮样式 (统一多邻国 3D 触控风格) */
.btn-nav-action {
  background: #1E293B;
  border: 2px solid #334155;
  border-bottom: 4px solid #0F172A;
  color: #F8FAFC;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.08s ease;
}

.btn-nav-action:hover {
  background: #283548;
  color: #FFF;
}

.btn-nav-action:active {
  transform: translateY(2px);
  border-bottom-width: 2px;
}

.btn-duo-primary {
  background: var(--duo-green);
  color: #FFF;
  border: none;
  border-bottom: 4px solid #46A302;
  padding: 10px 22px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.08s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-duo-primary:hover {
  background: #61E002;
}

.btn-duo-primary:active {
  transform: translateY(2px);
  border-bottom-width: 2px;
}

.btn-apple-secondary {
  background: #334155;
  color: #F8FAFC;
  border: 2px solid #475569;
  border-bottom: 4px solid #1E293B;
  padding: 10px 20px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.08s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-apple-secondary:hover {
  background: #3E4E63;
}

.btn-apple-secondary:active {
  transform: translateY(2px);
  border-bottom-width: 2px;
}
