/* ============================================================
   Modo AI Platform — Global Design System
   Dark Voxel World + Pixel-Style UI
   ============================================================ */

/* === Local Fonts === */
@font-face {
  font-family: 'ResourceHanRoundedCN';
  src: url('../assets/fronts/ResourceHanRoundedCN-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
}
@font-face {
  font-family: 'ResourceHanRoundedCN';
  src: url('../assets/fronts/ResourceHanRoundedCN-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
}
@font-face {
  font-family: 'ResourceHanRoundedCN';
  src: url('../assets/fronts/ResourceHanRoundedCN-Heavy.ttf') format('truetype');
  font-weight: 900;
  font-style: normal;
}
@font-face {
  font-family: 'Rubik';
  src: url('../assets/fronts/Rubik-VariableFont_wght.ttf') format('truetype');
  font-weight: 300 900;
  font-style: normal;
}
@font-face {
  font-family: 'Rubik';
  src: url('../assets/fronts/Rubik-Italic-VariableFont_wght.ttf') format('truetype');
  font-weight: 300 900;
  font-style: italic;
}

/* ============================================================
   1. CSS Custom Properties
   ============================================================ */

:root {
  /* --- Brand Colors --- */
  --text-heading:      #123E35;
  --modo-emerald:      #75F0CD;
  --modo-emerald-dark: #30E8B4;
  --modo-emerald-deep: #0E8160;
  --modo-emerald-glow: rgba(117, 240, 205, 0.25);

  --cyber-coral:       #F07575;
  --cyber-coral-dark:  #E83030;
  --cyber-coral-deep:  #C52020;
  --cyber-coral-glow:  rgba(240, 117, 117, 0.25);

  --gallery-blue:      #75A4F0;
  --gallery-blue-dark: #3077E8;
  --gallery-blue-deep: #134FAE;
  --gallery-blue-glow: rgba(117, 164, 240, 0.25);

  /* --- Background System --- */
  --bg-primary:   #F0F2F5;
  --bg-secondary: #FFFFFF;
  --bg-tertiary:  #E8ECF1;
  --bg-elevated:  #F7F8FA;

  /* --- Text System --- */
  --text-primary:   #1A1F2E;
  --text-secondary: #5A6070;
  --text-muted:     #6B7482;
  --text-dark:      #F7F8FA;

  /* --- Border System --- */
  --border-subtle: #D8DCE3;
  --border-pixel:  #C0C7D2;
  --border-active: #75F0CD;

  /* --- Spacing Scale (8px base) --- */
  --space-1:  8px;
  --space-2:  16px;
  --space-3:  24px;
  --space-4:  32px;
  --space-5:  40px;
  --space-6:  48px;
  --space-8:  64px;
  --space-10: 80px;

  /* --- Layout --- */
  --max-width: 1400px;
  --header-height: 72px;
  --bottom-nav-height: 72px;

  /* --- Typography Scale --- */
  --font-hero:    800 48px/1.2 'Rubik', 'ResourceHanRoundedCN', sans-serif;
  --font-h1:      700 32px/1.3 'Rubik', 'ResourceHanRoundedCN', sans-serif;
  --font-h2:      700 24px/1.4 'Rubik', 'ResourceHanRoundedCN', sans-serif;
  --font-h3:      600 18px/1.4 'Rubik', 'ResourceHanRoundedCN', sans-serif;
  --font-body:    400 16px/1.6 'Rubik', 'ResourceHanRoundedCN', sans-serif;
  --font-caption: 400 14px/1.5 'Rubik', 'ResourceHanRoundedCN', sans-serif;
  --font-small:   400 12px/1.4 'Rubik', 'ResourceHanRoundedCN', sans-serif;
  /* --- Motion Tokens (transitions.dev) --- */
  --duration-stagger: 40ms;
  --duration-micro: 80ms;
  --duration-quick: 150ms;
  --duration-fast: 250ms;
  --duration-medium: 350ms;
  --duration-slow: 400ms;
  --duration-very-slow: 500ms;

  --ease-smooth-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: ease-in-out;
  --ease-out: ease-out;
  --ease-linear: linear;
  --ease-bounce: cubic-bezier(0.34, 1.36, 0.64, 1);
  --ease-bounce-strong: cubic-bezier(0.34, 3.85, 0.64, 1);

  --distance-micro: 4px;
  --distance-small: 6px;
  --distance-base: 8px;
  --distance-medium: 12px;
  --distance-large: 30px;

  --scale-large: 0.96;
  --scale-medium: 0.97;
  --scale-small: 0.98;
  --scale-tiny: 0.99;

  --blur-small: 2px;
  --blur-medium: 3px;
  --blur-large: 8px;

  /* --- Texts Reveal --- */
  --stagger-dur: 500ms;
  --stagger-distance: 12px;
  --stagger-stagger: 40ms;
  --stagger-blur: 3px;
  --stagger-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ============================================================
   2. Reset & Base
   ============================================================ */

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: calc(100vh - var(--tv-bezel) - var(--tv-side));
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
}

img {
  max-width: 100%;
  display: block;
}

ul, ol {
  list-style: none;
}

/* ============================================================
   3. Typography Utilities
   ============================================================ */

.text-hero    { font: var(--font-hero); }
.text-h1      { font: var(--font-h1); }
.text-h2      { font: var(--font-h2); }
.text-h3      { font: var(--font-h3); }
.text-body    { font: var(--font-body); }
.text-caption { font: var(--font-caption); }
.text-small   { font: var(--font-small); }

.text-secondary { color: var(--text-secondary); }
.text-muted     { color: var(--text-muted); }
.text-emerald   { color: var(--modo-emerald-deep); }
.text-coral     { color: var(--cyber-coral-deep); }
.text-blue      { color: var(--gallery-blue-deep); }

.text-center { text-align: center; }
.text-right  { text-align: right; }

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============================================================
   4. Layout Utilities
   ============================================================ */

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-4);
}

.flex       { display: flex; }
.flex-col   { display: flex; flex-direction: column; }
.flex-wrap  { flex-wrap: wrap; }
.inline-flex { display: inline-flex; }

.items-center { align-items: center; }
.items-start  { align-items: flex-start; }
.items-end    { align-items: flex-end; }
.items-stretch { align-items: stretch; }

