:root {
  --primary: #4b7bec;
  --primary-light: #63a4ff;
  --accent: #20bf6b;
  --danger: #eb3b5a;
  --bg-light: #f7faff;
  --bg-dark: #181d23;
  --fg-light: #222;
  --fg-dark: #eee;
  --border: #e4ecf5;
  --radius: 16px;
  --shadow: 0 2px 24px 0 rgba(75, 123, 236, 0.09);
}

body {
  min-height: 100vh;
  background: linear-gradient(120deg, #4b7bec 0%, #20bf6b 100%);
  background-attachment: fixed;
  color: var(--fg-light);
  font-family: 'Segoe UI', Arial, sans-serif;
  margin: 0;
  -webkit-font-smoothing: antialiased;
}

.header-bar {
  width: 100%;
  background: linear-gradient(100deg, #4b7bec 80%, #20bf6b 100%);
  color: #fff;
  padding: 0 0.5em;
  height: 54px;
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 10;
}
.header-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 1px;
  margin-left: 10px;
}
.header-user {
  font-size: 1rem;
  margin-right: 1em;
  font-weight: 400;
  opacity: 0.98;
  display: flex;
  align-items: center;
  gap: 8px;
}
.header-user i {
  background: #fff4;
  color: #fff;
  font-size: 1.1em;
  padding: 0.1em 0.48em;
  border-radius: 1.2em;
}

.button, button, input[type="submit"] {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 0.7em 1.5em;
  font-size: 1.07em;
  font-weight: 500;
  cursor: pointer;
  margin-top: 0.2em;
  box-shadow: 0 2px 8px rgba(75,123,236,0.09);
  transition: background 0.18s, box-shadow 0.18s;
}
.button:active, button:active {
  background: #3968b3;
}
.button:focus, button:focus {
  outline: 2px solid #fff;
  background: #3968b3;
}

.main-card {
  max-width: 570px;
  margin: 3.5em auto 1.7em auto;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2.2rem 2.5rem 2rem 2.5rem;
}
@media (max-width: 600px) {
  .main-card {
    padding: 1.1rem 0.7rem 1.1rem 0.7rem;
    margin: 1.2em 0.3em 1.3em 0.3em;
  }
}

nav {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-bottom: 2em;
}
nav button {
  background: #f1f7ff;
  color: #2553a5;
  font-weight: 500;
  border: none;
  border-bottom: 3.5px solid transparent;
  border-radius: 8px 8px 0 0;
  margin: 0 2px;
  padding: 0.95em 1.7em 0.82em 1.7em;
  transition: all .17s;
}
nav button.active, nav button:focus {
  background: #fff;
  color: var(--primary);
  border-bottom: 3.5px solid var(--primary);
  font-weight: 700;
}

.tab { display: none; }
.tab.active { display: block; }

.login-container {
  min-height: 93vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2.6rem 2.8rem 2.2rem 2.8rem;
  max-width: 400px;
  width: 97vw;
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.login-card h2 {
  margin-bottom: 1.6rem;
  color: var(--primary);
  font-weight: 700;
}
.login-card label {
  width: 100%;
  font-size: 1.08em;
  margin-bottom: 1.2em;
  color: #234;
}
.login-card input[type="text"],
.login-card input[type="password"],
.login-card input[type="email"] {
  width: 100%;
  padding: .75em;
  margin-top: 0.33em;
  font-size: 1.04em;
  border: 1.7px solid var(--border);
  border-radius: var(--radius);
  background: #f7fbff;
  transition: border .15s;
}
.login-card input:focus { border: 1.7px solid var(--primary); }
.login-card .error-msg {
  color: var(--danger);
  text-align: center;
  margin-top: 0.8em;
  margin-bottom: -0.5em;
}

@media (max-width: 600px) {
  .login-card { padding: 1.3em 0.7em 1.2em 0.7em; }
}

#video-stream {
  display: block;
  max-width: 100%;
  width: 480px;
  height: 360px;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(75,123,236,0.11);
  background: #dbe8fa;
  position: relative;
  z-index: 1;
}

#canvas-overlay {
  position: absolute;
  top: 0; left: 0;
  pointer-events: none;
  width: 480px;
  height: 360px;
  z-index: 2;
  border-radius: 10px;
}

#detection-data {
  margin-top: 1.1em;
  font-size: 1.11em;
  min-height: 2.2em;
  text-align: left;
}

#register-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8em;
  margin-bottom: 1.4em;
  align-items: center;
}
#register-form input[type="email"] { min-width: 140px; max-width: 220px; }
#register-form input[type="file"] { max-width: 150px; }
#register-form button {
  min-width: 130px;
  padding: .7em 1.1em;
  background: var(--accent);
  color: #fff;
  border-radius: 9px;
  border: none;
  cursor: pointer;
  font-size: 1em;
}

#reg-list {
  margin-top: 0.8em;
  font-size: 1.02em;
}
#reg-list ul { list-style-type: disc; margin-left: 1.3em; }
#reg-list li { margin-bottom: .3em; }
#reg-list button {
  background: var(--danger);
  color: #fff;
  border: none;
  border-radius: 5px;
  margin-left: 8px;
  padding: .22em .77em;
  font-size: .97em;
  cursor: pointer;
  transition: background .16s;
}
#reg-list button:hover { background: #ba2747; }
