:root {
  --bg-color: #0f172a;
  --card-bg: #1e293b;
  --card-border: #334155;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --primary-amber: #f59e0b;
  --primary-orange: #f97316;
  --accent-red: #ef4444;
  --accent-blue: #38bdf8;
  --accent-green: #10b981;
  --radius-lg: 24px;
  --radius-md: 14px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px 16px;
  position: relative;
}

.app-container {
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 8px;
}

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

.logo-img {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid rgba(245, 158, 11, 0.3);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.brand h1 {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.status-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.lock-btn {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid var(--card-border);
  width: 40px;
  height: 40px;
  border-radius: 12px;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.lock-btn:active {
  transform: scale(0.92);
}

/* Main Card */
.main-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.5);
}

/* Heating Status Badge */
.heating-status-wrapper {
  width: 100%;
  display: flex;
  justify-content: center;
}

.heating-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: 30px;
  font-size: 0.88rem;
  font-weight: 600;
  transition: var(--transition);
}

.heating-badge.idle {
  background: rgba(148, 163, 184, 0.12);
  color: var(--text-muted);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.heating-badge.active {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-red);
  border: 1px solid rgba(239, 68, 68, 0.4);
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.25);
}

.heating-badge.active .flame-icon {
  animation: pulse-flame 1.5s infinite ease-in-out;
}

@keyframes pulse-flame {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.25); opacity: 0.8; }
}

/* Temperature Display Ring */
.temp-display-container {
  position: relative;
  width: 210px;
  height: 210px;
}

.temp-ring {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(30,41,59,1) 60%, rgba(15,23,42,0.8) 100%);
  border: 4px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 4px 10px rgba(0,0,0,0.4), 0 8px 20px rgba(0,0,0,0.3);
  transition: var(--transition);
}

.main-card.heating .temp-ring {
  border-color: var(--primary-orange);
  box-shadow: inset 0 4px 15px rgba(249, 115, 22, 0.2), 0 0 25px rgba(249, 115, 22, 0.2);
}

.temp-value-wrapper {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.label-mini {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.temp-large {
  font-size: 3.2rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--text-main);
}

.temp-large .unit {
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 2px;
}

.target-summary {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 8px;
}

.target-summary strong {
  color: var(--primary-amber);
}

/* Control Section */
.target-control-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.control-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: center;
}

.stepper-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 6px;
}

.step-btn {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  border: none;
  background: var(--card-bg);
  color: var(--text-main);
  font-size: 1.6rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--card-border);
}

.step-btn:active {
  transform: scale(0.94);
  background: var(--primary-amber);
  color: #000;
}

.target-val-display {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--primary-amber);
}

.unit-small {
  font-size: 1rem;
  color: var(--text-muted);
}

/* Range Slider */
.custom-slider {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 8px;
  border-radius: 4px;
  background: var(--card-border);
  outline: none;
}

.custom-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary-amber);
  cursor: pointer;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
  transition: transform 0.1s ease;
}

.custom-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

/* Mode Selector */
.mode-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mode-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  background: rgba(15, 23, 42, 0.6);
  padding: 6px;
  border-radius: var(--radius-md);
  border: 1px solid var(--card-border);
}

.mode-btn {
  padding: 12px 8px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.mode-btn .icon {
  font-size: 1.1rem;
}

.mode-btn.active {
  background: var(--card-bg);
  color: var(--text-main);
  border: 1px solid var(--card-border);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.mode-btn[data-mode="auto"].active {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

.mode-btn[data-mode="manual_on"].active {
  border-color: var(--primary-orange);
  color: var(--primary-orange);
}

.mode-btn[data-mode="off"].active {
  border-color: var(--text-muted);
  color: var(--text-muted);
}

/* Footer */
.footer {
  text-align: center;
  font-size: 0.76rem;
  color: var(--text-muted);
}

.info-row {
  display: flex;
  justify-content: space-between;
  padding: 0 8px;
}

/* Auth Modal Overlay */
.auth-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(8px);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  transition: opacity 0.3s ease;
}

.auth-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.auth-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  width: 100%;
  max-width: 360px;
  text-align: center;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.auth-icon {
  font-size: 2.8rem;
  background: rgba(245, 158, 11, 0.12);
  width: 70px;
  height: 70px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.auth-card h2 {
  font-size: 1.3rem;
  font-weight: 700;
}

.auth-card p {
  font-size: 0.86rem;
  color: var(--text-muted);
  line-height: 1.4;
}

#auth-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

#auth-password-input {
  width: 100%;
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--card-border);
  background: rgba(15, 23, 42, 0.8);
  color: var(--text-main);
  font-size: 1rem;
  text-align: center;
  outline: none;
}

#auth-password-input:focus {
  border-color: var(--primary-amber);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.2);
}

.auth-btn {
  width: 100%;
  padding: 14px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--primary-amber);
  color: #000;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

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

.auth-error {
  font-size: 0.82rem;
  color: var(--accent-red);
  font-weight: 600;
}

.auth-error.hidden {
  display: none;
}
