:root {
  --color-text: #E63;
  --color-accent: #0CD;
  --color-bg: #044;
  --phone-chrome-h: 56px;
}

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

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--color-text);
  background: #012;
}

.viewport {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 12px;
}

.phone {
  width: min(420px, 100vw);
  height: min(900px, 100vh);
  aspect-ratio: 9 / 19.5;
  background: var(--color-bg);
  overflow: hidden;
  border-radius: 24px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
  container-type: inline-size;
  position: relative;
  display: flex;
  flex-direction: column;
}

.phone-chrome {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--phone-chrome-h);
  z-index: 20;
  pointer-events: none;
  background: var(--color-bg);
}

.logo {
  position: absolute;
  bottom: 10px;
  left: 12px;
  width: 20%;
  max-height: calc(var(--phone-chrome-h) - 10px);
  height: auto;
  object-fit: contain;
}

.app-footer {
  position: absolute;
  bottom: 12px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.75rem;
  opacity: 0.75;
}

.loader {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--color-bg);
  z-index: 30;
  opacity: 1;
  transition: opacity 2.5s ease;
}

.loader.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.loader__img {
  width: 100%;
  height: auto;
  display: block;
}

.screen {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 20px;
  padding-bottom: calc(var(--phone-chrome-h) + 16px);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  position: relative;
}

.panel {
  width: 100%;
}

.title {
  margin: 0 0 8px;
  font-size: clamp(1.75rem, 8cqi, 2.25rem);
  color: var(--color-accent);
  text-align: center;
}

.subtitle {
  margin: 0 0 28px;
  text-align: center;
  opacity: 0.9;
}

.form {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 6px;
}

.field--checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.field--checkbox input[type='checkbox'] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--color-accent);
  cursor: pointer;
}

.field span {
  font-size: 0.9rem;
}

.field input {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--color-accent);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.2);
  color: var(--color-text);
  font-size: 1rem;
}

.field input:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 204, 221, 0.25);
}

.btn {
  border: none;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

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

.btn--secondary {
  background: transparent;
  color: var(--color-accent);
  border: 2px solid var(--color-accent);
  margin-top: 24px;
}

.link {
  background: none;
  border: none;
  padding: 0;
  color: var(--color-accent);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}

.switch {
  margin: 24px 0 0;
  text-align: center;
}

.form-error {
  margin: 0;
  color: #f88;
  font-size: 0.9rem;
}

.home-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin-bottom: 8px;
}

.title--home {
  margin: 0;
  width: 100%;
}

.home-menu {
  position: absolute;
  top: 0;
  right: 0;
}

.menu-toggle {
  width: 10%;
  min-width: 32px;
  aspect-ratio: 1;
  padding: 6%;
  border: none;
  background: transparent;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.menu-toggle__icon {
  position: relative;
  display: block;
  width: 100%;
  height: 3px;
  background: var(--color-accent);
  border-radius: 2px;
}

.menu-toggle__icon::before,
.menu-toggle__icon::after {
  content: '';
  position: absolute;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--color-accent);
  border-radius: 2px;
}

.menu-toggle__icon::before {
  top: -7px;
}

.menu-toggle__icon::after {
  top: 7px;
}

.menu-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 10rem;
  background: var(--color-bg);
  border: 2px solid var(--color-accent);
  border-radius: 10px;
  overflow: hidden;
  z-index: 30;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.menu-item {
  display: block;
  width: 100%;
  padding: 12px 16px;
  border: none;
  background: transparent;
  color: var(--color-text);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.menu-item:hover,
.menu-item:focus-visible {
  background: rgba(0, 204, 221, 0.15);
  outline: none;
}

.menu-user {
  padding: 10px 16px 12px;
  border-top: 1px solid rgba(0, 204, 221, 0.35);
  font-size: 0.85rem;
  line-height: 1.45;
  opacity: 0.9;
  pointer-events: none;
}

.menu-user span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.section-title {
  margin: 20px 0 10px;
  font-size: 1rem;
  color: var(--color-accent);
  font-weight: 600;
}

.section-title--home {
  margin-top: 16px;
}

.section-title--first {
  margin-top: 0;
}

.teacher-toolbar {
  padding: 0 0 8px;
}

.topic-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: grid;
  gap: 8px;
}

.topic-row {
  padding: 10px 12px;
  border: 1px solid rgba(0, 204, 221, 0.45);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.12);
  font-size: 0.92rem;
}

.topic-row--student {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 2px solid rgba(0, 204, 221, 0.45);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.12);
  font-size: 0.92rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.topic-row--student.is-choice-red {
  border-color: #f44;
  box-shadow: 0 0 14px rgba(255, 68, 68, 0.55);
}

.topic-row--student.is-choice-yellow {
  border-color: #fc0;
  box-shadow: 0 0 14px rgba(255, 204, 0, 0.5);
}

.topic-row--student.is-choice-green {
  border-color: #4d8;
  box-shadow: 0 0 14px rgba(68, 221, 136, 0.5);
}