.justify-center   { justify-content: center; }
.justify-between  { justify-content: space-between; }
.justify-around   { justify-content: space-around; }
.justify-end      { justify-content: flex-end; }

.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }

.grid { display: grid; }

.grid-cols-1 { grid-template-columns: 1fr; }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid-cols-5 { grid-template-columns: repeat(5, 1fr); }

/* ============================================================
   5. Voxel / Pixel Background
   ============================================================ */

.voxel-bg {
  background-color: var(--bg-primary);
  background-image:
    linear-gradient(rgba(0, 200, 140, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 200, 140, 0.04) 1px, transparent 1px);
  background-size: 32px 32px;
}

/* ============================================================
   6. Pixel Border Card
   ============================================================ */

.pixel-border {
  border: 3px solid var(--border-pixel);
  border-radius: 8px;
  box-shadow:
    4px 4px 0 rgba(0, 0, 0, 0.4),
    inset -2px -2px 0 rgba(0, 0, 0, 0.2),
    inset 2px 2px 0 rgba(255, 255, 255, 0.05);
  background: var(--bg-secondary);
}

/* ============================================================
   7. Pixel Buttons
   ============================================================ */

/* Base pixel button */
.pixel-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 0;
  padding: 12px 24px;
  font-weight: 700;
  font-size: 16px;
  font-family: inherit;
  transition: all 0.1s ease;
  cursor: pointer;
  user-select: none;
  border: 3px solid transparent;
}

.pixel-btn:hover {
  transform: translate(2px, 2px);
}

.pixel-btn:active {
  transform: translate(4px, 4px);
}

/* Primary — Emerald */
.pixel-btn-primary {
  background: var(--modo-emerald);
  color: #000000;
  border-color: var(--modo-emerald-dark);
  box-shadow: 4px 4px 0 var(--modo-emerald-dark);
}

.pixel-btn-primary:hover {
  box-shadow: 2px 2px 0 var(--modo-emerald-dark);
}

.pixel-btn-primary:active {
  box-shadow: 0 0 0 var(--modo-emerald-dark);
}

/* Coral — Chat */
.pixel-btn-coral {
  background: var(--cyber-coral);
  color: var(--text-primary);
  border-color: var(--cyber-coral-dark);
  box-shadow: 4px 4px 0 var(--cyber-coral-dark);
}

.pixel-btn-coral:hover {
  box-shadow: 2px 2px 0 var(--cyber-coral-dark);
}

.pixel-btn-coral:active {
  box-shadow: 0 0 0 var(--cyber-coral-dark);
}

/* Blue — Gallery */
.pixel-btn-blue {
  background: var(--gallery-blue);
  color: var(--text-primary);
  border-color: var(--gallery-blue-dark);
  box-shadow: 4px 4px 0 var(--gallery-blue-dark);
}

.pixel-btn-blue:hover {
  box-shadow: 2px 2px 0 var(--gallery-blue-dark);
}

.pixel-btn-blue:active {
  box-shadow: 0 0 0 var(--gallery-blue-dark);
}

/* Secondary — Outline */
.pixel-btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border-pixel);
  box-shadow: none;
}

.pixel-btn-secondary:hover {
  border-color: var(--modo-emerald);
  color: var(--modo-emerald-deep);
  box-shadow: none;
  transform: none;
}

/* Full width */
.pixel-btn-block {
  width: 100%;
}

/* ============================================================
   8. Hero Cards (Three-Module Color System)
   ============================================================ */

.hero-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  gap: var(--space-1);
  padding: var(--space-3) var(--space-3) var(--space-2);
  border-radius: 12px;
  background: var(--bg-secondary);
  border: 3px solid transparent;
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  overflow: hidden;
  aspect-ratio: 1 / 1;
}

.hero-card:hover {
  transform: translateY(-4px);
}

.hero-card .card-illustration {
  position: absolute;
  inset: 0;
  z-index: 0;
}

/* 文字可讀性遮罩：上下淡白，中間留白給插圖 */
.hero-card .card-illustration::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(255,255,255,0.92) 0%,
    rgba(255,255,255,0.80) 26%,
    rgba(255,255,255,0.10) 46%,
    rgba(255,255,255,0.10) 66%,
    rgba(255,255,255,0.85) 92%
  );
  pointer-events: none;
}

.hero-card .card-illustration img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
}

.hero-card .card-icon-bg {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  font-size: 22px;
  margin-bottom: 0;
  position: relative;
  z-index: 1;
}

.hero-card .card-title {
  font: var(--font-h1);
  color: var(--text-heading);
  text-align: left;
  position: relative;
  z-index: 1;
  text-shadow: 0 1px 3px rgba(255,255,255,0.5);
}

.hero-card .card-subtitle {
  font: var(--font-body);
  color: rgba(0,0,0,0.75);
  text-align: left;
  max-width: 100%;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  position: relative;
  z-index: 1;
  text-shadow: 0 1px 2px rgba(255,255,255,0.4);
}

.hero-card .card-action {
  width: 100%;
  position: relative;
  z-index: 1;
  margin-top: auto;
}

