:root {
  --bg: #0b0f1a;
  --bg-alt: #151b2b;
  --card: #161f33;
  --card-alt: #1f2a44;
  --accent: #ffb347;
  --accent-2: #57c7ff;
  --accent-3: #77e0a5;
  --text: #eef2ff;
  --muted: #9aa3b2;
  --chip-bg: rgba(255, 255, 255, 0.1);
  --chip-text: inherit;
  --track-bg: rgba(255, 255, 255, 0.08);
  --card-soft: rgba(255, 255, 255, 0.06);
  --shadow: rgba(9, 12, 25, 0.55);
  --radius: 20px;
  --font: "Rubik", "Segoe UI", "Tahoma", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  background: radial-gradient(circle at top, var(--bg-alt), var(--bg) 55%);
  color: var(--text);
  min-height: 100vh;
  overflow: hidden;
}

.app {
  min-height: 100vh;
  padding: 28px 40px 24px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 22px;
  transform-origin: center center;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}

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

.brand-mark {
  width: 78px;
  height: 44px;
  display: grid;
  place-items: center;
  background: transparent;
  box-shadow: none;
  overflow: hidden;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#schoolLogoFallback {
  font-weight: 700;
  font-size: 18px;
  color: #1b1c27;
}

.brand-title {
  font-size: 18px;
  font-weight: 700;
}

.brand-sub {
  color: var(--muted);
}

.meta {
  text-align: end;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.clock {
  font-size: 20px;
  font-weight: 600;
}

.date {
  color: var(--muted);
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 18px;
}

.card {
  background: linear-gradient(160deg, var(--card), var(--card-alt));
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: 0 22px 45px var(--shadow);
  position: relative;
  overflow: hidden;
  animation: floatIn 0.8s ease forwards;
}

.card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top right, rgba(255, 255, 255, 0.08), transparent 55%);
  pointer-events: none;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  gap: 16px;
}

.spotlight .card-header {
  flex-direction: row;
  align-items: center;
}

.class-of-week-name {
  text-align: start;
  font-size: 22px;
  font-weight: 700;
  background: transparent;
  border: none;
  margin-inline-start: auto;
}

.spotlight-text {
  flex: 0 1 auto;
  text-align: left;
}

.spotlight-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 200px;
  width: 100%;
}

.spotlight-row .class-of-week-name {
  justify-self: end;
}

html[dir="rtl"] .spotlight-row .class-of-week-name {
  justify-self: start;
}

.spotlight-note {
  margin: 0;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.card h2 {
  margin: 0;
  font-size: 20px;
}

.attendance {
  grid-column: span 7;
  grid-row: span 1;
}

.spotlight {
  grid-column: span 5;

}

.students {
  grid-column: span 7;
  grid-row: span 2;
}

.positives {
  grid-column: span 5;
  background: linear-gradient(150deg, rgba(255, 179, 71, 0.18), rgba(76, 201, 240, 0.12));
  border: 1px solid rgba(255, 255, 255, 0.08);
  
}

.conduct {
  grid-column: span 5;
  background: linear-gradient(160deg, rgba(63, 140, 255, 0.15), rgba(34, 197, 94, 0.12));
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.students,
.positives {
  padding: 16px;
}

.conduct {
  padding: 16px;
}

.ticker {
  position: static;
  padding: 12px 16px;
  background: linear-gradient(90deg, rgba(255, 179, 71, 0.2), rgba(87, 199, 255, 0.2));
  overflow: hidden;
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.08);
  min-height: 54px;
  width: 100%;
}

.tag,
.pill {
  background: var(--chip-bg);
  color: var(--chip-text);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  letter-spacing: 0.4px;
}

.pill.alt {
  background: rgba(119, 224, 165, 0.2);
}

.bar-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: opacity 0.35s ease;
  min-height: 150px;
}

.bar {
  display: grid;
  grid-template-columns: 120px 1fr 60px;
  align-items: center;
  gap: 12px;
}

.bar span {
  color: var(--muted);
}

.bar-track {
  background: var(--track-bg);
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-2), var(--accent-3));
  width: 0;
  animation: fillUp 1.6s ease forwards;
}

