* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Comic Sans MS", "Trebuchet MS", Arial, sans-serif;
  color: #2b2926;
  background: #fff7e6;
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 18px 7%;
  color: #fff4d1;
  background: #242321;
  border-bottom: 6px solid #d8a63f;
}

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

.logo {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  font-weight: bold;
  color: #242321;
  background: #f7d77b;
  border: 4px solid #f9e5a5;
  overflow: hidden;
}

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

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3,
.comic-card h4,
.poster-panel h4 {
  font-family: "Comic Sans MS", "Trebuchet MS", Arial, sans-serif;
}

.brand h1 {
  margin-bottom: 4px;
  font-size: 34px;
  line-height: 1;
}

.brand p {
  margin-bottom: 0;
  color: #f9e5a5;
}

main {
  width: 92%;
  max-width: 1180px;
  margin: 0 auto;
}

.intro {
  padding: 34px 0 20px;
  text-align: center;
}

.intro h2 {
  max-width: 820px;
  margin-left: auto;
  margin-right: auto;
  font-size: 34px;
  line-height: 1.1;
  margin-bottom: 10px;
  color: #3a3027;
}

.intro p {
  font-size: 17px;
  color: #6b5740;
}

.work-area {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

.work-area.single-feature {
  grid-template-columns: 1fr;
}

.work-area.comic-ready .comic-panel,
.work-area.notes-ready .notes-panel {
  grid-column: 1 / -1;
}

.work-area.comic-ready .notes-panel,
.work-area.notes-ready .comic-panel {
  display: none;
}

.tool-panel,
.member-card {
  border: 2px solid #ecd08a;
  border-radius: 8px;
  background: #fffdf7;
  box-shadow: 0 12px 30px rgba(74, 51, 20, 0.12);
}

.tool-panel {
  padding: 24px;
}

.comic-panel {
  border-top: 8px solid #d8a63f;
}

.notes-panel {
  border-top: 8px solid #b42020;
}

.tag {
  display: inline-block;
  margin-bottom: 12px;
  padding: 6px 10px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: bold;
  color: #4a241f;
  background: #ffe9a9;
}

.panel-text {
  color: #6b5740;
}

label {
  display: block;
  margin: 18px 0 8px;
  font-weight: bold;
}

input[type="file"] {
  width: 100%;
  padding: 12px;
  border: 2px dashed #c49a3a;
  border-radius: 8px;
  background: #fffaf0;
}

.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

button {
  border: 0;
  border-radius: 8px;
  padding: 12px 16px;
  cursor: pointer;
  font-weight: bold;
  color: #fff8df;
  background: #b42020;
  box-shadow: 0 2px 0 #741717;
}

button:hover {
  background: #941a1a;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.secondary {
  color: #2b2926;
  background: #f4d46f;
  box-shadow: 0 2px 0 #c49a3a;
}

.secondary:hover {
  background: #e4bd4f;
}

.status-box {
  margin-top: 18px;
  padding: 12px;
  border-radius: 8px;
  font-weight: bold;
  color: #4a241f;
  background: #fff0c2;
  border: 1px solid #e0ba55;
}

.status-link {
  display: inline;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: #b42020;
  background: transparent;
  box-shadow: none;
  font: inherit;
  font-weight: bold;
  text-decoration: underline;
}

.status-link:hover {
  color: #741717;
  background: transparent;
}

.output-box {
  margin-top: 18px;
}

.comic-title,
.notes-title {
  padding-bottom: 10px;
  border-bottom: 3px solid #ecd08a;
}

.comic-title {
  font-size: 34px;
}

.comic-poster {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  padding: 10px;
  border: 4px solid #242321;
  border-radius: 8px;
  background: #242321;
}

.poster-panel {
  position: relative;
  grid-column: span 2;
  min-height: 310px;
  padding: 12px;
  border: 3px solid #242321;
  border-radius: 6px;
  background: #fff7dd;
  overflow: hidden;
}

.poster-panel:nth-child(3n + 1) {
  background: #fff3d0;
}

.poster-panel:nth-child(3n + 2) {
  background: #f4ecff;
}

.poster-panel:nth-child(3n + 3) {
  background: #eaf7ff;
}

.poster-panel:nth-child(3n + 4) {
  background: #effbd9;
}

.poster-large {
  grid-column: span 3;
  min-height: 270px;
}

.summary-panel {
  grid-column: span 6;
  min-height: auto;
  background: #fffdf7;
}

.panel-heading-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 10px;
}

