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

:root {
  --bg: #0f172a;
  --card: #1e293b;
  --card-border: #334155;
  --text: #f8fafc;
  --text-dim: #94a3b8;
  --text-soft: #cbd5e1;
  --primary: #0284c7;
  --primary-hover: #0369a1;
  --primary-glow: rgba(2, 132, 199, 0.35);
  --danger: #ef4444;
  --danger-dark: #450a0a;
  --danger-border: #b91c1c;
  --danger-soft: #fca5a5;
  --success: #4ade80;
  --accent: #38bdf8;
  --input-bg: #0f172a;
  --input-border: #475569;
  --radius: 14px;
  --shadow: 0 8px 32px rgba(0,0,0,0.45);
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: stretch;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ===== APP SHELL ===== */
.app {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 0 16px 16px;
}

/* ===== TOP BAR ===== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0 10px;
  gap: 10px;
  flex-shrink: 0;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.3px;
  min-width: 0;
}

.brand-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  color: var(--accent);
}

.brand-logo {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  object-fit: contain;
  border-radius: 6px;
}

.topbar-brand span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lang-switch {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.lang-icon {
  width: 18px;
  height: 18px;
  color: var(--text-dim);
  flex-shrink: 0;
}

.lang-switch select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%2394a3b8' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E") no-repeat right 8px center;
  color: var(--text);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 6px 26px 6px 10px;
  font-size: 0.8rem;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s;
}

.lang-switch select:focus {
  border-color: var(--accent);
}

/* ===== MAIN ===== */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 8px 0 16px;
}

/* ===== CARD ===== */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 28px 22px 24px;
  text-align: center;
  box-shadow: var(--shadow);
  animation: fadeUp 0.35s ease both;
}

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

.hidden { display: none !important; }

.card-header {
  display: flex;
  justify-content: center;
  margin-bottom: 14px;
}

.icon-circle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(2, 132, 199, 0.12);
  border: 2px solid rgba(56, 189, 248, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.icon-circle svg {
  width: 26px;
  height: 26px;
}

.icon-circle.success {
  background: rgba(74, 222, 128, 0.1);
  border-color: rgba(74, 222, 128, 0.35);
  color: var(--success);
}

.logo-main {
  display: flex;
  justify-content: center;
  align-items: center;
}

.logo-img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.card h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 10px;
  letter-spacing: 0.3px;
}

.card .desc {
  font-size: 0.88rem;
  color: var(--text-dim);
  line-height: 1.55;
  margin-bottom: 20px;
}

/* ===== INPUT ===== */
.input-wrap {
  position: relative;
  margin-bottom: 14px;
}

.input-wrap input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1.5px solid var(--input-border);
  background: var(--input-bg);
  color: var(--text);
  font-size: 1.15rem;
  text-align: center;
  letter-spacing: 3px;
  outline: none;
  transition: border-color 0.25s, box-shadow 0.25s;
  -webkit-appearance: none;
}

.input-wrap input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.input-wrap input::placeholder {
  color: #475569;
  letter-spacing: 1px;
  font-size: 0.95rem;
}

/* ===== BUTTONS ===== */
.btn {
  width: 100%;
  padding: 14px 18px;
  border: none;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, #0284c7, #0ea5e9);
  color: #fff;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #0369a1, #0284c7);
}

