* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-text-size-adjust: 100%;
}

html, body {
  width: 100%;
  min-height: 100%;
  background: #000;
  color: #fff;
  font-family: Arial, "Noto Sans TC", sans-serif;
  overflow-x: hidden;
}

.container {
  position: relative;
  width: 100vw;
  min-height: 100vh;
  overflow: hidden;
  background: #000;
}

.lang-box {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top));
  right: 12px;
  z-index: 100;
}

.lang-btn {
  width: auto;
  height: 38px;
  margin: 0;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(18, 5, 30, 0.82);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.lang-list {
  position: absolute;
  top: 44px;
  right: 0;
  min-width: 168px;
  max-height: 280px;
  overflow-y: auto;
  background: #160b25;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.45);
  padding: 6px 0;
}

.lang-item {
  display: block;
  width: 100%;
  margin: 0;
  padding: 10px 14px;
  border: none;
  border-radius: 0;
  background: transparent;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}

.lang-item:hover,
.lang-item.active {
  background: rgba(255, 255, 255, 0.1);
}

body.rtl {
  direction: rtl;
}

body.rtl .lang-box {
  right: auto;
  left: 12px;
}

body.rtl .lang-list {
  right: auto;
  left: 0;
  text-align: right;
}

body.rtl .lang-item {
  text-align: right;
}

body.rtl .code-modal-close {
  right: auto;
  left: 12px;
}

.carousel {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100vh;
  overflow: hidden;
}

.carousel .slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100vh;
  object-fit: cover;
  display: block;
  filter: brightness(0.48);
  opacity: 0;
  transform: scale(1.02);
  transition: opacity 0.8s ease-in-out, transform 2.5s ease;
}

.carousel .slide.active {
  opacity: 1;
  transform: scale(1);
}

.overlay {
  position: absolute;
  z-index: 5;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  padding: 18px 16px;
  padding-bottom: calc(18px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(18, 5, 30, 0.98) 0%, rgba(18, 5, 30, 0.82) 58%, rgba(18, 5, 30, 0) 100%);
}

h1 {
  font-size: 22px;
  line-height: 1.25;
  margin-bottom: 10px;
  font-weight: 700;
}

p {
  font-size: 14px;
  opacity: 0.85;
  margin-bottom: 14px;
}

.phone-row {
  position: relative;
  display: flex;
  gap: 8px;
  width: 100%;
}

.country-box {
  position: relative;
  width: 92px;
  min-width: 92px;
  flex-shrink: 0;
  z-index: 20;
}

#countryInput,
#phone {
  height: 54px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.10);
  color: #fff;
  font-size: 15px;
  outline: none;
  padding: 0 12px;
}

#countryInput {
  width: 100%;
  cursor: pointer;
  text-align: center;
  font-size: 14px;
  padding: 0 8px;
}

#phone {
  flex: 1;
  min-width: 0;
}

#countryInput::placeholder,
#phone::placeholder {
  color: rgba(255,255,255,0.52);
}

.country-list {
  display: none;
  position: absolute;
  left: 0;
  bottom: 62px;
  width: calc(100vw - 32px);
  max-height: 310px;
  overflow-y: auto;
  background: #160b25;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 14px;
  box-shadow: 0 14px 35px rgba(0,0,0,0.45);
  z-index: 99999;
  padding: 6px 0;
}

.country-list.show {
  display: block;
}

.country-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  padding: 9px 13px;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.country-item:active,
.country-item:hover {
  background: rgba(255,255,255,0.10);
}

.country-name {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  padding-right: 12px;
}

.country-code {
  color: rgba(255,255,255,0.72);
  flex-shrink: 0;
}

#error {
  display: block;
  min-height: 18px;
  margin-top: 8px;
  color: #ff5f7a;
  font-size: 13px;
}

button {
  width: 100%;
  height: 52px;
  margin-top: 10px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(90deg, #7c3aed, #8b4de8);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
}

button:active {
  transform: scale(0.98);
}



/* API WAIT BUTTON FIX */
button:disabled {
  opacity: 0.72;
  cursor: not-allowed;
}

.wait-msg {
  color: #f5d76e !important;
}

.success-msg {
  color: #42f58d !important;
}

.hidden {
  display: none !important;
}

.code-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
}

.code-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.code-modal-box {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  padding: 28px 22px 24px;
  border-radius: 20px;
  background: #13091f;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
  text-align: center;
}

.code-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.85);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
}

.code-modal-close:active {
  transform: scale(0.96);
  background: rgba(255, 255, 255, 0.14);
}

.code-title {
  font-size: 26px;
  line-height: 1.3;
  font-weight: 700;
  margin-bottom: 14px;
  color: #fff;
}

.code-desc {
  font-size: 14px;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.72);
  margin-bottom: 28px;
}

.code-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.code-group {
  display: flex;
  align-items: stretch;
  min-width: 0;
  flex: 1;
  max-width: 168px;
  height: 58px;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.03);
}

.code-cell {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
  border-right: 1px solid rgba(255, 255, 255, 0.22);
}

.code-cell:last-child {
  border-right: none;
}

.code-sep {
  flex-shrink: 0;
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  line-height: 1;
  padding: 0 2px;
}

.code-hint {
  margin-top: 18px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.55);
}

@media (max-width: 380px) {
  .code-title {
    font-size: 22px;
  }

  .code-group {
    max-width: 148px;
    height: 52px;
  }

  .code-cell {
    font-size: 20px;
  }

  .code-sep {
    font-size: 24px;
  }
}