.spotlight-body {
  display: flex;
  align-items: center;
  gap: 18px;
}

.medal {
  width: 64px;
  height: 64px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  font-size: 28px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--accent);
}

.medal.alt {
  color: var(--accent-3);
}

.spotlight-note {
  margin: 0;
  font-size: 16px;
  color: var(--muted);
}

.student-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: minmax(70px, auto);
  gap: 14px;
  transition: opacity 0.35s ease;
  min-height: 140px;
}

.meta-toggle {
  justify-content: flex-end;
}

.student-card {
  background: var(--card-soft);
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  animation: popIn 0.9s ease forwards;
  display: flex;
  gap: 12px;
  align-items: center;
}

.student-photo {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.12);
  object-fit: cover;
  flex-shrink: 0;
}

.student-card h4 {
  margin: 0 0 6px;
  font-size: 16px;
}

.student-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  transition: opacity 0.35s ease;
  min-height: 60px;
}

.conduct-slider {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  min-height: 160px;
  transition: opacity 0.35s ease;
}

.conduct-item {
  background: var(--card-soft);
  border-radius: 16px;
  padding: 2px;
  display: grid;
  place-items: center;
  gap: 8px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.conduct-item img {
  width: 200px;
  height: 200px;
  object-fit: contain;
}

.conduct-item h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

.conduct-item span {
  font-size: 12px;
  color: var(--muted);
}

.chip {
  padding: 8px 14px;
  border-radius: 999px;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
  color: var(--chip-text);
  font-weight: 600;
  letter-spacing: 0.4px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  opacity: 0;
  transform: translateY(6px);
  animation: chipIn 0.6s ease forwards;
}

.chip:nth-child(odd) {
  border-color: rgba(255, 255, 255, 0.18);
}

.positives .chip {
  border-radius: 14px;
  text-transform: uppercase;
  font-size: 13px;
}

.toggle {
  display: flex;
  gap: 8px;
}

.lang-btn {
  border: none;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  cursor: pointer;
}

.lang-btn.active {
  background: var(--accent);
  color: #1b1c27;
}

.ticker-track {
  display: block;
  white-space: nowrap;
  font-weight: 500;
  letter-spacing: 0.6px;
  direction: ltr;
  color: inherit;
}

.ticker-inner {
  display: inline-flex;
  align-items: center;
  gap: 80px;
  will-change: transform;
  animation: ticker 22s linear infinite;
}

.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.ticker-icon {
  width: 22px;
  height: 22px;
  margin-inline-end: 12px;
  display: inline-block;
  background-size: contain;
  background-repeat: no-repeat;
  vertical-align: middle;
}

.ticker-icon.spark {
  background-image: linear-gradient(135deg, var(--accent), var(--accent-2));
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M12 2l2.4 6.2L21 10l-6.6 1.1L12 18l-2.4-6.9L3 10l6.6-1.8L12 2z'/></svg>") center/contain no-repeat;
}

.ticker-icon.star {
  background-image: linear-gradient(135deg, var(--accent), var(--accent-3));
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='m12 17.3-6.2 3.7 1.7-7.1L2 9.3l7.3-.6L12 2l2.7 6.7 7.3.6-5.5 4.6 1.7 7.1z'/></svg>") center/contain no-repeat;
}

.ticker-icon.bell {
  background-image: linear-gradient(135deg, var(--accent-2), var(--accent-3));
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M12 22a2.5 2.5 0 0 0 2.5-2.5h-5A2.5 2.5 0 0 0 12 22zm6-6V11a6 6 0 1 0-12 0v5L4 18v1h16v-1l-2-2z'/></svg>") center/contain no-repeat;
}

.ticker-icon.book {
  background-image: linear-gradient(135deg, var(--accent), var(--accent-2));
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M4 4h12a3 3 0 0 1 3 3v12a1 1 0 0 1-1 1H6a2 2 0 0 0-2 2V4zm2 2v14a4 4 0 0 1 2-1h10V7a1 1 0 0 0-1-1H6z'/></svg>") center/contain no-repeat;
}

.ticker-icon.check {
  background-image: linear-gradient(135deg, var(--accent-3), var(--accent));
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M9 16.2 4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4z'/></svg>") center/contain no-repeat;
}

.icon {
  width: 28px;
  height: 28px;
  display: inline-block;
  background-size: contain;
  background-repeat: no-repeat;
}

.attendance-icon {
  background-image: linear-gradient(135deg, var(--accent-2), var(--accent-3));
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M4 18h4V9H4v9zm6 0h4V5h-4v13zm6 0h4v-6h-4v6z'/></svg>") center/contain no-repeat;
}

.trophy-icon {
  background-image: linear-gradient(135deg, var(--accent), var(--accent-2));
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M17 3h-2V2H9v1H7a1 1 0 0 0-1 1v3a5 5 0 0 0 4 4.9V14H8v2h8v-2h-2v-2.1A5 5 0 0 0 18 7V4a1 1 0 0 0-1-1zm-9 4V5h2v4a3 3 0 0 1-2-2zm8 0a3 3 0 0 1-2 2V5h2v2z'/></svg>") center/contain no-repeat;
}

.heart-icon {
  background-image: linear-gradient(135deg, var(--accent-3), var(--accent));
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M12 21s-7-4.35-9.33-8.5C.58 8.7 3.3 5 6.9 5c2.04 0 3.35 1.1 4.1 2.18C11.75 6.1 13.06 5 15.1 5c3.6 0 6.32 3.7 4.23 7.5C19 16.65 12 21 12 21z'/></svg>") center/contain no-repeat;
}

.star-icon {
  background-image: linear-gradient(135deg, var(--accent), var(--accent-3));
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='m12 17.3-6.2 3.7 1.7-7.1L2 9.3l7.3-.6L12 2l2.7 6.7 7.3.6-5.5 4.6 1.7 7.1z'/></svg>") center/contain no-repeat;
}

.spark-icon {
  background-image: linear-gradient(135deg, var(--accent-2), var(--accent-3));
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M12 2l2.4 6.2L21 10l-6.6 1.1L12 18l-2.4-6.9L3 10l6.6-1.8L12 2z'/></svg>") center/contain no-repeat;
}

.shield-icon {
  background-image: linear-gradient(135deg, var(--accent-3), var(--accent-2));
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M12 2 4 5v6c0 5 3.4 9.7 8 11 4.6-1.3 8-6 8-11V5l-8-3z'/></svg>") center/contain no-repeat;
}

.screen-message {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  text-align: center;
  background: rgba(8, 10, 18, 0.94);
  color: var(--text);
}

.screen-message .primary {
  display: inline-block;
  margin-top: 16px;
  padding: 10px 18px;
  border-radius: 12px;
  background: var(--accent);
  color: #1b1c27;
  text-decoration: none;
}

@keyframes fillUp {
  from {
    width: 0;
  }
  to {
    width: var(--value);
  }
}

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

@keyframes popIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes ticker {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}

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

@media (max-width: 1100px) {
  .grid {
    grid-template-columns: repeat(6, 1fr);
  }
  .attendance,
  .spotlight,
  .students,
  .positives,
  .conduct {
    grid-column: span 6;
    grid-row: auto;
  }
  .student-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .conduct-slider {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .app {
    padding: 24px;
  }
  .top-bar {
    flex-direction: column;
    align-items: flex-start;
  }
  .meta {
    text-align: start;
  }
}

@media (max-height: 900px) {
  .app {
    padding: 20px 28px 24px;
    gap: 16px;
  }
  .card {
    padding: 16px;
  }
  .card h2 {
    font-size: 18px;
  }
  .clock {
    font-size: 24px;
  }
  .bar {
    grid-template-columns: 90px 1fr 48px;
  }
  .bar-track {
    height: 10px;
  }
  .student-card {
    padding: 10px;
  }
  .student-photo {
    width: 40px;
    height: 40px;
  }
  .spotlight-note {
    font-size: 14px;
  }
  .chip {
    padding: 6px 12px;
    font-size: 13px;
  }
}