.btn-danger {
  background: linear-gradient(135deg, #dc2626, #ef4444);
  color: #fff;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35);
}

.btn-danger:hover {
  background: linear-gradient(135deg, #b91c1c, #dc2626);
}

.btn-row {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.btn-row .btn {
  flex: 1;
}

.btn-outline {
  background: transparent;
  color: var(--danger);
  border: 1.5px solid var(--danger);
  box-shadow: none;
}

.btn-outline:hover {
  background: rgba(239, 68, 68, 0.1);
}

/* ===== STATUS MESSAGE ===== */
.status-msg {
  font-size: 0.84rem;
  color: var(--danger);
  margin-bottom: 12px;
  animation: shake 0.4s ease;
}

.status-msg.info {
  color: var(--text-dim);
  animation: none;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* ===== ALERT BOX ===== */
.alert-box {
  background: var(--danger-dark);
  border: 1px solid var(--danger-border);
  border-radius: 12px;
  padding: 18px 16px;
  text-align: left;
  margin-bottom: 18px;
}

.alert-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 8px;
}

.alert-icon svg {
  width: 32px;
  height: 32px;
  color: var(--danger);
}

.alert-title {
  color: var(--danger-soft);
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 12px;
  text-align: center;
}

.alert-list {
  list-style: none;
  font-size: 0.82rem;
  color: var(--text-soft);
  line-height: 1.7;
  word-break: break-word;
}

.alert-list li {
  padding: 3px 0;
  border-bottom: 1px solid rgba(185, 28, 28, 0.25);
}

.alert-list li:last-child {
  border-bottom: none;
}

.alert-list b {
  color: var(--text);
  font-weight: 600;
}

.alert-list .session-line {
  padding: 2px 0;
  border-bottom: 1px solid rgba(185, 28, 28, 0.25);
  overflow: hidden;
}

.alert-list .session-line em {
  font-style: italic;
  font-size: 0.72rem;
  color: rgba(252, 165, 165, 0.45);
  letter-spacing: 0.5px;
  word-break: break-all;
  line-height: 1.5;
  user-select: none;
}

/* ===== SHOCK TEXT ===== */
.shock-text {
  color: var(--text-soft);
  font-size: 0.88rem;
  line-height: 1.6;
}

.shock-text b {
  color: var(--danger-soft);
}

/* ===== SUCCESS ===== */
.success-text {
  color: var(--success) !important;
}

/* ===== FOOTER / DOTS ===== */
.footer {
  flex-shrink: 0;
  padding: 10px 0 6px;
  display: flex;
  justify-content: center;
}

.footer-dots {
  display: flex;
  gap: 8px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--card-border);
  transition: background 0.3s, transform 0.3s;
}

.dot.active {
  background: var(--accent);
  transform: scale(1.25);
}

/* ============================================================
   RESPONSIVE BREAKPOINTS
   ============================================================ */

/* Large phones */
@media (max-width: 400px) {
  .app { padding: 0 12px 12px; }
  .card { padding: 22px 16px 20px; }
  .card h2 { font-size: 1.05rem; }
  .btn { padding: 13px 14px; font-size: 0.88rem; }
  .topbar-brand span { font-size: 0.82rem; }
}

/* Very small screens (smartwatch, tiny phones) */
@media (max-width: 320px) {
  html { font-size: 14px; }
  .app { padding: 0 8px 8px; }
  .topbar { padding: 10px 0 8px; flex-wrap: wrap; justify-content: center; }
  .lang-switch label { display: none; }
  .card { padding: 18px 12px 16px; border-radius: 12px; }
  .card h2 { font-size: 0.98rem; }
  .card .desc { font-size: 0.82rem; margin-bottom: 14px; }
  .input-wrap input {
    padding: 12px 10px;
    font-size: 1rem;
    letter-spacing: 2px;
  }
  .btn { padding: 12px 10px; font-size: 0.82rem; }
  .btn-row { flex-direction: column; gap: 8px; }
  .logo-img { width: 60px; height: 60px; border-radius: 12px; }
  .icon-circle { width: 44px; height: 44px; }
  .icon-circle svg { width: 20px; height: 20px; }
  .alert-box { padding: 14px 12px; }
  .alert-list { font-size: 0.75rem; }
  .brand-icon { width: 18px; height: 18px; }
}

/* Extra-small (Apple Watch ~ 396px, but very narrow usable area) */
@media (max-width: 200px) {
  html { font-size: 12px; }
  .topbar-brand span { display: none; }
  .lang-switch select { font-size: 0.7rem; padding: 4px 22px 4px 6px; }
  .card { padding: 14px 8px 12px; }
  .card h2 { font-size: 0.88rem; }
  .desc { font-size: 0.75rem; }
  .input-wrap input {
    padding: 10px 6px;
    font-size: 0.95rem;
    letter-spacing: 1px;
  }
  .btn { padding: 10px 8px; font-size: 0.75rem; }
  .btn-row { flex-direction: column; gap: 6px; margin-top: 10px; }
  .logo-img { width: 48px; height: 48px; border-radius: 10px; }
  .brand-logo { width: 20px; height: 20px; }
  .alert-box { padding: 10px 8px; }
  .alert-title { font-size: 0.82rem; }
  .alert-list { font-size: 0.68rem; line-height: 1.5; }
  .shock-text { font-size: 0.75rem; }
  .footer-dots { gap: 5px; }
  .dot { width: 6px; height: 6px; }
}

/* Tablets & up: centered card look */
@media (min-width: 640px) {
  .app {
    max-width: 520px;
    padding: 0 24px 24px;
  }
  .card {
    padding: 36px 32px 30px;
  }
  .card h2 {
    font-size: 1.3rem;
  }
  .input-wrap input {
    font-size: 1.25rem;
  }
  .btn {
    padding: 15px 20px;
    font-size: 1rem;
  }
}

/* Desktop: add subtle background decoration */
@media (min-width: 768px) {
  body {
    background:
      radial-gradient(ellipse at 20% 20%, rgba(2, 132, 199, 0.08) 0%, transparent 50%),
      radial-gradient(ellipse at 80% 80%, rgba(56, 189, 248, 0.06) 0%, transparent 50%),
      var(--bg);
  }
}

/* Ultra-wide */
@media (min-width: 1024px) {
  .app {
    max-width: 560px;
  }
}

/* Landscape phones: reduce height pressure */
@media (max-height: 480px) and (orientation: landscape) {
  .main {
    justify-content: flex-start;
    padding-top: 4px;
  }
  .card {
    padding: 16px 18px 14px;
  }
  .card-header { margin-bottom: 8px; }
  .icon-circle {
    width: 40px;
    height: 40px;
  }
  .icon-circle svg { width: 20px; height: 20px; }
  .card h2 { font-size: 0.98rem; margin-bottom: 6px; }
  .card .desc { font-size: 0.8rem; margin-bottom: 10px; }
  .input-wrap input { padding: 10px 12px; font-size: 1rem; }
  .btn { padding: 10px 14px; }
  .alert-box { padding: 12px; margin-bottom: 10px; }
  .alert-list { font-size: 0.75rem; line-height: 1.45; }
  .shock-text { font-size: 0.8rem; }
  .btn-row { margin-top: 10px; gap: 8px; }
  .topbar { padding: 8px 0 4px; }
  .footer { padding: 4px 0 2px; }
}

/* Dark mode aware (already dark, but ensure) */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
  }
}

/* High contrast */
@media (prefers-contrast: high) {
  .card { border-color: #64748b; }
  .input-wrap input { border-color: #94a3b8; }
  .btn-primary { background: #0369a1; }
  .btn-danger { background: #b91c1c; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
