:root {
  color-scheme: light;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 16px;
  --paper: #f7faf9;
  --white: #ffffff;
  --navy: #123346;
  --navy-soft: #1c465b;
  --teal: #2cbfaf;
  --teal-dark: #168f85;
  --ink: #33434a;
  --muted: #8c9a9e;
  --line: #dfe7e6;
  --error: #ffb4ab;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button,
label[for] {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

:focus-visible {
  outline: 3px solid #79e6d9;
  outline-offset: 3px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(25rem, 0.9fr) minmax(31rem, 1.1fr);
  min-height: 100vh;
}

.editor-panel {
  background: var(--navy);
  color: var(--white);
  padding: clamp(2rem, 4vw, 4rem) clamp(1.5rem, 4vw, 4.5rem);
}

.editor-header,
#card-form {
  width: min(100%, 37rem);
  margin-inline: auto;
}

.editor-logo {
  display: block;
  width: 13.5rem;
  height: auto;
  margin-bottom: 2.5rem;
  filter: brightness(0) invert(1);
}

.editor-kicker,
.preview-label {
  margin: 0 0 0.55rem;
  color: #91e3db;
  font-size: 0.86rem;
  font-weight: 700;
}

.editor-header h1 {
  margin: 0;
  max-width: 13ch;
  font-size: clamp(2.25rem, 4vw, 3.5rem);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.editor-intro {
  max-width: 34rem;
  margin: 1.25rem 0 2.5rem;
  color: #c6d7de;
  font-size: 1rem;
  line-height: 1.55;
}

#card-form {
  display: grid;
  gap: 1.25rem;
}

.photo-control {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 1.15rem;
  align-items: center;
  padding-bottom: 0.35rem;
}

.photo-thumb {
  width: 5.5rem;
  aspect-ratio: 1;
  border: 3px solid rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  object-fit: cover;
  background: #e8f2f1;
}

.photo-copy {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.75rem;
}

.photo-copy .field-label,
.photo-copy small,
.photo-copy .field-error {
  flex-basis: 100%;
}

.field-label,
.field > span:first-child {
  display: block;
  color: #e9f1f3;
  font-size: 0.9rem;
  font-weight: 700;
}

.file-button,
.shuffle-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.6rem;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 0.55rem;
  padding: 0.65rem 0.9rem;
  background: transparent;
  color: var(--white);
  font-size: 0.9rem;
  font-weight: 700;
}

.file-button:hover,
.shuffle-button:hover {
  border-color: #72ddd1;
  background: rgba(44, 191, 175, 0.1);
}

.photo-copy small,
.privacy-note {
  color: #9eb6c0;
  font-size: 0.78rem;
  line-height: 1.45;
}

.field {
  display: block;
}

.field input {
  width: 100%;
  min-height: 3.25rem;
  margin-top: 0.45rem;
  border: 1px solid transparent;
  border-radius: 0.65rem;
  padding: 0.8rem 0.95rem;
  background: #f5f8f8;
  color: #173442;
}

.field input::placeholder {
  color: #8a9ba1;
}

.field input:hover {
  background: #ffffff;
}

.field input:focus {
  border-color: #62d8cb;
  background: #ffffff;
  outline: 3px solid rgba(44, 191, 175, 0.25);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.field-error {
  display: block;
  min-height: 1em;
  margin-top: 0.35rem;
  color: var(--error);
  font-size: 0.78rem;
  line-height: 1.25;
}

[data-invalid="true"] input,
[data-invalid="true"] .photo-thumb {
  border-color: var(--error);
}

.random-data {
  margin-top: 0.2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.17);
  border-bottom: 1px solid rgba(255, 255, 255, 0.17);
  padding: 1.4rem 0;
}

.random-data-heading {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  justify-content: space-between;
}

.random-data h2 {
  margin: 0;
  font-size: 1rem;
}

.random-data-heading p {
  margin: 0.35rem 0 0;
  color: #9eb6c0;
  font-size: 0.82rem;
}

.random-list {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(7rem, 1fr) minmax(6.5rem, 0.8fr);
  gap: 1rem;
  margin: 1.25rem 0 0;
}

.random-list div {
  min-width: 0;
}

.random-list dt {
  margin-bottom: 0.3rem;
  color: #89a4af;
  font-size: 0.75rem;
  font-weight: 700;
}

.random-list dd {
  margin: 0;
  overflow-wrap: anywhere;
  color: #ffffff;
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.35;
}

.generate-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  min-height: 3.65rem;
  border: 0;
  border-radius: 0.7rem;
  padding: 0.9rem 1.25rem;
  background: var(--teal);
  color: #0b2f38;
  font-size: 1rem;
  font-weight: 800;
  box-shadow: 0 0.75rem 2rem rgba(2, 22, 30, 0.24);
}

.generate-button:hover {
  background: #58d3c6;
}

.generate-button:active {
  transform: translateY(1px);
}

