:root {
  --toefl-creator-ink: #17352b;
  --toefl-creator-muted: #637069;
  --toefl-creator-green: #2d5f4d;
  --toefl-creator-green-dark: #1f493a;
  --toefl-creator-mint: #e7f3eb;
  --toefl-creator-cream: #f7f5ef;
  --toefl-creator-line: #dfe5df;
  --toefl-creator-white: #fff;
  --toefl-creator-danger: #9b302f;
}

.toefl-flash-creator,
.toefl-flash-creator * {
  box-sizing: border-box;
}

.toefl-flash-creator {
  width: min(1160px, calc(100% - 40px));
  min-width: 0;
  margin: 0 auto;
  padding: 40px 0 88px;
  color: var(--toefl-creator-ink);
}

.toefl-flash-creator .hidden,
.toefl-flash-creator [hidden] {
  display: none !important;
}

.toefl-flash-creator button,
.toefl-flash-creator input,
.toefl-flash-creator textarea {
  font: inherit;
}

.toefl-flash-creator-header {
  max-width: 780px;
  margin-bottom: 30px;
}

.toefl-flash-creator-header a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 22px;
  color: var(--toefl-creator-green);
  font-weight: 780;
  text-decoration: none;
}

.toefl-flash-creator-header a svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.toefl-flash-creator-header p,
.toefl-flash-creator-preview > div > p,
.toefl-flash-creator-section-heading p {
  margin: 0 0 7px;
  color: var(--toefl-creator-green);
  font-size: .74rem;
  font-weight: 850;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.toefl-flash-creator-header h1 {
  margin: 0;
  font-size: clamp(2.2rem, 5vw, 4.2rem);
  letter-spacing: -.055em;
  line-height: .98;
}

.toefl-flash-creator-header span {
  display: block;
  margin-top: 14px;
  color: var(--toefl-creator-muted);
  line-height: 1.65;
}

.toefl-flash-creator-auth:empty,
.toefl-flash-creator-form-state:empty,
.toefl-flash-creator-inline-state:empty {
  display: none;
}

.toefl-flash-creator-auth,
.toefl-flash-creator-form-state,
.toefl-flash-creator-inline-state {
  margin: 14px 0;
  padding: 13px 15px;
  border-radius: 12px;
  color: var(--toefl-creator-muted);
  background: var(--toefl-creator-cream);
}

.toefl-flash-creator-inline-state button {
  margin: 10px 8px 0 0;
  padding: 8px 11px;
  border: 1px solid var(--toefl-creator-green);
  border-radius: 8px;
  color: var(--toefl-creator-green);
  background: var(--toefl-creator-white);
  cursor: pointer;
}

.toefl-flash-creator-deck-form,
.toefl-flash-creator-card-form,
.toefl-flash-creator-preview {
  border: 1px solid var(--toefl-creator-line);
  border-radius: 22px;
  background: var(--toefl-creator-white);
  box-shadow: 0 18px 45px rgba(31, 73, 58, .08);
}

.toefl-flash-creator-deck-form {
  display: grid;
  gap: 22px;
  max-width: 720px;
  padding: clamp(24px, 5vw, 42px);
}

.toefl-flash-creator label {
  display: block;
  margin-bottom: 8px;
  font-size: .9rem;
  font-weight: 780;
}

.toefl-flash-creator label span,
.toefl-flash-creator-deck-form small {
  color: var(--toefl-creator-muted);
  font-weight: 500;
}

.toefl-flash-creator input,
.toefl-flash-creator textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid #cfd9d2;
  border-radius: 11px;
  color: var(--toefl-creator-ink);
  background: var(--toefl-creator-white);
}

.toefl-flash-creator input {
  min-height: 46px;
  padding: 10px 13px;
}

.toefl-flash-creator textarea {
  padding: 12px 13px;
  line-height: 1.55;
  resize: vertical;
}

.toefl-flash-creator input:focus,
.toefl-flash-creator textarea:focus,
.toefl-flash-creator button:focus,
.toefl-flash-creator a:focus,
.toefl-flash-creator summary:focus,
.toefl-flash-creator input:focus-visible,
.toefl-flash-creator textarea:focus-visible,
.toefl-flash-creator button:focus-visible,
.toefl-flash-creator a:focus-visible,
.toefl-flash-creator summary:focus-visible {
  outline: 2px solid var(--toefl-creator-green);
  outline-offset: 2px;
}

.toefl-flash-creator-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(320px, .82fr);
  gap: 24px;
  align-items: start;
}

.toefl-flash-creator-card-form {
  min-width: 0;
  overflow: hidden;
}

.toefl-flash-creator-card-form > section,
.toefl-flash-creator-media,
.toefl-flash-creator-card-form > .toefl-flash-creator-actions,
.toefl-flash-creator-card-form > .toefl-flash-creator-form-state {
  margin: 0;
  padding: 26px;
}

.toefl-flash-creator-card-form > section + section,
.toefl-flash-creator-media,
.toefl-flash-creator-card-form > .toefl-flash-creator-actions {
  border-top: 1px solid var(--toefl-creator-line);
}

.toefl-flash-creator-section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.toefl-flash-creator-section-heading h2,
.toefl-flash-creator-preview h2 {
  margin: 0;
  font-size: 1.35rem;
}