/* Emerald Card */
.hero-card.card-emerald {
  background: linear-gradient(135deg, #E8FAF4 0%, #FFFFFF 100%);
  border-color: var(--modo-emerald);
  box-shadow:
    6px 6px 0 rgba(117, 240, 205, 0.15),
    0 0 24px var(--modo-emerald-glow);
}

.hero-card.card-emerald:hover {
  box-shadow:
    6px 6px 0 rgba(117, 240, 205, 0.25),
    0 0 48px var(--modo-emerald-glow);
}

.hero-card.card-emerald .card-icon-bg {
  background: rgba(117, 240, 205, 0.12);
}

/* Coral Card */
.hero-card.card-coral {
  background: linear-gradient(135deg, #FFF0EF 0%, #FFFFFF 100%);
  border-color: var(--cyber-coral);
  box-shadow:
    6px 6px 0 rgba(240, 117, 117, 0.15),
    0 0 24px var(--cyber-coral-glow);
}

.hero-card.card-coral:hover {
  box-shadow:
    6px 6px 0 rgba(240, 117, 117, 0.25),
    0 0 48px var(--cyber-coral-glow);
}

.hero-card.card-coral .card-icon-bg {
  background: rgba(240, 117, 117, 0.12);
}

/* Blue Card */
.hero-card.card-blue {
  background: linear-gradient(135deg, #EEF4FF 0%, #FFFFFF 100%);
  border-color: var(--gallery-blue);
  box-shadow:
    6px 6px 0 rgba(117, 164, 240, 0.15),
    0 0 24px var(--gallery-blue-glow);
}

.hero-card.card-blue:hover {
  box-shadow:
    6px 6px 0 rgba(117, 164, 240, 0.25),
    0 0 48px var(--gallery-blue-glow);
}

.hero-card.card-blue .card-icon-bg {
  background: rgba(117, 164, 240, 0.12);
}

/* Purple Card */
.hero-card.card-purple {
  background: linear-gradient(135deg, #F3EEFF 0%, #FFFFFF 100%);
  border-color: #A78BFA;
  box-shadow: 4px 4px 0 rgba(167, 139, 250, 0.20), 0 4px 16px rgba(0,0,0,0.06);
}
.hero-card.card-purple:hover {
  box-shadow: 6px 6px 0 rgba(167, 139, 250, 0.25), 0 8px 24px rgba(0,0,0,0.08);
}
.pixel-btn-purple {
  background: #A78BFA;
  color: var(--text-primary);
  border: 2px solid #123E35;
  box-shadow: 4px 4px 0 #7C5CDB;
}
.pixel-btn-purple:hover { box-shadow: 2px 2px 0 #7C5CDB; }
.pixel-btn-purple:active { box-shadow: 0 0 0 #7C5CDB; }

/* Amber Card */
.hero-card.card-amber {
  background: linear-gradient(135deg, #FFF6E5 0%, #FFFFFF 100%);
  border-color: #F5AA5C;
  box-shadow: 4px 4px 0 rgba(245, 170, 92, 0.20), 0 4px 16px rgba(0,0,0,0.06);
}
.hero-card.card-amber:hover {
  box-shadow: 6px 6px 0 rgba(245, 170, 92, 0.25), 0 8px 24px rgba(0,0,0,0.08);
}
.pixel-btn-amber {
  background: #F5AA5C;
  color: var(--text-primary);
  border: 2px solid #123E35;
  box-shadow: 4px 4px 0 #C9822E;
}
.pixel-btn-amber:hover { box-shadow: 2px 2px 0 #C9822E; }
.pixel-btn-amber:active { box-shadow: 0 0 0 #C9822E; }

/* Teal Card — AI 電視台 */
.hero-card.card-teal {
  background: linear-gradient(135deg, #E4F6F2 0%, #FFFFFF 100%);
  border-color: #2DD4BF;
  box-shadow: 4px 4px 0 rgba(45, 212, 191, 0.20), 0 4px 16px rgba(0,0,0,0.06);
}
.hero-card.card-teal:hover {
  box-shadow: 6px 6px 0 rgba(45, 212, 191, 0.25), 0 8px 24px rgba(0,0,0,0.08);
}
.pixel-btn-teal {
  background: #2DD4BF;
  color: #04241F;
  border: 2px solid #123E35;
  box-shadow: 4px 4px 0 #12A695;
}
.pixel-btn-teal:hover { box-shadow: 2px 2px 0 #12A695; }
.pixel-btn-teal:active { box-shadow: 0 0 0 #12A695; }

/* Muted / coming-soon Card */
.hero-card.card-muted {
  background: linear-gradient(135deg, #F4F6F8 0%, #FFFFFF 100%);
  border-color: var(--border-pixel);
  border-style: dashed;
  box-shadow: none;
}
.hero-card.card-muted:hover { transform: none; }
.hero-card.card-muted .card-title { color: var(--text-secondary); }
.pixel-btn-muted {
  background: #E8ECF1;
  color: var(--text-muted);
  border: 2px dashed var(--border-pixel);
  box-shadow: none;
}

/* ============================================================
   9. Header Toolbar
   ============================================================ */

.site-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 36px;
  position: relative;
  z-index: 40;
}

.header-left {
  display: flex;
  align-items: center;
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.logo {
  display: inline-flex;
  align-items: flex-start;
  gap: 2px;
  text-decoration: none;
}

.logo-img {
  height: 42px;
  width: auto;
  display: block;
  image-rendering: pixelated;
}

.logo-text {
  font: 800 34px/1 'Rubik', 'ResourceHanRoundedCN', sans-serif;
  color: #3DBFA0;
  letter-spacing: -1px;
  text-shadow:
    3px 3px 0 rgba(61, 191, 160, 0.30),
    2px 2px 0 rgba(61, 191, 160, 0.20),
    1px 1px 0 rgba(61, 191, 160, 0.10),
    -1px -1px 0 rgba(255, 255, 255, 0.80);
}

.logo-sup {
  font: 700 18px/1 'Rubik', 'ResourceHanRoundedCN', sans-serif;
  color: #3B5BDB;
  margin-top: 2px;
}

/* --- Language Toggle (text-link style) --- */
.lang-text-link {
  display: inline-flex; align-items: center; gap: 2px;
  font-size: 13px; font-weight: 500; color: #6B7280;
  background: none; border: none; cursor: pointer; font-family: inherit;
  padding: 4px 6px; text-decoration: none;
}
.lang-text-link .lang-active {
  color: #1F2937; text-decoration: underline;
  text-underline-offset: 3px; font-weight: 600;
}
.lang-text-link .lang-divider { color: #CCC; margin: 0 2px; }

/* --- User Button & Dropdown --- */
.user-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
  background: var(--bg-tertiary);
  border: 2px solid var(--border-subtle);
  border-radius: 0;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-secondary);
  font: var(--font-caption);
  font-weight: 500;
}

.user-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-pixel);
}

.user-btn .user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 0;
  background: var(--modo-emerald);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-dark);
  flex-shrink: 0;
}

.user-dropdown {
  position: absolute;
  top: calc(var(--header-height) - 8px);
  right: var(--space-4);
  min-width: 200px;
  background: var(--bg-secondary);
  border: 3px solid var(--border-pixel);
  border-radius: 8px;
  box-shadow:
    4px 4px 0 rgba(0,0,0,0.4),
    0 8px 32px rgba(0,0,0,0.5);
  overflow: hidden;
  z-index: 100;
  display: none;
  animation: fadeInUp 0.2s ease;
}

.user-dropdown.open {
  display: block;
}

.user-dropdown .dropdown-header {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.user-dropdown .dropdown-name {
  font: var(--font-body);
  font-weight: 600;
  color: var(--text-primary);
}

.user-dropdown .dropdown-role {
  font: var(--font-caption);
  color: var(--text-muted);
}

.user-dropdown .dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  font: var(--font-body);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.user-dropdown .dropdown-item:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.user-dropdown .dropdown-item .item-icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
}

/* ============================================================
   10. Section Headers
   ============================================================ */

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) 0;
}

.section-header .section-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font: var(--font-h2);
  color: var(--text-heading);
}

.section-header .section-title .section-icon {
  font-size: 24px;
}

.section-link {
  font: var(--font-body);
  color: var(--modo-emerald-deep);
  font-weight: 500;
  transition: opacity 0.2s;
}

.section-link:hover {
  opacity: 0.8;
  text-decoration: underline;
}

/* ============================================================
   11. Work Cards (My Works Grid)
   ============================================================ */

.work-card {
  background: var(--bg-secondary);
  border: 3px solid var(--border-pixel);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease;
  display: flex;
  flex-direction: column;
  width: 100%;
  aspect-ratio: 16 / 9;
}

.work-card:hover {
  transform: translateY(-2px);
  border-color: var(--modo-emerald);
}

.work-card .work-thumb {
  flex: 7;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  min-height: 0;
}

.work-card .work-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
  transition: transform 0.3s var(--ease-smooth-out);
}

.work-card:hover .work-thumb img {
  transform: scale(1.05);
}

.work-card .work-info {
  flex: 3;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-height: 0;
}

.work-card .work-title {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
  flex-shrink: 0;
  min-height: 18px;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.work-card .work-time {
  font-size: 11px;
  font-weight: 400;
  line-height: 1.3;
  color: var(--text-muted);
}


/* ============================================================
   12. Bottom Navigation
   ============================================================ */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background: #123E35;
  box-shadow: 0 -4px 0 rgba(18, 62, 53, 0.15);
  display: flex;
  align-items: stretch;
  z-index: 50;
}

.bottom-nav .nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: #CFEDE4;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
  position: relative;
  text-decoration: none;
  border-radius: 12px;
  margin: 8px 4px;
}

.bottom-nav .nav-item:hover {
  color: #FFFFFF;
  background: rgba(255, 255, 255, 0.08);
}

.bottom-nav .nav-item.active {
  background: var(--modo-emerald);
  color: #093027;
  font-weight: 700;
}

.bottom-nav .nav-icon {
  font-size: 27px;
  line-height: 1;
}

.bottom-nav .nav-label {
  font: var(--font-small);
}

/* ============================================================
   13. Floating Pixel Particles
   ============================================================ */

.pixel-particle {
  position: absolute;
  width: 8px;
  height: 8px;
  pointer-events: none;
  z-index: 0;
}

.pixel-particle.emerald {
  background: var(--modo-emerald-deep);
  box-shadow: 0 0 8px var(--modo-emerald-glow), 0 0 16px var(--modo-emerald-glow);
}

.pixel-particle.coral {
  background: var(--cyber-coral-deep);
  box-shadow: 0 0 8px var(--cyber-coral-glow), 0 0 16px var(--cyber-coral-glow);
}

.pixel-particle.blue {
  background: var(--gallery-blue-deep);
  box-shadow: 0 0 8px var(--gallery-blue-glow), 0 0 16px var(--gallery-blue-glow);
}

@keyframes floatParticle {
  0%, 100% { transform: translateY(0) scale(1); opacity: 0.6; }
  50%      { transform: translateY(-20px) scale(1.4); opacity: 1; }
}

/* ============================================================
   14. Works Grid
   ============================================================ */

.works-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-2);
}

/* Add-new-work button (card-style) */
.works-add-row {
  margin-top: var(--space-2);
  display: flex; justify-content: center;
}
.works-add-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px;
  width: 100%; max-width: 320px; aspect-ratio: 16 / 9;
  border: 3px dashed var(--border-pixel); border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  text-decoration: none; font-family: inherit;
  transition: border-color 0.2s, color 0.2s, transform 0.2s;
}
.works-add-btn:hover {
  border-color: var(--modo-emerald);
  color: var(--modo-emerald-deep);
  transform: translateY(-2px);
}
.works-add-btn .add-icon {
  font-size: 40px; font-weight: 300; line-height: 1;
  transition: transform var(--duration-fast) var(--ease-smooth-out);
}
.works-add-btn:hover .add-icon {
  transform: rotate(90deg);
}
.works-add-btn .add-label {
  font-size: 15px; font-weight: 600;
}

