:root {
  color: #202124;
  background: #f6f7fb;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-height: 100dvh;
  margin: 0;
  padding: max(24px, env(safe-area-inset-top)) 16px 32px;
  display: grid;
  justify-items: center;
  align-items: start;
}

.app {
  width: min(100%, 420px);
  padding-top: clamp(16px, 7vh, 56px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}

.student-field {
  width: min(100%, 320px);
  display: grid;
  gap: 6px;
}

.field-label {
  margin-left: 2px;
  color: #5f6368;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
}

.student-input-wrap {
  position: relative;
  display: block;
}

.student-field input {
  width: 100%;
  height: 44px;
  border: 1px solid #c8ccd4;
  border-radius: 4px;
  padding: 0 52px 0 12px;
  color: transparent;
  caret-color: #202124;
  font: inherit;
  background: #fff;
}

.student-field input::placeholder {
  color: #757575;
  opacity: 1;
}

.student-input-mask {
  position: absolute;
  left: 12px;
  right: 52px;
  top: 50%;
  transform: translateY(-50%);
  overflow: hidden;
  color: #202124;
  font: inherit;
  font-weight: 400;
  line-height: 1;
  pointer-events: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.student-field input:focus-visible,
.size-buttons button:focus-visible,
.icon-button:focus-visible {
  outline: 3px solid #8bd8ff;
  outline-offset: 2px;
}

.size-buttons {
  width: min(100%, 320px);
  display: flex;
  gap: 10px;
}

.size-buttons button {
  position: relative;
  flex: 1;
  min-height: 42px;
  border: 2px solid transparent;
  border-radius: 4px;
  padding: 0 12px;
  color: #fff;
  background: #9aa0a6;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 160ms ease, transform 120ms ease;
}

.size-buttons button:hover,
.size-buttons button[aria-pressed="true"] {
  background: #008fc7;
}

.size-buttons button[aria-pressed="true"] {
  border-color: #005f86;
  box-shadow: 0 0 0 3px rgba(0, 143, 199, 0.16);
}

.size-buttons button:active {
  transform: scale(0.96);
}

.icon-button {
  position: absolute;
  right: 6px;
  top: 50%;
  width: 32px;
  height: 32px;
  border: 1px solid #c8ccd4;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #3c4043;
  background: #fff;
  cursor: pointer;
  transform: translateY(-50%);
}

.eye-icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-button[aria-pressed="true"] .eye-slash {
  display: none;
}

.storage-controls {
  width: min(100%, 320px);
  margin-top: -8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #5f6368;
  font-size: 14px;
}

.remember-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  cursor: pointer;
  user-select: none;
}

.remember-toggle input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.toggle-track {
  width: 38px;
  height: 22px;
  border-radius: 999px;
  padding: 2px;
  background: #c8ccd4;
  transition: background-color 160ms ease;
}

.toggle-track span {
  display: block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(32, 33, 36, 0.2);
  transition: transform 160ms ease;
}

.remember-toggle input:checked + .toggle-track {
  background: #008fc7;
}

.remember-toggle input:checked + .toggle-track span {
  transform: translateX(16px);
}

.remember-toggle input:focus-visible + .toggle-track {
  outline: 3px solid #8bd8ff;
  outline-offset: 2px;
}

.clear-button {
  min-height: 32px;
  border: 1px solid #c8ccd4;
  border-radius: 4px;
  padding: 0 12px;
  color: #3c4043;
  background: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.clear-button:focus-visible {
  outline: 3px solid #8bd8ff;
  outline-offset: 2px;
}

.update-time {
  min-height: 22px;
  margin: -8px 0 0;
  color: #5f6368;
  font-size: 14px;
}

.qr-container {
  width: 100%;
  min-height: var(--qr-size, 240px);
  display: grid;
  place-items: center;
  transition: min-height 160ms ease;
}

.qr-placeholder {
  width: var(--qr-size, 240px);
  height: var(--qr-size, 240px);
  border: 2px dashed #c8ccd4;
  border-radius: 8px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: max(8px, calc(var(--qr-size, 240px) * 0.04));
  padding: max(18px, calc(var(--qr-size, 240px) * 0.08));
  background: #fff;
  opacity: 0.72;
}

.qr-placeholder span {
  border-radius: 3px;
  background: #d6d9de;
}

.qr-placeholder span:nth-child(1),
.qr-placeholder span:nth-child(2),
.qr-placeholder span:nth-child(4) {
  grid-row: span 2;
  grid-column: span 2;
}

.qr-placeholder span:nth-child(3) {
  grid-column: span 1;
}

.qr-placeholder span:nth-child(5) {
  grid-column: span 3;
}

.qr-placeholder[hidden] {
  display: none;
}

#qr-canvas {
  display: block;
  width: var(--qr-size, 140px);
  height: var(--qr-size, 140px);
  background: #fff;
}
