* {
  box-sizing: border-box;
}

body {
  font-family: var(--theme-font-family);
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 20% 20%, var(--theme-bg-start), var(--theme-bg-mid) 65%, var(--theme-bg-end) 100%);
  color: var(--theme-text);
  -webkit-font-smoothing: antialiased;
}

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

button,
input {
  font: inherit;
}

.page-shell {
  min-height: 100vh;
  width: min(100%, 480px);
  margin: 0 auto;
  padding: 24px 16px calc(64px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-block {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand-logo {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: rgba(255, 224, 158, 0.08);
  object-fit: cover;
  border: 1px solid rgba(212, 175, 55, 0.5);
  box-shadow: 0 10px 30px rgba(36, 24, 12, 0.45);
}

.brand-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #f9eac8;
}

.brand-desc {
  margin: 0;
  color: var(--theme-text-muted);
  font-size: 13px;
}

.lang-switch {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(212, 175, 55, 0.38);
  background: rgba(26, 19, 12, 0.8);
  color: #f0ddb0;
  cursor: pointer;
}

.theme-switch {
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--theme-ghost-border);
  background: var(--theme-ghost-bg);
  color: var(--theme-ghost-text);
  cursor: pointer;
}

.card {
  flex: 1;
  background: radial-gradient(circle at top, var(--theme-card-start), var(--theme-card-end));
  border-radius: 28px;
  padding: 24px 20px;
  box-shadow: 0 28px 70px rgba(9, 6, 3, 0.72);
  border: 1px solid var(--theme-border);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.page-title {
  margin: 0;
  font-size: 26px;
  color: var(--theme-title);
}

.page-subtitle {
  margin: 0;
  color: var(--theme-text-muted);
  font-size: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 14px;
  color: rgba(235, 214, 176, 0.82);
}

input[type='text'],
input[type='tel'],
input[type='password'] {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid rgba(168, 132, 58, 0.55);
  background: rgba(15, 11, 8, 0.75);
  color: #f7ebd0;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input::placeholder {
  color: rgba(232, 207, 159, 0.45);
}

input:focus {
  outline: none;
  border-color: var(--theme-accent-strong);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.25);
}

.primary-btn {
  width: 100%;
  height: 48px;
  border: none;
  border-radius: 12px;
  background: var(--theme-primary-gradient);
  color: var(--theme-primary-text);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 18px 34px rgba(34, 23, 10, 0.55);
}

.primary-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.ghost-btn {
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--theme-ghost-border);
  background: var(--theme-ghost-bg);
  color: var(--theme-ghost-text);
  padding: 0 16px;
  cursor: pointer;
}

.extra-note {
  font-size: 12px;
  color: rgba(220, 194, 146, 0.7);
  text-align: center;
}

.toast-container {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1000;
}

.toast {
  min-width: 180px;
  padding: 12px 16px;
  background: var(--theme-toast-bg);
  color: var(--theme-toast-text);
  border: 1px solid var(--theme-toast-border);
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4);
}

.loading-mask {
  position: fixed;
  inset: 0;
  background: rgba(17, 17, 17, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.loading-mask.hidden {
  display: none;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 4px solid rgba(248, 226, 181, 0.35);
  border-top-color: #d4af37;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

#csFloatContainer {
  position: fixed;
  right: 16px;
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 100;
}

@media (max-width: 480px) {
  .page-shell {
    padding: 16px 12px calc(56px + env(safe-area-inset-bottom));
    gap: 12px;
  }

  .card {
    border-radius: 22px;
    padding: 20px 16px;
    box-shadow: 0 20px 50px rgba(3, 7, 18, 0.55);
  }

  .brand-logo {
    width: 44px;
    height: 44px;
  }
}

@media (max-width: 360px) {
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .header-actions {
    align-self: flex-end;
  }
}