/* ============================================================
   15. Page Layout Helpers
   ============================================================ */

.page-wrapper {
  min-height: calc(100vh - var(--tv-bezel) - var(--tv-side));
  display: flex;
  flex-direction: column;
}

.page-content {
  flex: 1;
  padding-bottom: calc(var(--bottom-nav-height) + var(--space-4));
}

.section {
  padding: var(--space-3) 0;
}

/* Spacer for fixed bottom nav */
.bottom-nav-spacer {
  height: var(--bottom-nav-height);
}

/* ============================================================
   15. Animations
   ============================================================ */

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-in-up {
  animation: fadeInUp 0.5s ease forwards;
}

.animate-delay-1 { animation-delay: 0.1s; opacity: 0; }
.animate-delay-2 { animation-delay: 0.2s; opacity: 0; }
.animate-delay-3 { animation-delay: 0.3s; opacity: 0; }
.animate-delay-4 { animation-delay: 0.5s; opacity: 0; }

/* ============================================================
   15b. Transitions.dev — Staggered Reveal + Button Tap
   ============================================================ */

/* --- Chat bubble stagger reveal (texts-reveal pattern) --- */
.t-stagger-line {
  display: block;
  opacity: 0;
  transform: translateY(var(--stagger-distance));
  filter: blur(var(--stagger-blur));
  transition:
    opacity   var(--stagger-dur) var(--stagger-ease),
    transform var(--stagger-dur) var(--stagger-ease),
    filter    var(--stagger-dur) var(--stagger-ease);
  will-change: transform, opacity, filter;
}
.t-stagger-line--2 { transition-delay: calc(var(--stagger-stagger) * 1); }
.t-stagger-line--3 { transition-delay: calc(var(--stagger-stagger) * 2); }
.t-stagger-line--4 { transition-delay: calc(var(--stagger-stagger) * 3); }
.t-stagger-line--5 { transition-delay: calc(var(--stagger-stagger) * 4); }