#toefl-flash-creator-petra {
  flex: 0 0 auto;
  padding: 9px 12px;
  border: 1px solid var(--toefl-creator-green);
  border-radius: 10px;
  color: var(--toefl-creator-green);
  font-weight: 780;
  background: var(--toefl-creator-white);
  cursor: pointer;
}

#toefl-flash-creator-petra span {
  display: inline;
  margin-left: 4px;
  padding: 2px 5px;
  border-radius: 999px;
  color: var(--toefl-creator-green-dark);
  font-size: .68rem;
  background: #dff0bc;
}

.toefl-flash-creator-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.toefl-flash-creator-field-grid .is-wide {
  grid-column: 1 / -1;
}

.toefl-flash-creator-media summary {
  cursor: pointer;
  font-weight: 800;
}

.toefl-flash-creator-media summary span,
.toefl-flash-creator-media > p {
  color: var(--toefl-creator-muted);
  font-weight: 500;
}

.toefl-flash-creator-image-search {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin: 18px 0;
}

.toefl-flash-creator-image-search button,
.toefl-flash-creator-actions button,
.toefl-flash-creator-actions a {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.toefl-flash-creator-image-search button,
.toefl-flash-creator-actions button {
  border: 1px solid var(--toefl-creator-green);
  color: var(--toefl-creator-white);
  background: var(--toefl-creator-green);
}

.toefl-flash-creator-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.toefl-flash-creator-actions a {
  color: var(--toefl-creator-green);
}

.toefl-flash-creator-image-results {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.toefl-flash-creator-image-results button {
  padding: 0;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 10px;
  background: var(--toefl-creator-cream);
  cursor: pointer;
}

.toefl-flash-creator-image-results img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.toefl-flash-creator-image-selected {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  gap: 12px;
  align-items: center;
  margin-top: 16px;
  padding: 12px;
  border-radius: 12px;
  background: var(--toefl-creator-cream);
}

.toefl-flash-creator-image-selected img {
  width: 120px;
  height: 82px;
  border-radius: 8px;
  object-fit: cover;
}

.toefl-flash-creator-image-selected button {
  border: 0;
  color: var(--toefl-creator-danger);
  background: transparent;
  cursor: pointer;
}

.toefl-flash-creator-preview {
  position: sticky;
  top: 24px;
  min-width: 0;
  padding: 24px;
}

.toefl-flash-creator-preview > article {
  margin-top: 18px;
  padding: 26px;
  border: 1px solid var(--toefl-creator-line);
  border-radius: 18px;
  background: linear-gradient(150deg, #fff 0%, #f4f8f5 100%);
}

.toefl-flash-creator-preview img {
  width: 100%;
  max-height: 210px;
  margin-bottom: 18px;
  border-radius: 12px;
  object-fit: cover;
}

.toefl-flash-creator-preview article > p:first-of-type {
  margin: 0 0 6px;
  color: var(--toefl-creator-green);
  font-size: .76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.toefl-flash-creator-preview h3 {
  overflow-wrap: anywhere;
  margin: 0;
  font-size: clamp(1.8rem, 5vw, 3rem);
  letter-spacing: -.04em;
}

.toefl-flash-creator-preview hr {
  margin: 24px 0;
  border: 0;
  border-top: 1px solid var(--toefl-creator-line);
}

.toefl-flash-creator-preview blockquote {
  margin: 18px 0;
  padding: 12px 16px;
  border-left: 3px solid var(--toefl-creator-green);
  color: var(--toefl-creator-muted);
  background: var(--toefl-creator-white);
}

.toefl-flash-creator-preview article > div {
  margin-top: 16px;
  padding: 13px;
  border-radius: 11px;
  background: var(--toefl-creator-mint);
}

.toefl-flash-creator-preview article > div p {
  margin: 5px 0 0;
}

.toefl-flash-creator-preview small {
  display: block;
  margin-top: 14px;
  color: var(--toefl-creator-muted);
}

@media (max-width: 860px) {
  .toefl-flash-creator-layout {
    grid-template-columns: 1fr;
  }

  .toefl-flash-creator-preview {
    position: static;
    grid-row: 1;
  }
}

@media (max-width: 520px) {
  .toefl-flash-creator {
    width: min(100% - 24px, 100%);
    padding: 24px 0 64px;
  }

  .toefl-flash-creator-field-grid,
  .toefl-flash-creator-image-search,
  .toefl-flash-creator-image-selected {
    grid-template-columns: 1fr;
  }

  .toefl-flash-creator-section-heading,
  .toefl-flash-creator-actions {
    align-items: stretch;
    flex-direction: column;
  }

  #toefl-flash-creator-petra,
  .toefl-flash-creator-actions a,
  .toefl-flash-creator-actions button,
  .toefl-flash-creator-image-search button {
    width: 100%;
  }

  .toefl-flash-creator-card-form > section,
  .toefl-flash-creator-media,
  .toefl-flash-creator-card-form > .toefl-flash-creator-actions,
  .toefl-flash-creator-preview,
  .toefl-flash-creator-deck-form {
    padding: 20px;
  }

  .toefl-flash-creator-image-results {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .toefl-flash-creator-image-selected img {
    width: 100%;
    height: auto;
  }
}

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