@font-face {
  font-family: "Inter";
  src: url("assets/fonts/Inter-Regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("assets/fonts/Inter-Medium.ttf") format("truetype");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("assets/fonts/Inter-SemiBold.ttf") format("truetype");
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("assets/fonts/Inter-Bold.ttf") format("truetype");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("assets/fonts/Inter-ExtraBold.ttf") format("truetype");
  font-style: normal;
  font-weight: 800;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("assets/fonts/Inter-Black.ttf") format("truetype");
  font-style: normal;
  font-weight: 900;
  font-display: swap;
}

:root {
  color-scheme: light;
  --brand-green: #31b95f;
  --brand-green-dark: #08733d;
  --app-brand: #37b55c;
  --app-brand-hover: #2fa050;
  --on-app-brand: #0d2415;
  --brand-purple: #7e2b91;
  --ink: #253322;
  --edge-ink: #303030;
  --app-ink: #122117;
  --app-muted: #5e6c63;
  --app-bg: #dfe8e2;
  --panel-bg: #ffffff;
  --tile-bg: #f4f7f5;
  --tint-bg: #eef9f0;
  --card-radius: 24px;
  --tile-radius: 18px;
  --line: #d8e1da;
  --focus: #176b3b;
  --preview-scale: 0.72;
  font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  padding: 16px;
  background: var(--app-bg);
  color: var(--app-ink);
}

button,
input,
textarea {
  font: inherit;
}

button,
input,
textarea,
a {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

button {
  cursor: pointer;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 12px;
  z-index: 100;
  padding: 10px 14px;
  color: #fff;
  background: #17231b;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform 160ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.app-header {
  position: sticky;
  top: 16px;
  z-index: 30;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 16px;
  padding: 8px 12px 8px 16px;
  background: var(--tile-bg);
  border-radius: var(--card-radius);
}

.app-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.app-brand strong,
.app-brand small {
  display: block;
}

.app-brand strong {
  font-size: 15px;
  letter-spacing: -0.01em;
}

.app-brand small {
  margin-top: 1px;
  color: var(--app-muted);
  font-size: 12px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: var(--on-app-brand);
  background: var(--app-brand);
  border-radius: 12px;
  box-shadow: 0 8px 18px rgba(55, 181, 92, 0.25);
}

.brand-mark svg,
.button svg,
.saved-status svg,
.editor-note svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand-mark svg {
  width: 24px;
  height: 24px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-weight: 700;
  transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

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

.button:active {
  transform: translateY(0);
}

.button:focus-visible,
input:focus-visible,
textarea:focus-visible,
.app-brand:focus-visible {
  outline: 3px solid rgba(23, 107, 59, 0.22);
  outline-offset: 2px;
}

.button svg {
  width: 19px;
  height: 19px;
}

.button-primary {
  color: var(--on-app-brand);
  background: var(--app-brand);
  box-shadow: 0 8px 20px rgba(55, 181, 92, 0.25);
}

.button-primary:hover {
  background: var(--app-brand-hover);
}

.button-primary:disabled {
  cursor: wait;
  opacity: 0.72;
  transform: none;
}

.button-secondary {
  color: #324039;
  background: #fff;
  border-color: #cfd9d1;
}

.button-secondary:hover {
  border-color: #9eada2;
  background: #f7faf8;
}

.workspace {
  min-height: calc(100vh - 128px);
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 16px;
}

.editor-panel {
  height: calc(100vh - 128px);
  overflow: hidden;
  background: var(--panel-bg);
  border-radius: var(--card-radius);
}

.editor-scroll {
  height: 100%;
  overflow-y: auto;
  padding: 28px 14px 28px 22px;
  scrollbar-width: thin;
  scrollbar-color: #c9d8cd transparent;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 22px, #000 calc(100% - 22px), transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 22px, #000 calc(100% - 22px), transparent 100%);
}

.editor-scroll::-webkit-scrollbar {
  width: 14px;
}

.editor-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.editor-scroll::-webkit-scrollbar-thumb {
  background: #c9d8cd;
  background-clip: content-box;
  border: 4px solid transparent;
  border-radius: 999px;
}

.editor-scroll::-webkit-scrollbar-thumb:hover {
  background: var(--app-brand);
  background-clip: content-box;
}

.page-viewport {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.page-viewport::-webkit-scrollbar {
  display: none;
}

.editor-intro {
  margin-bottom: 22px;
  padding: 0 4px;
}

.eyebrow {
  display: inline-block;
  margin: 0 0 10px;
  padding: 4px 10px;
  color: var(--brand-green-dark);
  background: var(--tint-bg);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.editor-intro h1 {
  margin: 0;
  font-size: 25px;
  line-height: 1.2;
  letter-spacing: -0.035em;
}

.editor-intro > p:last-child {
  margin: 10px 0 0;
  color: var(--app-muted);
  font-size: 14px;
  line-height: 1.55;
}

form {
  display: grid;
  gap: 30px;
  padding-top: 12px;
}

fieldset {
  position: relative;
  display: grid;
  gap: 13px;
  min-width: 0;
  margin: 0;
  padding: 30px 18px 18px;
  border: 1px solid #cddcd1;
  border-radius: var(--tile-radius);
  background: var(--tile-bg);
}

legend {
  position: absolute;
  top: 0;
  left: 14px;
  transform: translateY(-50%);
  padding: 5px 15px;
  color: #17231b;
  background: #fff;
  border: 1px solid #cddcd1;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

label {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 7px;
  color: #344039;
  font-size: 13px;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  color: #17231b;
  background: #fff;
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

input[type="date"] {
  display: block;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
  text-align: left;
}

input[type="date"]::-webkit-date-and-time-value {
  min-width: 0;
  text-align: left;
}

textarea {
  min-height: 68px;
  resize: vertical;
  line-height: 1.4;
}

input:hover,
textarea:hover {
  border-color: #c5d3c8;
}

input:focus,
textarea:focus {
  border-color: var(--app-brand);
  box-shadow: 0 0 0 3px rgba(55, 181, 92, 0.18);
}

.two-column-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.editor-note {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 9px;
  margin-top: 18px;
  padding: 14px;
  color: #526157;
  background: var(--tint-bg);
  border: 0;
  border-radius: var(--tile-radius);
}

.editor-note svg {
  width: 20px;
  height: 20px;
  color: var(--brand-green-dark);
}

.editor-note p {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
}

.preview-panel {
  min-width: 0;
  height: calc(100vh - 128px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
  padding: 22px;
  background: var(--panel-bg);
  border-radius: var(--card-radius);
}

.preview-toolbar {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 4px;
  color: #5e6c63;
}

.preview-toolbar strong,
.preview-toolbar span {
  display: block;
}

.preview-toolbar strong {
  color: #17231b;
  font-size: 22px;
  letter-spacing: -0.025em;
}

.preview-toolbar div > span {
  margin-top: 2px;
  font-size: 13px;
}

.saved-status {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  color: var(--brand-green-dark);
  background: var(--tint-bg);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.saved-status svg {
  width: 16px;
  height: 16px;
  color: var(--brand-green-dark);
}

.page-viewport {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  display: grid;
  place-items: start center;
  padding: 26px;
  background: var(--tile-bg);
  border-radius: var(--tile-radius);
}

.page-holder {
  position: relative;
  flex: 0 0 auto;
}

.a4-page {
  position: relative;
  width: 210mm;
  height: 297mm;
  overflow: hidden;
  color: var(--ink);
  background: #fff;
  border-radius: 8mm;
  box-shadow: 0 22px 54px rgba(34, 50, 39, 0.18), 0 2px 8px rgba(34, 50, 39, 0.1);
  transform: scale(var(--preview-scale));
  transform-origin: top left;
  font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}

.page-edge {
  position: absolute;
  left: 0;
  width: 100%;
  overflow: visible;
  pointer-events: none;
  display: block;
  object-fit: fill;
}

.page-edge-top {
  top: 0;
  height: 36.62mm;
}

.page-edge-bottom {
  bottom: 0;
  height: 22.19mm;
}

.university-logo {
  position: absolute;
  top: 25.2mm;
  left: 11.6mm;
  width: 108mm;
  height: auto;
  display: block;
}

.hero-illustration {
  position: absolute;
  top: 49mm;
  left: 53.2mm;
  width: 103.5mm;
  height: auto;
  display: block;
}

.department-title {
  position: absolute;
  top: 127.2mm;
  left: 10mm;
  right: 10mm;
  margin: 0;
  color: var(--brand-green);
  font-size: 9.1mm;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
  text-align: center;
  text-transform: uppercase;
  white-space: nowrap;
}

.course-block {
  position: absolute;
  top: 146mm;
  left: 11mm;
  right: 11mm;
  height: 26.8mm;
}

.course-line {
  height: 0.25mm;
  background: #9bc799;
}

.course-details {
  height: calc(100% - 0.25mm);
  display: grid;
  grid-template-columns: minmax(0, 104mm) minmax(48mm, 62mm);
  align-content: center;
  align-items: start;
  justify-content: space-between;
  gap: 8mm;
  padding: 0 3.4mm;
  font-size: 4.35mm;
  line-height: 1.3;
  letter-spacing: 0;
}

.course-details p {
  margin: 0;
  min-width: 0;
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  column-gap: 1.2mm;
  align-items: start;
  white-space: normal;
}

.course-details strong {
  min-width: 0;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.submission-card {
  position: absolute;
  top: 172.8mm;
  left: 0;
  right: 0;
  height: 76.4mm;
  display: grid;
  grid-template-columns: 49.2% 50.8%;
  padding: 11.5mm 16.8mm 8mm;
  background: linear-gradient(90deg, #eef9f0 0%, #f3fbf4 49%, #edf8ee 100%);
}

.submission-column {
  min-width: 0;
}

.student-column {
  padding-right: 9.8mm;
}

.teacher-column {
  padding-left: 9.8mm;
  border-left: 0.35mm solid #b8d5b4;
}

.submission-column h3 {
  margin: 0 0 6.7mm;
  color: #303030;
  font-size: 5.45mm;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
}

.submission-column dl {
  display: grid;
  row-gap: 4.5mm;
  margin: 0;
}

.submission-column dl > div {
  min-width: 0;
  display: grid;
  align-items: start;
  margin: 0;
  font-size: 4.35mm;
  line-height: 1.15;
  letter-spacing: 0;
}

.student-column dl > div {
  grid-template-columns: 28.5mm minmax(0, 1fr);
}

.teacher-column dl > div {
  grid-template-columns: 34mm minmax(0, 1fr);
}

.submission-column dt,
.submission-column dd {
  min-width: 0;
  margin: 0;
}

.submission-column dt {
  position: relative;
  font-weight: 400;
}

.submission-column dt::after {
  content: ":";
  position: absolute;
  right: 2mm;
}

.submission-column dd {
  color: #2d3b2a;
  font-weight: 800;
  overflow-wrap: anywhere;
}

input[name="courseCode"] {
  text-transform: uppercase;
}

[data-output="studentName"],
[data-output="studentId"],
[data-output="section"],
[data-output="semester"],
[data-output="teacherName"],
[data-output="teacherDepartment"] {
  white-space: nowrap;
}

.submission-date {
  position: absolute;
  top: 258.2mm;
  left: 15mm;
  right: 15mm;
  margin: 0;
  color: #273823;
  font-size: 4.6mm;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0;
  text-align: center;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 50;
  max-width: min(390px, calc(100vw - 44px));
  padding: 13px 16px;
  color: #fff;
  background: #243229;
  border-radius: 10px;
  box-shadow: 0 14px 35px rgba(19, 31, 22, 0.25);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.4;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 980px) {
  .workspace {
    grid-template-columns: 320px minmax(0, 1fr);
  }

  .editor-scroll {
    padding-left: 16px;
  }
}

@media (max-width: 760px) {
  body {
    padding: 12px 12px calc(88px + env(safe-area-inset-bottom));
  }

  .app-header {
    position: relative;
    top: 0;
    align-items: center;
    margin-bottom: 12px;
    padding: 10px 16px;
  }

  .app-brand small,
  .reset-label {
    display: none;
  }

  .header-actions .button-secondary {
    flex: none;
    width: 48px;
    padding: 0;
  }

  .header-actions {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 40;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.96);
    border-top: 1px solid var(--line);
    box-shadow: 0 -8px 24px rgba(19, 31, 22, 0.08);
  }

  .header-actions .button-primary {
    flex: 1;
  }

  .toast {
    bottom: calc(88px + env(safe-area-inset-bottom));
  }

  .button {
    padding-inline: 13px;
  }

  .workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
  }

  .editor-panel,
  .preview-panel {
    height: auto;
  }

  .editor-panel {
    overflow: visible;
  }

  .editor-scroll {
    height: auto;
    overflow: visible;
    padding: 20px 14px 18px;
    -webkit-mask-image: none;
    mask-image: none;
  }

  .preview-panel {
    min-height: 0;
    padding: 16px 14px;
  }

  .page-viewport {
    min-height: 0;
    padding: 16px 10px 28px;
  }

  input,
  textarea {
    font-size: 16px;
  }
}

@media (max-width: 460px) {
  .app-brand strong {
    max-width: 110px;
    line-height: 1.15;
  }

  .button-label {
    font-size: 13px;
  }

  .two-column-fields {
    grid-template-columns: 1fr;
  }

  .preview-toolbar {
    padding-inline: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@page {
  size: A4 portrait;
  margin: 0;
}

@media print {
  html,
  body {
    width: 210mm;
    height: 297mm;
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
  }

  .app-only,
  .editor-panel,
  .preview-toolbar {
    display: none !important;
  }

  .workspace,
  .preview-panel,
  .page-viewport,
  .page-holder {
    display: block !important;
    width: 210mm !important;
    height: 297mm !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    background: #fff !important;
    border-radius: 0 !important;
  }

  .a4-page {
    position: fixed;
    inset: 0;
    transform: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }
}