.t-stagger.is-shown .t-stagger-line,
.t-stagger-line.is-shown {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0);
}

/* --- Generating view entrance --- */
.gen-entrance {
  opacity: 0;
  transform: translateY(var(--distance-base));
  filter: blur(var(--blur-small));
  transition:
    opacity   var(--duration-slow) var(--ease-smooth-out),
    transform var(--duration-slow) var(--ease-smooth-out),
    filter    var(--duration-slow) var(--ease-smooth-out);
}
.gen-entrance.is-shown {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0);
}

/* staggered children inside generating view */
.gen-entrance .gen-child-1 { transition-delay: 0ms; }
.gen-entrance .gen-child-2 { transition-delay: 120ms; }
.gen-entrance .gen-child-3 { transition-delay: 240ms; }

/* --- Button tap bounce (touch-friendly, no hover) --- */
.pixel-btn {
  touch-action: manipulation;
}
.pixel-btn:active {
  transition: transform 0.15s var(--ease-bounce);
}

/* Tap glow pulse */
@keyframes tapGlow {
  0% { box-shadow: 0 0 0 0 currentColor; }
  100% { box-shadow: 0 0 0 8px transparent; }
}
.pixel-btn-primary:active {
  box-shadow: 0 0 0 var(--modo-emerald-dark);
  animation: tapGlow 0.4s ease-out;
}
.pixel-btn-coral:active {
  box-shadow: 0 0 0 var(--cyber-coral-dark);
  animation: tapGlow 0.4s ease-out;
}
.pixel-btn-blue:active {
  box-shadow: 0 0 0 var(--gallery-blue-dark);
  animation: tapGlow 0.4s ease-out;
}

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
  .t-stagger-line { transition: none !important; }
  .gen-entrance { transition: none !important; }
  .pixel-btn:active { transition: none !important; }
}

/* ============================================================
   16. Responsive — Tablet (768px - 1439px)
   ============================================================ */

@media (max-width: 1439px) {
  :root {
    --header-height: 72px;
    --max-width: 960px;
  }

  .hero-card {
    padding: var(--space-2) var(--space-2) var(--space-1);
    gap: 6px;
  }

  .hero-card .card-icon-bg {
    width: 32px;
    height: 32px;
    font-size: 18px;
  }

  .hero-card .card-title {
    font-size: 20px;
  }

  .hero-card .card-subtitle {
    font-size: 13px;
    max-width: 100%;
  }

  .hero-card .card-action .pixel-btn {
    padding: 10px 16px;
    font-size: 14px;
  }

}

/* ============================================================
   17. Responsive — Mobile (375px - 767px)
   ============================================================ */

@media (max-width: 767px) {
  :root {
    --header-height: 64px;
  }

  .container {
    padding: 0 var(--space-2);
  }

  /* Logo */
  .logo-img {
    height: 30px;
  }
  .logo-text {
    font-size: 26px;
  }
  .logo-sup {
    font-size: 16px;
  }

  /* Hero cards stack vertically */
  .hero-card {
    padding: var(--space-3) var(--space-3) var(--space-2);
    gap: var(--space-1);
  }

  .hero-card .card-icon-bg {
    width: 36px;
    height: 36px;
    font-size: 20px;
  }

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

  .hero-card .card-subtitle {
    font-size: 14px;
    max-width: 100%;
  }

  .hero-card .card-action .pixel-btn {
    padding: 12px 20px;
    font-size: 15px;
  }

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

  /* Header toolbar compact */
  .site-header {
    padding: 0 var(--space-2);
  }
  .header-right {
    gap: var(--space-1);
  }
  .user-btn .user-name {
    display: none;
  }
  .user-btn {
    padding: 6px 10px;
  }
  .lang-text-link { font-size: 12px; }
  .theme-toggle {
    width: 34px;
    height: 34px;
    font-size: 17px;
  }
}

/* ============================================================
   18. Page Top Bar (Back + Title)
   ============================================================ */

.page-topbar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  height: 56px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
}

.page-topbar .back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  font-size: 18px;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  border: 2px solid var(--border-subtle);
  border-radius: 0;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.page-topbar .back-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-pixel);
}

.page-topbar .topbar-title {
  font: var(--font-h3);
  color: var(--text-heading);
}

/* ============================================================
   19. Form Inputs
   ============================================================ */

.input-field {
  width: 100%;
  padding: 12px 16px;
  font: var(--font-body);
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-tertiary);
  border: 3px solid var(--border-pixel);
  border-radius: 4px;
  outline: none;
  transition: border-color 0.2s;
}

.input-field::placeholder {
  color: var(--text-muted);
}

.input-field:focus {
  border-color: var(--modo-emerald);
}

.textarea-field {
  width: 100%;
  padding: 14px 16px;
  font: var(--font-body);
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-tertiary);
  border: 3px solid var(--border-pixel);
  border-radius: 4px;
  outline: none;
  resize: vertical;
  min-height: 140px;
  transition: border-color 0.2s;
}

.textarea-field::placeholder {
  color: var(--text-muted);
}

.textarea-field:focus {
  border-color: var(--modo-emerald);
}

/* ============================================================
   20. Chips / Tags
   ============================================================ */

.chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  font: var(--font-caption);
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  border: 2px solid var(--border-subtle);
  border-radius: 0;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
  white-space: nowrap;
}

.chip:hover {
  color: var(--text-primary);
  border-color: var(--border-pixel);
}

.chip.selected {
  color: var(--modo-emerald-deep);
  border-color: var(--modo-emerald);
  background: rgba(117, 240, 205, 0.08);
}

/* ============================================================
   21. Style Cards (for create page)
   ============================================================ */

.style-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2);
  background: var(--bg-tertiary);
  border: 3px solid var(--border-subtle);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  aspect-ratio: 1 / 1;
}

.style-card:hover {
  border-color: var(--border-pixel);
}

.style-card.selected {
  border-color: var(--modo-emerald);
  box-shadow: 0 0 16px var(--modo-emerald-glow);
}