.panel-number {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: white;
  background: #b42020;
  border: 2px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.25);
  font-weight: bold;
}

.panel-heading-row h4 {
  margin: 2px 0 0;
  font-size: 20px;
  line-height: 1.15;
}

.comic-visual {
  display: grid;
  place-items: center;
  min-height: 118px;
  margin-bottom: 10px;
  padding: 12px;
  border: 2px solid rgba(36, 35, 33, 0.25);
  border-radius: 8px;
  text-align: center;
  font-size: 14px;
  line-height: 1.25;
  color: #4b3a24;
  background: rgba(255, 255, 255, 0.65);
}

.visual-icon {
  display: block;
  margin-bottom: 6px;
  font-size: 46px;
  line-height: 1;
}

.speech-bubble {
  position: relative;
  margin: 0 0 10px;
  padding: 10px 12px;
  border: 2px solid #242321;
  border-radius: 18px;
  background: white;
  font-weight: bold;
  line-height: 1.3;
}

.speech-bubble::after {
  content: "";
  position: absolute;
  left: 22px;
  bottom: -12px;
  width: 18px;
  height: 18px;
  border-left: 2px solid #242321;
  border-bottom: 2px solid #242321;
  background: white;
  transform: rotate(-25deg);
}

.learning-strip {
  margin: 14px 0 0;
  padding: 8px 10px;
  border-left: 6px solid #d8a63f;
  border-radius: 6px;
  color: #6f4b00;
  background: rgba(255, 248, 223, 0.9);
  font-weight: bold;
  line-height: 1.3;
}

.summary-text {
  margin: 0;
  padding: 12px 16px;
  border-radius: 24px;
  text-align: center;
  font-size: 22px;
  font-weight: bold;
  background: #fff0c2;
  border: 2px solid #d8a63f;
}

.quiz-heading {
  margin-top: 22px;
}

.quiz-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.quiz-card {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px;
  border: 2px solid #242321;
  border-radius: 8px;
  background: #fffdf7;
}

.quiz-card span {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: white;
  background: #b42020;
  font-weight: bold;
}

.quiz-card p {
  margin: 0;
}

.generated-comic-wrap {
  display: grid;
  place-items: center;
  padding: 12px;
  border: 4px solid #242321;
  border-radius: 8px;
  background: #242321;
}

.generated-comic-image {
  display: block;
  width: 100%;
  max-width: 900px;
  height: auto;
  border-radius: 4px;
  background: white;
}

.prompt-details {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid #ecd08a;
  border-radius: 8px;
  background: #fffaf0;
}

.prompt-details summary {
  cursor: pointer;
  font-weight: bold;
  color: #6f4b00;
}

.prompt-details p {
  margin: 10px 0 0;
  white-space: pre-wrap;
  color: #6b5740;
  font-size: 14px;
}

.pdf-comic-pages {
  display: grid;
  gap: 28px;
}

.pdf-comic-page {
  padding-bottom: 28px;
  border-bottom: 3px dashed #ecd08a;
}

.pdf-comic-page h3 {
  margin-bottom: 12px;
  color: #4a241f;
  font-size: 24px;
}

.comic-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.comic-card {
  min-height: 190px;
  padding: 16px;
  border: 3px solid #242321;
  border-radius: 8px;
  background: #fff0c2;
}

.comic-card:nth-child(even) {
  background: #ffe4d6;
}

.comic-card h4 {
  margin: 0 0 10px;
  font-size: 18px;
}