.generate-button svg {
  width: 1.35rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.privacy-note,
.form-status {
  margin: -0.35rem 0 0;
  text-align: center;
}

.form-status {
  min-height: 1.25rem;
  color: #9ff1e7;
  font-size: 0.84rem;
  font-weight: 700;
}

.preview-panel {
  min-width: 0;
  padding: clamp(2rem, 3vw, 3.75rem);
  background-color: var(--paper);
  background-image:
    linear-gradient(rgba(18, 51, 70, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(18, 51, 70, 0.035) 1px, transparent 1px);
  background-size: 2rem 2rem;
}

.preview-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  width: min(100%, 43rem);
  margin: 0 auto 1.75rem;
}

.preview-heading h2 {
  margin: 0;
  color: var(--navy);
  font-size: clamp(1.45rem, 2.2vw, 2rem);
  letter-spacing: -0.035em;
}

.preview-label {
  color: var(--teal-dark);
}

.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: #52686f;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.live-indicator i {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 0.25rem rgba(44, 191, 175, 0.15);
}

.card-stage {
  display: grid;
  place-items: start center;
  position: sticky;
  top: 2rem;
}

.student-card {
  position: relative;
  width: min(100%, 27rem);
  aspect-ratio: 20 / 31;
  overflow: hidden;
  border: 1px solid #e1e7e6;
  border-radius: 0.9rem;
  background: var(--white);
  box-shadow:
    0 2.25rem 4rem rgba(21, 52, 63, 0.16),
    0 0.35rem 1rem rgba(21, 52, 63, 0.08);
  color: var(--ink);
}

.student-card::before {
  content: "";
  position: absolute;
  inset: auto -23% -15% 36%;
  width: 80%;
  aspect-ratio: 1;
  border: 1px solid rgba(44, 191, 175, 0.12);
  border-radius: 50%;
  pointer-events: none;
}

.card-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 5.2% 7.5% 3.2%;
}

.card-brand img {
  display: block;
  width: 48%;
  height: auto;
}

.card-brand span {
  color: #87969a;
  font-size: clamp(0.52rem, 1vw, 0.7rem);
  font-weight: 700;
}

.card-accent {
  width: 85%;
  height: 0.28%;
  min-height: 2px;
  margin: 0 auto;
  background: var(--teal);
}

.card-photo-wrap {
  width: 35%;
  aspect-ratio: 1;
  margin: 7.4% auto 7.2%;
  padding: 1.2%;
  border: 1px solid #cad8d8;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0.35rem 0.9rem rgba(18, 51, 70, 0.12);
}

.card-photo-wrap img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: #e8f2f1;
}

.card-fields {
  display: grid;
  gap: 5.2%;
  padding: 0 7.8%;
}

.card-field-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 7%;
}

.card-field {
  min-width: 0;
}

.card-field > span {
  display: block;
  margin-bottom: 1.6%;
  color: #9ba6a8;
  font-size: clamp(0.55rem, 1.3vw, 0.78rem);
  font-weight: 700;
}

.card-field strong {
  display: block;
  overflow-wrap: anywhere;
  color: #59676b;
  font-size: clamp(0.77rem, 1.75vw, 1.05rem);
  font-weight: 400;
  line-height: 1.18;
}

.card-field-name strong {
  min-height: 2.35em;
  font-size: clamp(1rem, 2.5vw, 1.42rem);
  line-height: 1.1;
}

.card-field-course strong {
  min-height: 2.4em;
  font-size: clamp(0.88rem, 2vw, 1.18rem);
}

.identity-note {
  width: 78%;
  margin: 7.8% auto 0;
  color: #b0b9bb;
  font-size: clamp(0.58rem, 1.4vw, 0.82rem);
  line-height: 1.35;
  text-align: center;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  clip-path: inset(50%) !important;
}

@media (max-width: 68rem) {
  .workspace {
    grid-template-columns: minmax(23rem, 0.92fr) minmax(28rem, 1.08fr);
  }

  .random-list {
    grid-template-columns: 1fr 1fr;
  }

  .random-list div:first-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 52rem) {
  .workspace {
    display: block;
  }

  .editor-panel,
  .preview-panel {
    padding: 2.5rem clamp(1.15rem, 5vw, 2.5rem);
  }

  .card-stage {
    position: static;
  }
}

@media (max-width: 34rem) {
  .editor-logo {
    width: 11.5rem;
  }

  .field-row,
  .random-list {
    grid-template-columns: 1fr;
  }

  .random-list div:first-child {
    grid-column: auto;
  }

  .random-data-heading,
  .preview-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .shuffle-button {
    width: 100%;
  }

  .live-indicator {
    align-self: flex-start;
  }

  .student-card {
    border-radius: 0.65rem;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .file-button,
  .shuffle-button,
  .generate-button,
  .field input {
    transition:
      background-color 160ms ease,
      border-color 160ms ease,
      transform 80ms ease;
  }
}