.style-card .style-preview {
  width: 100%;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  background: var(--bg-secondary);
  border-radius: 4px;
}

.style-card .style-label {
  font: var(--font-caption);
  font-weight: 500;
  color: var(--text-secondary);
}

.style-card.selected .style-label {
  color: var(--modo-emerald-deep);
}

/* ============================================================
   22. Avatar Cards (for avatar select page)
   ============================================================ */

.avatar-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3);
  background: var(--bg-secondary);
  border: 3px solid var(--border-pixel);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  width: 220px;
  flex-shrink: 0;
}

.avatar-card:hover {
  transform: translateY(-2px);
}

.avatar-card.selected {
  border-color: var(--cyber-coral);
  box-shadow:
    4px 4px 0 rgba(240, 117, 117, 0.2),
    0 0 24px var(--cyber-coral-glow);
}

.avatar-card .avatar-img {
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border: 2px solid var(--border-subtle);
  font-size: 60px;
}

.avatar-card .avatar-name {
  font: var(--font-h3);
  color: var(--text-primary);
}

.avatar-card .avatar-desc {
  font: var(--font-caption);
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.4;
}

/* ============================================================
   23. Chat Bubbles
   ============================================================ */

.chat-area {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.chat-bubble {
  display: flex;
  gap: var(--space-2);
  max-width: 80%;
  animation: fadeInUp 0.3s ease;
}

.chat-bubble.ai {
  align-self: flex-start;
}

.chat-bubble.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chat-bubble .bubble-avatar {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: var(--bg-tertiary);
  border: 2px solid var(--border-subtle);
}

.chat-bubble .bubble-body {
  padding: 12px 16px;
  font: var(--font-body);
  line-height: 1.5;
}

.chat-bubble.ai .bubble-body {
  background: var(--bg-secondary);
  border: 2px solid var(--border-pixel);
  border-radius: 0 8px 8px 8px;
  color: var(--text-primary);
}

.chat-bubble.user .bubble-body {
  background: var(--cyber-coral);
  color: var(--text-primary);
  border-radius: 8px 0 8px 8px;
}

/* Typing dots */
.typing-dots {
  display: flex;
  gap: 4px;
  padding: 4px 0;
}

.typing-dots span {
  width: 8px;
  height: 8px;
  background: var(--text-muted);
  animation: typingBounce 1.2s ease-in-out infinite;
}

.typing-dots span:nth-child(1) { animation-delay: 0s; }
.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-8px); opacity: 1; }
}

/* ============================================================
   24. Chat Input Bar
   ============================================================ */

.chat-input-bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-subtle);
}

.chat-input-bar .chat-input {
  flex: 1;
  padding: 10px 16px;
  font: var(--font-body);
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-tertiary);
  border: 2px solid var(--border-subtle);
  border-radius: 0;
  outline: none;
}

.chat-input-bar .chat-input:focus {
  border-color: var(--cyber-coral);
}

.chat-input-bar .send-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  font-size: 18px;
  background: var(--cyber-coral);
  color: var(--text-primary);
  border: 2px solid var(--cyber-coral-dark);
  border-radius: 0;
  cursor: pointer;
  box-shadow: 3px 3px 0 var(--cyber-coral-dark);
  transition: all 0.1s;
}

.chat-input-bar .send-btn:hover {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--cyber-coral-dark);
}

/* Suggestion chips row */
.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  background: var(--bg-secondary);
}

/* ============================================================
   25. Progress / Generating Animation
   ============================================================ */

.generating-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-6);
}

.pixel-loader {
  display: flex;
  gap: 6px;
}

.pixel-loader .pixel-block {
  width: 16px;
  height: 16px;
  background: var(--modo-emerald);
  box-shadow: 0 0 8px var(--modo-emerald-glow);
  animation: pixelLoad 1.2s ease-in-out infinite;
}

.pixel-loader .pixel-block:nth-child(1) { animation-delay: 0s; }
.pixel-loader .pixel-block:nth-child(2) { animation-delay: 0.1s; }
.pixel-loader .pixel-block:nth-child(3) { animation-delay: 0.2s; }
.pixel-loader .pixel-block:nth-child(4) { animation-delay: 0.3s; }

@keyframes pixelLoad {
  0%, 100% { transform: scaleY(1); }
  50% { transform: scaleY(2.5); }
}

.progress-bar {
  width: 280px;
  height: 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-pixel);
  overflow: hidden;
}

.progress-bar .progress-fill {
  height: 100%;
  background: var(--modo-emerald);
  box-shadow: 0 0 8px var(--modo-emerald-glow);
  transition: width 0.3s ease;
}

.generating-text {
  font: var(--font-caption);
  color: var(--text-secondary);
  text-align: center;
  min-height: 20px;
}

/* ============================================================
   26. Toast Notification
   ============================================================ */

.toast {
  position: fixed;
  bottom: calc(var(--bottom-nav-height) + 16px);
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 3px solid var(--modo-emerald);
  border-radius: 8px;
  font: var(--font-body);
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  z-index: 200;
  animation: fadeInUp 0.3s ease;
  pointer-events: none;
}

.toast.fade-out {
  opacity: 0;
  transition: opacity 0.3s;
}

/* ============================================================
   27. Modal Overlay
   ============================================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 150;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-box {
  background: var(--bg-secondary);
  border: 3px solid var(--border-pixel);
  border-radius: 12px;
  padding: var(--space-4);
  min-width: 320px;
  max-width: 90vw;
  box-shadow: 8px 8px 0 rgba(0,0,0,0.4);
  animation: fadeInUp 0.3s ease;
}

.modal-box .modal-title {
  font: var(--font-h2);
  color: var(--text-heading);
  margin-bottom: var(--space-2);
}

.modal-box .modal-text {
  font: var(--font-body);
  color: var(--text-secondary);
  margin-bottom: var(--space-3);
}

.modal-box .modal-actions {
  display: flex;
  gap: var(--space-2);
  justify-content: flex-end;
}

/* ============================================================
   28. Result Page Styles
   ============================================================ */

.result-image-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-3);
}

.result-image-frame {
  position: relative;
  width: min(100%, 600px);
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #effbf7;
  border: 4px solid var(--modo-emerald);
  box-shadow:
    6px 6px 0 rgba(117, 240, 205, 0.2),
    0 0 40px var(--modo-emerald-glow);
  transition: aspect-ratio 0.2s ease;
}