.dialogue {
  padding: 10px;
  border-radius: 8px;
  background: #fffdf7;
  border-left: 5px solid #b42020;
}

.learning {
  margin-bottom: 0;
  font-weight: bold;
  color: #6f4b00;
}

.notes-list {
  padding: 0;
  list-style: none;
}

.notes-list li {
  margin-bottom: 10px;
  padding: 12px;
  border-left: 5px solid #b42020;
  border-radius: 8px;
  background: #fff3d0;
}

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

.teacher-card-list {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}

.teacher-card {
  padding: 14px;
  border: 2px solid #ecd08a;
  border-radius: 8px;
  background: #fffaf0;
}

.teacher-card h3,
.teacher-card h4 {
  margin-bottom: 8px;
  color: #4a241f;
}

.teacher-card p {
  margin-bottom: 8px;
}

.teacher-card p:last-child {
  margin-bottom: 0;
}

.team-section {
  padding: 42px 0;
}

.team-section h2 {
  text-align: center;
  font-size: 28px;
}

.team-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.member-card {
  padding: 18px;
  text-align: center;
}

.member-card img {
  width: 130px;
  height: 130px;
  object-fit: cover;
  border-radius: 50%;
  border: 5px solid #f4d46f;
}

.member-card h3 {
  margin: 14px 0 6px;
}

.member-card p {
  margin-bottom: 0;
  color: #6b5740;
}

footer {
  display: flex;
  justify-content: center;
  gap: 22px;
  flex-wrap: wrap;
  padding: 22px;
  color: #fff4d1;
  background: #242321;
  border-top: 6px solid #d8a63f;
}

footer a {
  color: #fff4d1;
  text-decoration: none;
}

@media (max-width: 1200px) {
  .site-header,
  .work-area,
  .team-grid {
    grid-template-columns: 1fr;
  }

  .site-header {
    display: flex;
    flex-direction: column;
    text-align: center;
  }

  .brand {
    justify-content: center;
    margin-bottom: 16px;
  }

  .comic-grid {
    grid-template-columns: 1fr;
  }

  .comic-poster,
  .quiz-grid,
  .teacher-plan-grid {
    grid-template-columns: 1fr;
  }

  .poster-panel,
  .poster-large,
  .summary-panel {
    grid-column: span 1;
  }
}

@media print {
  @page {
    margin: 10mm;
  }

  html,
  body {
    width: 100%;
    margin: 0;
    background: white;
  }

  .site-header,
  .intro,
  .tool-panel input,
  .button-row,
  .status-box,
  .team-section,
  footer,
  .tag,
  .panel-text,
  label {
    display: none;
  }

  main {
    width: 100%;
    max-width: none;
  }

  .work-area {
    display: block;
    width: 100%;
  }

  .tool-panel {
    display: none;
    box-shadow: none;
    border: 0;
    padding: 0;
  }

  .tool-panel.has-result {
    display: block;
  }

  .prompt-details {
    display: none;
  }

  .output-box {
    margin: 0;
  }

  .comic-panel .comic-title {
    display: none;
  }

  .comic-poster {
    gap: 6px;
    padding: 6px;
  }

  .poster-panel {
    break-inside: avoid;
    min-height: 240px;
  }

  .pdf-comic-page {
    break-after: page;
    page-break-after: always;
    break-inside: avoid;
    page-break-inside: avoid;
    border-bottom: 0;
    padding-bottom: 0;
  }

  .pdf-comic-page:last-child {
    break-after: auto;
  }

  .pdf-comic-pages {
    display: block;
    gap: 0;
  }

  .generated-comic-wrap {
    display: block;
    border: 0;
    padding: 0;
    background: white;
  }

  .generated-comic-image {
    display: block;
    max-width: 100%;
    max-height: 250mm;
    width: auto;
    height: auto;
    margin: 0 auto;
  }

  .pdf-comic-page h3 {
    display: none;
  }
}
