:root {
  --red: #da1a21;
  --red-dark: #b31219;
  --ink: #172033;
  --muted: #687386;
  --line: #d7dee8;
  --surface: #fff;
}

button, input, select { font: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }

.topics-shell {
  display: grid;
  align-content: start;
  grid-template-rows: minmax(21rem, 48dvh) auto auto;
  gap: .7rem;
}

.cloud-section {
  display: grid;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.submission-section { min-height: 0; padding: .9rem; }

.topics-shell .section-heading {
  display: flex;
  min-height: 4rem;
  align-items: center;
  justify-content: space-between;
  gap: .8rem;
  border-bottom: 1px solid var(--line);
  padding: .7rem .85rem;
}

.topics-shell .section-heading h2,
.submission-section h2 { margin: 0; font-size: 1rem; }
.topics-shell .section-heading p { margin: .15rem 0 0; color: var(--muted); font-size: .72rem; }

.refresh-button {
  display: grid;
  width: 2.75rem;
  height: 2.75rem;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: .625rem;
  color: #344054;
  background: #fff;
}

.refresh-button:hover { background: #f6f7f9; }
.refresh-button svg { width: 1.15rem; height: 1.15rem; }

.cloud-stage { position: relative; min-height: 0; overflow: hidden; background: #fbfbfc; }
.cloud-list { position: absolute; inset: 0; margin: 0; padding: 0; list-style: none; }

.cloud-term {
  position: absolute;
  top: 0;
  left: 0;
  max-width: calc(100% - 1rem);
  padding: .12rem .25rem;
  font-weight: 760;
  line-height: 1.08;
  white-space: nowrap;
  user-select: none;
  will-change: transform;
}

.cloud-term button { border: 0; padding: 0; color: inherit; background: transparent; font: inherit; font-weight: inherit; line-height: inherit; }
.cloud-term button:focus-visible { border-radius: .2rem; outline: 2px solid currentColor; outline-offset: 3px; }
.cloud-term:nth-child(6n+1) { color: #b31219; }
.cloud-term:nth-child(6n+2) { color: #245a83; }
.cloud-term:nth-child(6n+3) { color: #3e6a43; }
.cloud-term:nth-child(6n+4) { color: #70448a; }
.cloud-term:nth-child(6n+5) { color: #8a5315; }
.cloud-term:nth-child(6n) { color: #344054; }

.cloud-notice {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 2rem;
  color: var(--muted);
  font-size: .82rem;
  text-align: center;
}

.submission-section form { display: grid; gap: .65rem; margin-top: .8rem; }
.submission-section label span { display: block; margin-bottom: .3rem; color: #344054; font-size: .72rem; font-weight: 700; }

.submission-section input {
  width: 100%;
  min-height: 3rem;
  border: 1px solid #c9d0da;
  border-radius: .625rem;
  padding: .6rem .7rem;
  color: var(--ink);
  background: #fff;
}

.submission-section form > button,
.identity-dialog form > button {
  min-height: 3rem;
  border: 1px solid var(--red-dark);
  border-radius: .625rem;
  padding: .6rem .8rem;
  color: #fff;
  background: var(--red);
  font-weight: 750;
}

.form-status { margin: .7rem 0 0; border: 1px solid #87c79b; border-radius: .625rem; padding: .55rem .65rem; color: #166534; background: #f0fdf4; font-size: .75rem; }
.form-status.is-error { border-color: #efabab; color: #991b1b; background: #fff1f2; }

.identity-dialog { width: min(28rem, calc(100% - 1.25rem)); border: 0; padding: 0; color: var(--ink); background: #fff; }
.identity-dialog::backdrop { background: rgba(15, 23, 42, .62); }
.identity-heading { display: flex; min-height: 3.8rem; align-items: center; justify-content: space-between; gap: 1rem; border-bottom: 1px solid var(--line); padding: .75rem 1rem; }
.identity-heading h2 { margin: 0; font-size: 1rem; }
.dialog-close { display: grid; width: 2.75rem; height: 2.75rem; place-items: center; border: 1px solid var(--line); border-radius: .625rem; padding: 0; color: #566174; background: #fff; }
.dialog-close svg { width: 1.05rem; height: 1.05rem; }
.identity-dialog form { padding: .9rem 1rem 1rem; }
.identity-dialog form > p:first-child { margin: 0 0 .8rem; color: var(--muted); font-size: .78rem; }
.identity-dialog label span { display: block; margin-bottom: .3rem; color: #344054; font-size: .75rem; font-weight: 700; }
.identity-dialog input { width: 100%; min-height: 3rem; border: 1px solid #c9d0da; border-radius: .625rem; padding: .6rem .7rem; }
.identity-dialog form > button { width: 100%; margin-top: .8rem; }
.identity-error { margin: .55rem 0 0; color: #991b1b; font-size: .75rem; }

.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (min-width: 560px) and (max-width: 899px) {
  .submission-section form { grid-template-columns: minmax(0, 1fr) auto; align-items: end; }
}

@media (min-width: 900px) {
  .topics-shell {
    grid-template-rows: minmax(34rem, 1fr) auto;
    grid-template-columns: minmax(0, 2fr) minmax(19rem, .8fr);
    gap: 1.25rem;
  }

  .cloud-section { grid-row: 1 / span 2; }
  .submission-section { align-self: start; }
  .submission-section form { grid-template-columns: 1fr; }
  .topics-shell > .powered-by { grid-column: 2; }
}

@media (max-height: 640px) and (max-width: 899px) {
  .topics-shell { grid-template-rows: minmax(17rem, 43dvh) auto auto; gap: .45rem; padding-top: .45rem; }
  .topics-shell .section-heading { min-height: 3.25rem; padding: .45rem .65rem; }
  .submission-section { padding: .6rem; }
  .submission-section form { grid-template-columns: minmax(0, 1fr) auto; gap: .45rem; margin-top: .5rem; }
  .submission-section :where(input, button) { min-height: 2.75rem; }
  .form-status { margin-top: .4rem; padding-block: .35rem; }
}

@media (prefers-reduced-motion: reduce) {
  .cloud-list { display: flex; align-content: center; align-items: center; justify-content: center; flex-wrap: wrap; gap: .65rem 1rem; padding: 1.25rem; overflow: hidden; }
  .cloud-term { position: static; transform: none !important; will-change: auto; }
}