.result-image-frame.is-portrait {
  width: min(100%, 270px);
}

.result-image {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  image-rendering: auto;
  transition: opacity 0.28s ease;
}

.result-image-frame.is-loaded .result-image {
  opacity: 1;
}

.result-image-placeholder {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-secondary);
  font: var(--font-body);
  background:
    linear-gradient(90deg, transparent 49%, rgba(117, 240, 205, 0.2) 50%, transparent 51%) 0 0 / 32px 32px,
    linear-gradient(transparent 49%, rgba(117, 240, 205, 0.2) 50%, transparent 51%) 0 0 / 32px 32px,
    #effbf7;
  opacity: 1;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.result-image-placeholder img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  image-rendering: pixelated;
}

.result-image-frame.is-loading .result-image-placeholder img {
  animation: resultImageLoading 0.9s steps(2, end) infinite;
}

.result-image-frame.is-loaded .result-image-placeholder {
  visibility: hidden;
  opacity: 0;
}

@keyframes resultImageLoading {
  50% { transform: translateY(-5px); }
}

.result-image.is-pixel-art {
  image-rendering: pixelated;
}

@media (prefers-reduced-motion: reduce) {
  .result-image-frame,
  .result-image,
  .result-image-placeholder {
    transition: none;
  }

  .result-image-frame.is-loading .result-image-placeholder img {
    animation: none;
  }
}

.info-card {
  background: var(--bg-secondary);
  border: 2px solid var(--border-pixel);
  border-radius: 8px;
  padding: var(--space-2) var(--space-3);
}

.action-btn-row {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.action-btn-row .pixel-btn {
  flex: 1;
  min-width: 120px;
}

/* ============================================================
   29. Login Page Styles
   ============================================================ */

.login-card {
  background: var(--bg-secondary);
  border: 3px solid var(--border-pixel);
  border-radius: 12px;
  padding: var(--space-5);
  width: 100%;
  max-width: 420px;
  box-shadow:
    6px 6px 0 rgba(0,0,0,0.4),
    0 16px 48px rgba(0,0,0,0.5);
}

/* ============================================================
   30. Gallery Grid
   ============================================================ */

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-2);
}

.gallery-card {
  background: var(--bg-secondary);
  border: 2px solid var(--border-pixel);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s;
}

.gallery-card:hover {
  transform: translateY(-2px);
  border-color: var(--gallery-blue);
  box-shadow: 0 0 16px var(--gallery-blue-glow);
}

.gallery-card .gallery-thumb {
  aspect-ratio: 1 / 1;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
}

.gallery-card .gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
}

.gallery-card .gallery-info {
  padding: var(--space-2);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.gallery-card .gallery-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gallery-card .gallery-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

@media (max-width: 1439px) {
  .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 767px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .chat-bubble {
    max-width: 90%;
  }

  .avatar-card {
    width: 180px;
  }
}


/* ============================================================
   MODO TV SHELL — 全站綠色電視外框 + 科技感圖層
   ============================================================ */

:root {
  --tv-shell: #30E8B4;
  --tv-shell-dark: #00A87C;
  --tv-bezel: 34px;
  --tv-side: 12px;
  --tv-radius: 22px;
}

html { background: var(--tv-shell); }

body {
  padding: var(--tv-bezel) var(--tv-side) var(--tv-side);
  background-clip: padding-box;
}

/* 外框本體（固定覆蓋，內容於下方捲動） */
.modo-tv {
  position: fixed; inset: 0; z-index: 9000; pointer-events: none;
  border-style: solid;
  border-color: var(--tv-shell);
  border-width: var(--tv-bezel) var(--tv-side) var(--tv-side);
  border-radius: var(--tv-radius);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.05);
}
/* 螢幕內緣 */
.modo-tv::before {
  content: ''; position: absolute; inset: 0;
  border-radius: 10px;
  box-shadow:
    inset 0 0 0 2px rgba(0,0,0,0.10),
    inset 0 0 0 3px rgba(255,255,255,0.35),
    inset 0 0 60px rgba(0, 201, 148, 0.10);
}
/* 螢幕四角 HUD 角標 */
.modo-tv::after {
  content: ''; position: absolute; inset: 8px;
  border-radius: 4px;
  background:
    linear-gradient(rgba(0,201,148,0.55), rgba(0,201,148,0.55)) top left / 14px 2px no-repeat,
    linear-gradient(rgba(0,201,148,0.55), rgba(0,201,148,0.55)) top left / 2px 14px no-repeat,
    linear-gradient(rgba(0,201,148,0.55), rgba(0,201,148,0.55)) top right / 14px 2px no-repeat,
    linear-gradient(rgba(0,201,148,0.55), rgba(0,201,148,0.55)) top right / 2px 14px no-repeat,
    linear-gradient(rgba(0,201,148,0.55), rgba(0,201,148,0.55)) bottom left / 14px 2px no-repeat,
    linear-gradient(rgba(0,201,148,0.55), rgba(0,201,148,0.55)) bottom left / 2px 14px no-repeat,
    linear-gradient(rgba(0,201,148,0.55), rgba(0,201,148,0.55)) bottom right / 14px 2px no-repeat,
    linear-gradient(rgba(0,201,148,0.55), rgba(0,201,148,0.55)) bottom right / 2px 14px no-repeat;
}

