:root {
      --bg-color: #0d0d11;
      --card-bg: rgba(22, 22, 28, 0.7);
      --card-border: rgba(255, 255, 255, 0.08);
      --text-main: #f3f3f6;
      --text-muted: #9e9eb0;
      --accent-color: #5d6bf2;
      --accent-hover: #4a59db;
      --current-color: rgba(255, 255, 255, 0.1);
      --current-color-rgb: 255, 255, 255;
      --current-overlay-color: rgba(13, 13, 17, 0.85);
      --oval-bg-opacity: 0.15;
      --oval-glow-shadow: 0 0 24px rgba(255, 255, 255, 0.15);
      --oval-border-width: 4px;
      --shadow-primary: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    }

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

    body {
      font-family: 'Inter', 'Noto Sans TC', sans-serif;
      background: radial-gradient(circle at 10% 20%, rgba(93, 107, 242, 0.08) 0%, transparent 45%),
                  radial-gradient(circle at 90% 80%, rgba(244, 93, 142, 0.08) 0%, transparent 45%),
                  var(--bg-color);
      background-attachment: fixed;
      color: var(--text-main);
      min-height: 100vh;
      display: flex;
      flex-direction: column;
      align-items: center;
      padding: 2rem 1rem 6rem 1rem;
    }

    header {
      text-align: center;
      margin-bottom: 2.5rem;
      max-width: 800px;
    }

    h1 {
      font-size: 2.2rem;
      font-weight: 700;
      letter-spacing: -0.5px;
      margin-bottom: 0.5rem;
      background: linear-gradient(135deg, #ffffff 0%, #b5b5c9 100%);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
    }

    header p {
      color: var(--text-muted);
      font-size: 0.95rem;
      font-weight: 300;
    }

    main {
      width: 100%;
      max-width: 1100px;
      display: grid;
      grid-template-columns: 1.2fr 1fr;
      gap: 2rem;
      margin-bottom: 2rem;
    }

    @media (max-width: 850px) {
      main {
        grid-template-columns: 1fr;
      }
    }

    /* Glassmorphism Cards */
    .glass-card {
      background: var(--card-bg);
      backdrop-filter: blur(12px) saturate(180%);
      -webkit-backdrop-filter: blur(12px) saturate(180%);
      border: 1px solid var(--card-border);
      border-radius: 20px;
      padding: 2rem;
      box-shadow: var(--shadow-primary);
    }

    /* Camera Feed Area */
    .camera-container {
      position: relative;
      width: 100%;
      aspect-ratio: 4 / 3;
      background-color: #16161c;
      border-radius: 16px;
      overflow: hidden;
      display: flex;
      justify-content: center;
      align-items: center;
      border: 4px solid var(--current-color);
      box-shadow: 0 0 24px rgba(var(--current-color-rgb), 0.15);
      transition: border-color 0.3s ease, box-shadow 0.3s ease;
    }

    #video {
      width: 100%;
      height: 100%;
      object-fit: cover;
      transform: scaleX(-1); /* Mirror camera for natural feel */
    }

    #preview-image {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: none;
    }

    /* Studio Face Outline Placeholder when camera is off */
    .camera-placeholder {
      position: absolute;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 1rem;
      color: var(--text-muted);
      text-align: center;
      padding: 1.5rem;
      z-index: 1;
    }

    .camera-placeholder svg {
      width: 64px;
      height: 64px;
      opacity: 0.4;
      stroke: var(--text-muted);
      stroke-width: 1.5;
      fill: none;
    }

    .placeholder-btn {
      background: rgba(255, 255, 255, 0.08);
      border: 1px solid rgba(255, 255, 255, 0.15);
      color: var(--text-main);
      padding: 0.6rem 1.2rem;
      border-radius: 30px;
      cursor: pointer;
      font-size: 0.85rem;
      transition: all 0.2s ease;
    }

    .placeholder-btn:hover {
      background: rgba(255, 255, 255, 0.15);
    }

    /* Dynamic Oval Overlay */
    .camera-overlay {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: radial-gradient(ellipse 38% 52% at center, transparent 48%, var(--current-overlay-color) 68%);
      pointer-events: none;
      z-index: 2;
      transition: background 0.3s ease;
    }

    /* ponytail: Draping Oval (色彩對比橢圓框) */
    .camera-oval-border {
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      width: 48%;
      height: 68%;
      border: var(--oval-border-width, 0px) solid var(--current-color);
      background-color: rgba(var(--current-color-rgb), var(--oval-bg-opacity, 0));
      border-radius: 50%;
      box-shadow: var(--oval-glow-shadow, none);
      pointer-events: none;
      z-index: 3;
      transition: border-color 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
    }

    .camera-controls {
      position: absolute;
      bottom: 1rem;
      left: 1rem;
      z-index: 4;
      display: flex;
      gap: 0.5rem;
    }

    .control-icon-btn {
      background: rgba(13, 13, 17, 0.7);
      backdrop-filter: blur(8px);
      border: 1px solid rgba(255, 255, 255, 0.1);
      width: 38px;
      height: 38px;
      border-radius: 50%;
      display: flex;
      justify-content: center;
      align-items: center;
      cursor: pointer;
      color: var(--text-main);
      transition: all 0.2s;
    }

    .control-icon-btn:hover {
      background: rgba(13, 13, 17, 0.95);
      border-color: rgba(255, 255, 255, 0.25);
    }

    /* Interactive Swatches & Flow Controls */
    .flow-card {
      display: flex;
      flex-direction: column;
      justify-content: space-between;
    }

    .stepper {
      display: flex;
      justify-content: space-between;
      margin-bottom: 1.5rem;
      position: relative;
    }

    .stepper::before {
      content: '';
      position: absolute;
      top: 50%;
      left: 0;
      width: 100%;
      height: 2px;
      background: rgba(255, 255, 255, 0.05);
      z-index: 1;
      transform: translateY(-50%);
    }

    .step-node {
      width: 32px;
      height: 32px;
      border-radius: 50%;
      background: #1c1c24;
      border: 2px solid rgba(255, 255, 255, 0.1);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 0.85rem;
      font-weight: 600;
      color: var(--text-muted);
      position: relative;
      z-index: 2;
      transition: all 0.3s;
    }

    .step-node.active {
      background: var(--accent-color);
      border-color: var(--accent-color);
      color: #ffffff;
      box-shadow: 0 0 12px rgba(93, 107, 242, 0.4);
    }

    .step-node.completed {
      background: #34c759;
      border-color: #34c759;
      color: #ffffff;
    }

    .round-content {
      margin-bottom: 2rem;
      opacity: 1;
      transition: opacity 0.25s ease;
    }

    .round-title {
      font-size: 1.4rem;
      font-weight: 600;
      margin-bottom: 0.5rem;
    }

    .round-desc {
      color: var(--text-muted);
      font-size: 0.88rem;
      line-height: 1.5;
      margin-bottom: 1.5rem;
    }

    .options-grid {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 1rem;
    }

    /* Oval Color Options */
    .color-swatch-btn {
      background: rgba(255, 255, 255, 0.02);
      border: 1px solid rgba(255, 255, 255, 0.08);
      border-radius: 16px;
      padding: 1.2rem 0.8rem;
      cursor: pointer;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 0.8rem;
      transition: all 0.25s ease;
    }

    .color-swatch-btn:hover {
      background: rgba(255, 255, 255, 0.05);
      border-color: rgba(255, 255, 255, 0.2);
      transform: translateY(-3px);
    }

    .color-swatch-btn.selected {
      background: rgba(93, 107, 242, 0.1);
      border-color: var(--accent-color);
      box-shadow: 0 0 16px rgba(93, 107, 242, 0.15);
    }

    .swatch-color-preview {
      width: 50px;
      height: 70px;
      border-radius: 50%; /* Oval Swatch Shape */
      box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
      border: 2px solid rgba(255, 255, 255, 0.15);
      transition: transform 0.2s;
    }

    .color-swatch-btn:hover .swatch-color-preview {
      transform: scale(1.08);
    }

    .swatch-name {
      font-size: 0.85rem;
      font-weight: 500;
      text-align: center;
      color: var(--text-main);
    }

    .action-btn {
      width: 100%;
      background: var(--accent-color);
      color: #ffffff;
      border: none;
      padding: 1rem;
      border-radius: 12px;
      font-size: 1rem;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.2s;
      display: flex;
      justify-content: center;
      align-items: center;
      gap: 0.5rem;
    }

    .action-btn:hover {
      background: var(--accent-hover);
    }

    .action-btn:disabled {
      background: #2a2a35;
      color: var(--text-muted);
      cursor: not-allowed;
      border: 1px solid rgba(255, 255, 255, 0.03);
    }

    /* Result Section */
    .result-card {
      display: none;
      opacity: 0;
      transition: opacity 0.4s ease;
    }

    .result-header {
      display: flex;
      align-items: center;
      gap: 1rem;
      margin-bottom: 1rem;
    }

    .result-badge {
      background: rgba(93, 107, 242, 0.15);
      border: 1px solid var(--accent-color);
      color: #7b88ff;
      padding: 0.3rem 0.8rem;
      border-radius: 20px;
      font-size: 0.8rem;
      font-weight: 600;
      letter-spacing: 0.5px;
    }

    .result-title {
      font-size: 1.8rem;
      font-weight: 700;
      background: linear-gradient(135deg, #ffffff 0%, #a2b0ff 100%);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      margin-bottom: 0.2rem;
    }

    .result-desc {
      color: var(--text-muted);
      font-size: 0.9rem;
      line-height: 1.6;
      margin-bottom: 1.5rem;
    }

    .palette-section-title {
      font-size: 1rem;
      font-weight: 600;
      margin-bottom: 0.8rem;
      color: var(--text-main);
      border-left: 3px solid var(--accent-color);
      padding-left: 0.5rem;
    }

    .result-palettes-grid {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 1.2rem;
      margin-bottom: 1.5rem;
    }

    @media (max-width: 450px) {
      .result-palettes-grid {
        grid-template-columns: 1fr;
      }
    }

    .palette-list {
      background: rgba(255, 255, 255, 0.02);
      border: 1px solid rgba(255, 255, 255, 0.05);
      border-radius: 12px;
      padding: 1rem;
    }

    .palette-header {
      font-size: 0.85rem;
      color: var(--text-muted);
      margin-bottom: 0.8rem;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }

    .color-palette-bar {
      display: flex;
      height: 48px;
      border-radius: 8px;
      overflow: hidden;
      margin-bottom: 0.8rem;
      border: 1px solid rgba(0, 0, 0, 0.2);
    }

    .palette-bar-color {
      flex: 1;
      height: 100%;
      cursor: pointer;
      position: relative;
      transition: transform 0.2s;
    }

    .palette-bar-color:hover {
      transform: scaleY(1.1);
      z-index: 10;
    }

    .palette-grid-items {
      display: flex;
      flex-direction: column;
      gap: 0.4rem;
    }

    .palette-item {
      display: flex;
      align-items: center;
      gap: 0.6rem;
      font-size: 0.78rem;
      cursor: pointer;
      padding: 0.2rem;
      border-radius: 4px;
      transition: background 0.15s;
    }

    .palette-item:hover {
      background: rgba(255, 255, 255, 0.05);
    }

    .palette-item-dot {
      width: 14px;
      height: 14px;
      border-radius: 50%;
      border: 1px solid rgba(255, 255, 255, 0.1);
    }

    .palette-item-name {
      color: var(--text-muted);
      flex: 1;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .palette-item-hex {
      font-family: monospace;
      color: var(--text-main);
    }

    /* Clipboard Toast notification */
    .toast {
      position: fixed;
      bottom: 2rem;
      background: rgba(13, 13, 17, 0.95);
      border: 1px solid var(--accent-color);
      box-shadow: var(--shadow-primary);
      color: #ffffff;
      padding: 0.8rem 1.5rem;
      border-radius: 30px;
      font-size: 0.88rem;
      font-weight: 500;
      opacity: 0;
      pointer-events: none;
      transform: translateY(10px);
      transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
      z-index: 9999;
    }

    .toast.show {
      opacity: 1;
      transform: translateY(0);
    }

    .hidden {
      display: none !important;
    }

    /* Method Selector Cards on Home Page */
    .method-card {
      background: rgba(255, 255, 255, 0.03);
      border: 1px solid rgba(255, 255, 255, 0.08);
      border-radius: 16px;
      padding: 1.2rem;
      cursor: pointer;
      transition: all 0.3s ease;
      display: flex;
      flex-direction: column;
      gap: 0.4rem;
      text-align: left;
    }

    .method-card:hover {
      background: rgba(255, 255, 255, 0.07);
      border-color: var(--accent-color);
      transform: translateY(-2px);
      box-shadow: 0 4px 20px rgba(93, 107, 242, 0.15);
    }

    .method-name {
      font-size: 1.1rem;
      font-weight: 600;
      color: #ffffff;
      display: flex;
      align-items: center;
      justify-content: space-between;
    }

    .method-desc {
      font-size: 0.82rem;
      color: var(--text-muted);
      line-height: 1.4;
    }

    /* Floating Visual Settings Controls */
    .settings-toggle-btn {
      position: absolute;
      top: 1rem;
      right: 1rem;
      background: rgba(22, 22, 28, 0.6);
      border: 1px solid rgba(255, 255, 255, 0.15);
      border-radius: 50%;
      width: 40px;
      height: 40px;
      display: flex;
      align-items: center;
      justify-content: center;
      color: #ffffff;
      cursor: pointer;
      z-index: 10;
      transition: all 0.3s ease;
      backdrop-filter: blur(10px);
    }
    .settings-toggle-btn:hover {
      background: var(--accent-color);
      border-color: transparent;
    }
    
    .visual-settings-panel {
      position: absolute;
      top: 4.5rem;
      right: 1rem;
      background: rgba(13, 13, 17, 0.9);
      border: 1px solid rgba(255, 255, 255, 0.1);
      border-radius: 16px;
      padding: 1.2rem;
      width: 260px;
      display: flex;
      flex-direction: column;
      gap: 1rem;
      z-index: 10;
      backdrop-filter: blur(12px);
      box-shadow: var(--shadow-primary);
      transition: opacity 0.3s ease, transform 0.3s ease;
      text-align: left;
    }
    .visual-settings-panel.hidden {
      display: none !important;
    }
    .setting-row {
      display: flex;
      flex-direction: column;
      gap: 0.4rem;
    }
    .setting-label {
      font-size: 0.8rem;
      font-weight: 500;
      color: var(--text-muted);
      display: flex;
      justify-content: space-between;
    }
    .setting-control {
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid rgba(255, 255, 255, 0.1);
      border-radius: 8px;
      color: #ffffff;
      padding: 0.4rem;
      font-size: 0.85rem;
      outline: none;
    }
    .setting-slider {
      -webkit-appearance: none;
      width: 100%;
      height: 4px;
      border-radius: 2px;
      background: rgba(255, 255, 255, 0.1);
      outline: none;
      margin: 8px 0;
    }
    .setting-slider::-webkit-slider-thumb {
      -webkit-appearance: none;
      appearance: none;
      width: 16px;
      height: 16px;
      border-radius: 50%;
      background: var(--accent-color);
      cursor: pointer;
      transition: transform 0.1s ease;
    }
    .setting-slider::-webkit-slider-thumb:hover {
      transform: scale(1.2);
    }
    
    .setting-checkbox-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      font-size: 0.8rem;
      color: var(--text-muted);
    }
    
    .setting-checkbox {
      accent-color: var(--accent-color);
      cursor: pointer;
      width: 16px;
      height: 16px;
    }

    /* Fixed Ad Banner */
    .fixed-ad-banner {
      position: fixed;
      left: 0;
      right: 0;
      bottom: 0;
      z-index: 100;
      background: rgba(22, 22, 28, 0.85);
      backdrop-filter: blur(12px);
      border-top: 1px solid rgba(255, 255, 255, 0.1);
      color: var(--text-muted);
      text-align: center;
      padding: 0.8rem;
      font-size: 0.8rem;
      font-weight: 300;
      letter-spacing: 0.05em;
      box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.3);
    }
    .interstitial-overlay {
      position: fixed;
      inset: 0;
      z-index: 1000;
      background: rgba(13, 13, 17, 0.85);
      backdrop-filter: blur(16px);
      display: flex;
      align-items: center;
      justify-content: center;
    }
    .interstitial-overlay.hidden {
      display: none !important;
    }
    .ad-card {
      background: rgba(22, 22, 28, 0.95);
      border: 1px solid rgba(255, 255, 255, 0.15);
      border-radius: 24px;
      padding: 2.2rem;
      text-align: center;
      max-width: 380px;
      width: 90%;
      box-shadow: var(--shadow-primary);
    }
    .ad-card h3 {
      font-size: 1.2rem;
      font-weight: 600;
      color: #ffffff;
      margin-bottom: 1rem;
    }
    .ad-placeholder-box {
      border: 2px dashed rgba(255, 255, 255, 0.15);
      background: rgba(255, 255, 255, 0.03);
      color: var(--text-muted);
      border-radius: 16px;
      padding: 2rem 1.2rem;
      margin-bottom: 1.5rem;
      font-size: 0.85rem;
      line-height: 1.5;
    }

    .inline-color-dot {
      display: inline-block;
      width: 12px;
      height: 12px;
      border-radius: 3px;
      margin-left: 4px;
      margin-right: 4px;
      vertical-align: middle;
      border: 1px solid rgba(255, 255, 255, 0.2);
      box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
    }

    /* Mobile Responsive Optimizations */
    @media (max-width: 480px) {
      body {
        padding: 1rem 0.5rem 6.5rem 0.5rem;
      }
      .glass-card {
        padding: 1.2rem;
        border-radius: 16px;
      }
      .options-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.8rem;
      }
      #best-colors-container {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 0.6rem !important;
      }
      .visual-settings-panel {
        width: 220px;
        padding: 0.8rem;
      }
      h1 {
        font-size: 1.8rem;
      }
      h2 {
        font-size: 1.15rem;
      }
    }

    /* Palette draping: full-season stripes around the oval (色票披掛比對) */
    .palette-drape {
      position: absolute;
      inset: 0;
      z-index: 2;
      pointer-events: none;
      -webkit-mask: radial-gradient(ellipse 25% 35% at center, transparent 97%, #000 100%);
      mask: radial-gradient(ellipse 25% 35% at center, transparent 97%, #000 100%);
    }
    /* ===== Article / content pages (color-theory.html, seasons-guide.html) ===== */
    .article-wrap {
      max-width: 780px;
      margin: 0 auto;
      padding: 0 1.2rem 4rem 1.2rem;
    }
    .article-wrap .glass-card {
      margin-bottom: 1.5rem;
    }
    .article-wrap h2 {
      font-size: 1.25rem;
      margin-bottom: 0.8rem;
    }
    .article-wrap h3 {
      font-size: 1.05rem;
      margin: 1.2rem 0 0.5rem 0;
      color: var(--text-main);
    }
    .article-wrap p, .article-wrap li {
      color: var(--text-muted);
      font-size: 0.92rem;
      line-height: 1.9;
      margin-bottom: 0.8rem;
    }
    .article-wrap ul {
      padding-left: 1.2rem;
      margin-bottom: 0.8rem;
    }
    .swatch-row {
      display: flex;
      flex-wrap: wrap;
      gap: 0.6rem;
      margin: 0.6rem 0 0.4rem 0;
    }
    .swatch-chip {
      display: inline-flex;
      align-items: center;
      gap: 0.45rem;
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid var(--card-border);
      border-radius: 999px;
      padding: 0.3rem 0.75rem;
      font-size: 0.82rem;
      color: var(--text-muted);
    }
    .swatch-chip .dot {
      width: 14px;
      height: 14px;
      border-radius: 50%;
      border: 1px solid rgba(255, 255, 255, 0.25);
      flex-shrink: 0;
    }
    .article-nav {
      text-align: center;
      margin: 2rem 0 0 0;
    }
    .article-nav a, .site-footer a {
      color: var(--accent-color);
      text-decoration: none;
    }
    .article-nav a:hover, .site-footer a:hover {
      text-decoration: underline;
    }
    .site-footer {
      text-align: center;
      padding: 2rem 1rem 5rem 1rem;
      font-size: 0.85rem;
      color: var(--text-muted);
    }
    .site-footer .sep {
      margin: 0 0.6rem;
      opacity: 0.4;
    }
    .lang-switch {
      position: absolute;
      top: 1rem;
      right: 1rem;
      display: flex;
      gap: 0.5rem;
      z-index: 1000;
    }
    .lang-switch button {
      background: rgba(255, 255, 255, 0.08);
      color: var(--text-muted);
      border: 1px solid rgba(255, 255, 255, 0.1);
      padding: 0.4rem 0.8rem;
      border-radius: 20px;
      font-size: 0.8rem;
      cursor: pointer;
      transition: all 0.2s;
    }
    .lang-switch button.active {
      background: var(--accent-color);
      color: #ffffff;
      border-color: transparent;
    }