/* --- Global Rules & Anti-Data Loss --- */
:root {
  --primary: #f6821f; /* Cloudflare Orange */
  --primary-hover: #e06c0b;
  --bg-color: #f3f4f6;
  --card-bg: #ffffff;
  --text-main: #1f2937;
  --text-muted: #6b7280;
  --success: #10b981;
  --warning: #f59e0b;
}

body {
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  /* Anti-Data Loss: ป้องกันการปัดจอรีเฟรชบนมือถือ */
  overscroll-behavior-y: none; 
}

.container {
  width: 100%;
  max-width: 400px;
  padding: 20px;
  box-sizing: border-box;
}

/* --- Card UI --- */
.card {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 30px 24px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
  text-align: center;
}

.card h2 {
  margin: 0 0 5px 0;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 25px;
}

/* --- Form & Inputs --- */
.input-group {
  margin-bottom: 20px;
}

input[type="password"] {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 1rem;
  box-sizing: border-box;
  transition: border-color 0.3s;
}

input[type="password"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(246, 130, 31, 0.1);
}

/* --- Buttons --- */
.btn {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

.btn.primary {
  background-color: var(--primary);
  color: white;
}

.btn.primary:hover:not(:disabled) {
  background-color: var(--primary-hover);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn.text-btn {
  background: transparent;
  color: var(--text-muted);
  margin-top: 20px;
  font-size: 0.85rem;
}

.btn.text-btn:hover {
  color: var(--text-main);
  text-decoration: underline;
}

/* --- Result Box --- */
.result-box {
  margin-top: 25px;
  background: #f9fafb;
  border-radius: 12px;
  padding: 15px 20px;
  text-align: left;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid #e5e7eb;
}

.stat-row:last-child {
  border-bottom: none;
}

.stat-row.highlight {
  font-size: 1.1rem;
  font-weight: bold;
}

.text-warning { color: var(--warning); }
.text-success { color: var(--success); }

/* --- Skeleton Loader --- */
.skeleton-wrapper {
  margin-top: 25px;
  text-align: left;
}

.skeleton {
  background: #e5e7eb;
  background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
  border-radius: 6px;
  margin-bottom: 12px;
}

.skeleton.line {
  height: 20px;
  width: 100%;
}

.skeleton.short {
  width: 60%;
}

@keyframes loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}