.ideart-page {
  height: 100dvh;
  overflow: hidden;
}

.ideart-layout {
  position: relative;
  z-index: 70;
  pointer-events: none;
}

.ideart-header {
  pointer-events: auto;
}

.ideart-surface {
  position: fixed;
  inset: 0;
  z-index: 1;
  overflow: hidden;
}

.ideart-sticker {
  position: absolute;
  top: var(--sticker-y);
  left: var(--sticker-x);
  z-index: var(--sticker-z);
  display: block;
  width: var(--sticker-width);
  color: #29261f;
  cursor: pointer;
  filter:
    drop-shadow(3px 0 0 #fffdf6)
    drop-shadow(-3px 0 0 #fffdf6)
    drop-shadow(0 3px 0 #fffdf6)
    drop-shadow(0 -3px 0 #fffdf6)
    drop-shadow(0 12px 10px rgba(28, 24, 17, 0.28));
  transform: rotate(var(--sticker-rotation));
  transform-origin: center;
  transition: filter 180ms ease, transform 180ms ease;
  -webkit-user-select: none;
  user-select: none;
}

.ideart-sticker:hover,
.ideart-sticker:focus-visible {
  z-index: 60;
  color: #29261f;
  text-decoration: none;
  filter:
    drop-shadow(4px 0 0 #fffdf6)
    drop-shadow(-4px 0 0 #fffdf6)
    drop-shadow(0 4px 0 #fffdf6)
    drop-shadow(0 -4px 0 #fffdf6)
    drop-shadow(0 18px 13px rgba(28, 24, 17, 0.34));
  transform: rotate(var(--sticker-rotation)) translateY(-7px) scale(1.025);
}

.ideart-sticker:focus-visible {
  outline: 4px solid var(--accent);
  outline-offset: 10px;
  border-radius: 18px;
}

.ideart-art,
.ideart-sticker-image {
  display: block;
  width: 100%;
}

.ideart-art {
  position: relative;
}

.ideart-sticker-image {
  height: auto;
  pointer-events: none;
}

.ideart-sticker.is-latest .ideart-art::after {
  position: absolute;
  inset: 0;
  content: "";
  pointer-events: none;
  -webkit-mask: var(--sticker-image) center / contain no-repeat;
  mask: var(--sticker-image) center / contain no-repeat;
}

.ideart-sticker.is-latest .ideart-art::after {
  z-index: 1;
  opacity: 0.82;
  background: repeating-linear-gradient(
    118deg,
    rgba(255, 32, 147, 0.8) 0%,
    rgba(255, 198, 45, 0.78) 10%,
    rgba(133, 255, 110, 0.74) 20%,
    rgba(35, 239, 255, 0.82) 30%,
    rgba(70, 116, 255, 0.78) 40%,
    rgba(207, 63, 255, 0.8) 50%,
    rgba(255, 32, 147, 0.8) 60%
  );
  background-size: 230% 230%;
  background-position: 0% 50%;
  filter: saturate(1.35) contrast(1.08);
  mix-blend-mode: screen;
  animation: ideart-hologram 7s ease-in-out infinite alternate;
}

@keyframes ideart-hologram {
  from { background-position: 0% 20%; }
  to { background-position: 100% 80%; }
}

.ideart-warning {
  position: fixed;
  bottom: 18px;
  left: 18px;
  z-index: 90;
  max-width: min(430px, calc(100vw - 36px));
  padding: 12px 16px;
  border: 1px solid #d4a72c;
  border-radius: 10px;
  background: #fff8c5;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
  color: #4d3b00;
  font-size: 0.8rem;
}

.ideart-warning strong,
.ideart-warning span {
  display: block;
}

.ideart-warning ul {
  margin: 7px 0 0;
  padding-left: 20px;
  font-family: var(--mono);
  font-size: 0.72rem;
}

.ideart-empty {
  position: absolute;
  inset: 50% auto auto 50%;
  margin: 0;
  color: var(--muted);
  font-family: "Permanent Marker", cursive;
  transform: translate(-50%, -50%) rotate(-2deg);
}

.ideart-workbench {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 100;
  width: min(310px, calc(100vw - 36px));
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.2);
  font-size: 0.78rem;
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.ideart-workbench-heading {
  display: grid;
  margin-bottom: 10px;
}

.ideart-workbench-heading strong {
  font-size: 0.95rem;
}

.ideart-workbench-heading span,
.ideart-workbench p {
  color: var(--muted);
}

.ideart-workbench label {
  display: grid;
  grid-template-columns: 38px 1fr;
  align-items: center;
  gap: 8px;
  margin: 5px 0;
}

.ideart-workbench input {
  width: 100%;
}

.ideart-workbench-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.ideart-workbench button {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--code-bg);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-weight: 600;
}

.ideart-workbench button:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.ideart-workbench button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.ideart-workbench p {
  margin: 9px 0 0;
  line-height: 1.25;
}

.ideart-surface[data-development="true"] .ideart-sticker {
  touch-action: none;
}

.ideart-surface[data-development="true"] .ideart-sticker.is-selected {
  outline: 2px dashed #2769db;
  outline-offset: 9px;
}

.ideart-dialog {
  width: min(760px, calc(100vw - 36px));
  max-height: min(88vh, 920px);
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 18px;
  background: var(--bg);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.38);
  color: var(--text);
}

.ideart-dialog::backdrop {
  background: rgba(17, 15, 11, 0.72);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
}

.ideart-dialog-card {
  max-height: min(88vh, 920px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.ideart-dialog-card > header {
  padding: 38px 54px 6px;
}

.ideart-dialog-card > header time {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.75rem;
  text-transform: uppercase;
}

.ideart-dialog-card > header h2 {
  margin: 5px 0 0;
  font-size: 2rem;
  font-weight: 800;
}

.ideart-dialog-close {
  position: absolute;
  top: 13px;
  right: 17px;
  z-index: 1;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--code-bg);
  color: var(--text);
  cursor: pointer;
  font-size: 1.65rem;
  line-height: 1;
}

.ideart-dialog-close:hover {
  background: var(--border);
}

.ideart-dialog-content {
  min-height: 130px;
  padding: 10px 54px 34px;
  background: var(--bg);
  color: var(--text);
}

.ideart-dialog-content[data-loading="true"] {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-family: var(--sans);
  font-style: italic;
}

html:has(.ideart-dialog[open]) {
  overflow: hidden;
}

@media (max-width: 760px) {
  .ideart-surface {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(var(--mobile-rows), minmax(0, 1fr));
    gap: 18px 12px;
    box-sizing: border-box;
    padding: 145px 22px 34px;
  }

  .ideart-sticker {
    position: relative;
    top: auto;
    left: auto;
    align-self: stretch;
    justify-self: stretch;
    width: 100%;
    height: 100%;
  }

  .ideart-art {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 78%;
  }

  .ideart-sticker-image {
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 100%;
    object-fit: contain;
  }

  .ideart-sticker:last-of-type:nth-of-type(odd) {
    grid-column: 1 / -1;
    justify-self: center;
    width: 50%;
  }

  .ideart-dialog-card > header,
  .ideart-dialog-content {
    padding-right: 24px;
    padding-left: 24px;
  }

  .ideart-dialog-content {
    font-size: 17px;
  }
}

@media (max-width: 430px) {
  .ideart-surface {
    padding: 125px 14px 24px;
  }

  .ideart-workbench {
    right: 10px;
    bottom: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ideart-sticker,
  .ideart-sticker.is-latest .ideart-art::after {
    animation: none;
    transition: none;
  }
}
