/* ==========================================================================
   CNC STUDIO R27 — GLOBAL I18N & MULTILINGUAL SWITCHER STYLES (v1.0.0)
   Covers Landing Page, Auth Modal, Boot Overlay & 3D Studio Header
   ========================================================================== */

:root[lang="ja"],
:root[lang="zh-CN"],
:root[lang="ko"] {
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Hiragino Kaku Gothic ProN', 'Yu Gothic UI', 'Meiryo', 'Noto Sans JP', 'PingFang SC', 'Microsoft YaHei', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  --lp-font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Hiragino Kaku Gothic ProN', 'Yu Gothic UI', 'Meiryo', 'Noto Sans JP', 'PingFang SC', 'Microsoft YaHei', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  --lp-font-heading: 'Outfit', 'Hiragino Kaku Gothic ProN', 'Yu Gothic UI', 'Noto Sans JP', 'PingFang SC', 'Malgun Gothic', sans-serif;
}

.cnc-lang-picker {
  position: relative;
  display: inline-flex;
  align-items: center;
  z-index: 40;
  flex-shrink: 0;
}

.cnc-lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(15, 23, 42, 0.72);
  color: #e2e8f0;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.12s ease;
  white-space: nowrap;
}

.cnc-lang-btn:hover {
  border-color: rgba(16, 185, 129, 0.55);
  background: rgba(15, 23, 42, 0.92);
}

.cnc-lang-btn:active {
  transform: scale(0.96);
}

/* Adapt inside Light Theme Studio Header */
:root:not([data-theme="dark"]) #cnc-r27 .cnc-lang-btn {
  background: rgba(255, 255, 255, 0.88);
  color: #16333f;
  border-color: rgba(22, 51, 63, 0.18);
}

:root:not([data-theme="dark"]) #cnc-r27 .cnc-lang-btn:hover {
  border-color: rgba(20, 125, 129, 0.55);
  background: #ffffff;
}

:root:not([data-theme="dark"]) #cnc-r27 .cnc-lang-menu {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(22, 51, 63, 0.16);
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.16);
}

:root:not([data-theme="dark"]) #cnc-r27 .cnc-lang-option {
  color: #16333f;
}

:root:not([data-theme="dark"]) #cnc-r27 .cnc-lang-option:hover,
:root:not([data-theme="dark"]) #cnc-r27 .cnc-lang-option[aria-selected="true"] {
  background: rgba(20, 125, 129, 0.1);
  color: #0e6064;
}

/* Adapt inside Auth Modal */
#ui-auth-dialog .cnc-lang-picker-auth {
  margin-right: 6px;
}

#ui-auth-dialog .cnc-lang-btn {
  height: 32px;
  padding: 0 9px;
  font-size: 11.5px;
  background: rgba(15, 23, 42, 0.06);
  color: #1e293b;
  border-color: rgba(15, 23, 42, 0.14);
}

[data-theme="dark"] #ui-auth-dialog .cnc-lang-btn {
  background: rgba(30, 41, 59, 0.72);
  color: #e2e8f0;
  border-color: rgba(148, 163, 184, 0.25);
}

:root:not([data-theme="dark"]) #ui-auth-dialog .cnc-lang-menu {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.14);
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.18);
}

:root:not([data-theme="dark"]) #ui-auth-dialog .cnc-lang-option {
  color: #1e293b;
}

:root:not([data-theme="dark"]) #ui-auth-dialog .cnc-lang-option:hover,
:root:not([data-theme="dark"]) #ui-auth-dialog .cnc-lang-option[aria-selected="true"] {
  background: rgba(16, 185, 129, 0.12);
  color: #047857;
}

.cnc-lang-flag {
  font-size: 14px;
  line-height: 1;
}

.cnc-lang-code {
  font-weight: 700;
  letter-spacing: 0.02em;
}

.cnc-lang-caret {
  width: 11px;
  height: 11px;
  opacity: 0.72;
}

.cnc-lang-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 196px;
  max-height: min(62vh, 360px);
  overflow-y: auto;
  padding: 6px;
  border-radius: 12px;
  background: rgba(11, 22, 34, 0.98);
  border: 1px solid rgba(56, 189, 248, 0.26);
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  display: grid;
  gap: 3px;
  z-index: 9999;
}

.cnc-lang-menu[hidden] {
  display: none !important;
}

.cnc-lang-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #e2e8f0;
  font-size: 12.5px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
}

.cnc-lang-option:hover {
  background: rgba(56, 189, 248, 0.14);
  color: #ffffff;
}

.cnc-lang-option[aria-selected="true"] {
  background: rgba(16, 185, 129, 0.18);
  color: #6ee7b7;
}

.cnc-lang-option-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.cnc-lang-option-tag {
  font-size: 10px;
  opacity: 0.65;
  text-transform: uppercase;
}

/* International Country Dial Selector inside WhatsApp Auth Field */
.auth-phone-row {
  display: grid;
  grid-template-columns: 94px minmax(0, 1fr);
  gap: 6px;
  align-items: stretch;
}

.auth-ddi-select {
  height: 100%;
  min-height: 40px;
  padding: 0 6px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: #f8fafc;
  color: #0f172a;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

[data-theme="dark"] .auth-ddi-select {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(15, 23, 42, 0.85);
  color: #f8fafc;
}

.auth-ddi-select:focus {
  outline: none;
  border-color: #10b981;
}

.auth-phone-row .auth-input-wrapper {
  min-width: 0;
}

/* Studio Boot Progress Bar */
.cnc-boot-progress-wrap {
  width: min(320px, 82vw);
  height: 6px;
  margin: 12px auto 6px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.25);
  overflow: hidden;
}

.cnc-boot-progress-bar {
  width: 8%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #0ea5e9, #10b981);
  transition: width 0.22s ease;
}

.cnc-boot-actions {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
}

.cnc-boot-actions a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 6px 14px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  text-decoration: none;
  font-weight: 700;
  font-size: 13px;
}

@media (max-width: 640px) {
  .lp-navbar .cnc-lang-btn {
    height: 36px;
    padding: 0 8px;
    font-size: 11.5px;
  }
  #cnc-r27 .cnc-lang-btn {
    height: 34px;
    padding: 0 8px;
  }
  .cnc-lang-menu {
    right: 0;
    left: auto;
    min-width: 184px;
  }
  .auth-phone-row {
    grid-template-columns: 96px minmax(0, 1fr);
  }
}