/* 頂部機殼列 */
.modo-tv-bar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--tv-bezel);
  z-index: 9001; pointer-events: none;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px;
  border-radius: var(--tv-radius) var(--tv-radius) 0 0;
  background: var(--tv-shell);
}
.modo-tv-bar .tv-brand {
  display: flex; align-items: center; gap: 8px;
}
.modo-tv-bar .tv-brand img {
  width: 18px; height: 18px; border-radius: 5px; image-rendering: pixelated;
}
.modo-tv-bar .tv-brand span {
  font: 700 11px/1 'Rubik', sans-serif; letter-spacing: 2px; color: #E6FFF7;
}
.modo-tv-bar .tv-status {
  display: flex; align-items: center; gap: 8px;
  font: 600 10px/1 'Rubik', sans-serif; letter-spacing: 1.6px; color: rgba(255,255,255,0.85);
}
.modo-tv-bar .tv-meter {
  display: flex; align-items: flex-end; gap: 2px; height: 11px;
}
.modo-tv-bar .tv-meter i {
  display: block; width: 3px; background: rgba(255,255,255,0.55);
  animation: tvMeter 1.4s ease-in-out infinite;
}
.modo-tv-bar .tv-meter i:nth-child(1) { height: 4px;  animation-delay: 0s; }
.modo-tv-bar .tv-meter i:nth-child(2) { height: 8px;  animation-delay: 0.18s; }
.modo-tv-bar .tv-meter i:nth-child(3) { height: 11px; animation-delay: 0.36s; }
.modo-tv-bar .tv-meter i:nth-child(4) { height: 6px;  animation-delay: 0.54s; }
@keyframes tvMeter {
  0%, 100% { transform: scaleY(0.45); opacity: 0.5; }
  50%      { transform: scaleY(1);    opacity: 1; }
}
.modo-tv-bar .tv-led {
  width: 7px; height: 7px; border-radius: 50%; background: #FFE9A8;
  box-shadow: 0 0 6px rgba(255,233,168,0.9);
  animation: tvLed 2.6s steps(1, end) infinite;
}
@keyframes tvLed {
  0%, 78%  { opacity: 1; }
  80%, 88% { opacity: 0.25; }
  90%, 100%{ opacity: 1; }
}

/* CRT 掃描線紋理 */
.modo-tv-scan {
  position: fixed;
  top: var(--tv-bezel); left: var(--tv-side);
  right: var(--tv-side); bottom: var(--tv-side);
  z-index: 8999; pointer-events: none; overflow: hidden; border-radius: 10px;
  background: repeating-linear-gradient(
    to bottom,
    rgba(15, 42, 35, 0.028) 0 1px,
    transparent 1px 3px
  );
}
/* 開機掃描（載入一次） */
.modo-boot {
  position: fixed; inset: 0; z-index: 9100; pointer-events: none;
  background: var(--tv-shell);
  animation: tvBoot 720ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes tvBoot {
  0%   { clip-path: inset(0 0 0 0); opacity: 1; }
  60%  { clip-path: inset(50% 0 50% 0); opacity: 1; }
  100% { clip-path: inset(50% 0 50% 0); opacity: 0; }
}

/* 底部導航貼合外框 */
.bottom-nav {
  bottom: var(--tv-side);
  left: var(--tv-side);
  right: var(--tv-side);
  border-radius: 0 0 10px 10px;
  z-index: 8990;
}

@media (max-width: 767px) {
  :root { --tv-bezel: 28px; --tv-side: 8px; --tv-radius: 16px; }
  .modo-tv-bar { padding: 0 12px; }
  .modo-tv-bar .tv-status .tv-text { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .modo-tv-bar .tv-meter i,
  .modo-tv-bar .tv-led { animation: none; }
  .modo-boot { display: none; }
}

/* ---- 科技感：標題掃描顯示 ---- */
.tv-decode { position: relative; }
.tv-decode.is-decoding::after {
  content: ''; position: absolute; top: -6%; bottom: -6%; width: 3px;
  background: var(--modo-emerald);
  box-shadow: 0 0 14px rgba(117,240,205,0.85);
  animation: tvDecodeBeam 620ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.tv-decode.is-decoding > .tv-decode-inner {
  animation: tvDecodeWipe 620ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes tvDecodeBeam {
  0%   { left: 0; opacity: 0; }
  12%  { opacity: 1; }
  88%  { opacity: 1; }
  100% { left: 100%; opacity: 0; }
}
@keyframes tvDecodeWipe {
  0%   { clip-path: inset(0 100% 0 0); }
  100% { clip-path: inset(0 0 0 0); }
}

/* ---- 科技感：插圖 hover 掃描光 ---- */
.lp-theme-thumb::before {
  content: ''; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(105deg, transparent 38%, rgba(255,255,255,0.55) 50%, transparent 62%);
  transform: translateX(-120%);
  transition: transform 0.65s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}
.lp-theme-card:hover .lp-theme-thumb::before { transform: translateX(120%); }

@media (prefers-reduced-motion: reduce) {
  .tv-decode.is-decoding::after,
  .tv-decode.is-decoding > .tv-decode-inner { animation: none; }
  .lp-theme-thumb::before { display: none; }
}

/* ---- 像素 icon ---- */
.pix-icon { display: block; image-rendering: pixelated; }
.nav-item .pix-icon { margin: 0 auto; }
.mock-action-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.mock-action-btn .pix-icon { flex-shrink: 0; }

/* ---- 標題不用純黑：改深墨綠 ---- */
:root { --text-heading: #123E35; }
h1, h2, h3, h4,
.text-h1, .text-h2, .text-h3,
.section-title, .card-title, .topbar-title, .modal-title {
  color: var(--text-heading);
}

/* ---- MODO 像素鼠標組 ---- */
html, body {
  cursor: url('../assets/cursor-default.png') 9 10, auto !important;
}
a, button, .chip, .hero-card, .work-card, .gallery-card,
.avatar-card, .style-card, [role="button"], input[type="submit"],
.lp-theme-card, .step-card, .t-acc-head, .lang-text-link, .user-btn, .dropdown-item,
.lp-btn-outline, .lp-btn-fill, .hero-cta-btn, .hero-ghost-cta, .lp-cta-submit,
.mock-action-btn, .lp-feat-card {
  cursor: url('../assets/cursor-hover.png') 13 13, pointer !important;
}
.nav-item, .bottom-nav .nav-item, .back-btn, .section-link, .works-add-btn {
  cursor: url('../assets/cursor-pointer.png') 8 7, pointer !important;
}
a:active, button:active, .chip:active, .hero-card:active, .work-card:active,
.gallery-card:active, .avatar-card:active, .style-card:active,
.lp-theme-card:active, .nav-item:active, .lp-btn-fill:active,
.hero-cta-btn:active, .lp-cta-submit:active {
  cursor: url('../assets/cursor-active.png') 16 16, pointer !important;
}
input[type="text"], input[type="email"], input[type="password"],
input[type="search"], textarea, .input-field, .textarea-field, .chat-input,
.lp-cta-form input, .field-input {
  cursor: url('../assets/cursor-text.png') 16 16, text !important;
}