.topic-row__title {
  flex: 1;
  min-width: 0;
}

.topic-row__choices {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.choice-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
}

.choice-btn--red {
  background: #a22;
  border-color: #f44;
}

.choice-btn--yellow {
  background: #a80;
  border-color: #fc0;
}

.choice-btn--green {
  background: #282;
  border-color: #4d8;
}

.choice-btn.is-selected {
  outline: 2px solid #fff;
  outline-offset: 1px;
}

.choice-btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.choice-legend {
  margin: 20px 0 16px;
  font-size: 0.88rem;
  opacity: 0.9;
}

.choice-legend__line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 8px;
}

.choice-legend .choice-btn {
  pointer-events: none;
  cursor: default;
}

#student-checkpoint-done {
  margin-bottom: 4px;
}

.checkpoint-actions {
  display: grid;
  gap: 10px;
  margin: 20px 0 16px;
}

.checkpoint-date-set {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
}

.checkpoint-date-set input[type='date'] {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border: 2px solid var(--color-accent);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.2);
  color: var(--color-text);
  font-size: 1rem;
  font-family: inherit;
}

.checkpoint-date-set input[type='date']:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 204, 221, 0.25);
}

.btn--small {
  flex-shrink: 0;
  padding: 10px 14px;
  font-size: 0.85rem;
  margin-top: 0;
}

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

.section-title--muted {
  opacity: 0.75;
}

.hint {
  margin: 0 0 16px;
  font-size: 0.9rem;
  opacity: 0.8;
}

.subject-list,
.checkpoint-list,
.admin-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.subject-list__empty {
  padding: 16px;
  text-align: center;
  opacity: 0.85;
  font-size: 0.95rem;
}

.subject-list__empty--error {
  color: #f88;
}

.subject-row,
.checkpoint-row,
.admin-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 2px solid var(--color-accent);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.15);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.checkpoint-row.is-choice-red {
  border-color: #f44;
  box-shadow: 0 0 14px rgba(255, 68, 68, 0.55);
}

.checkpoint-row.is-choice-yellow {
  border-color: #fc0;
  box-shadow: 0 0 14px rgba(255, 204, 0, 0.5);
}

.checkpoint-row.is-choice-green {
  border-color: #4d8;
  box-shadow: 0 0 14px rgba(68, 221, 136, 0.5);
}

.subject-row__name,
.checkpoint-row__name,
.admin-row__name {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  font-size: 0.92rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn--code {
  flex-shrink: 0;
  padding: 4px 8px;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  background: rgba(0, 204, 221, 0.15);
  color: var(--color-accent);
  border: 1px solid var(--color-accent);
}

.btn--delete {
  flex-shrink: 0;
  padding: 4px 10px;
  font-size: 0.78rem;
  background: transparent;
  color: #f88;
  border: 1px solid #f88;
}

.btn--code.is-copied {
  background: var(--color-accent);
  color: var(--color-bg);
}

.btn--code.is-watching {
  background: #282;
  color: #4d8;
  border-color: #4d8;
  box-shadow: 0 0 10px rgba(68, 221, 136, 0.5);
}

.results-chart {
  display: grid;
  place-items: center;
  margin: 8px 0 24px;
}

.results-pie {
  width: min(240px, 70vw);
  height: auto;
  display: block;
}

.results-pie__label {
  fill: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  paint-order: stroke;
  stroke: rgba(0, 0, 0, 0.45);
  stroke-width: 3px;
  stroke-linejoin: round;
}

.subject-row__checkpoint {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  padding: 3px;
  border: 1px solid var(--color-accent);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.2);
  cursor: pointer;
  display: grid;
  place-items: center;
}

.subject-row__checkpoint img {
  width: 100%;
  height: auto;
  display: block;
}

.subject-row__checkpoint:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 204, 221, 0.25);
}

.checkpoint-row__date {
  flex-shrink: 0;
  font-size: 0.8rem;
  opacity: 0.85;
}

#student-join-form {
  margin-top: 16px;
}

.home-feedback {
  margin: 10px 0 0;
  font-size: 0.9rem;
  color: var(--color-accent);
  text-align: center;
}

.home-feedback--error {
  color: #f88;
}

.date-quick {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.date-picker {
  display: grid;
  gap: 16px;
  margin-bottom: 16px;
}

#subject-checkpoint-list {
  margin-bottom: 20px;
}

.month-picker__title {
  margin: 0 0 8px;
  text-align: center;
  font-size: 0.95rem;
  color: var(--color-accent);
  font-weight: 600;
}

.month-picker__grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.month-picker__day {
  border: 1px solid rgba(0, 204, 221, 0.35);
  border-radius: 6px;
  padding: 6px 0;
  font-size: 0.8rem;
  background: rgba(0, 0, 0, 0.15);
  color: var(--color-text);
  cursor: pointer;
}

.month-picker__day:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.month-picker__day:not(:disabled):hover,
.month-picker__day:not(:disabled):focus-visible {
  background: rgba(0, 204, 221, 0.2);
  outline: none;
}
