/* Home toys: quick-action palette, key chip, toast and the effects canvas (toys.js). */

.toys-fx {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 7;
  pointer-events: none;
}

.toy-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* The key chip that tells people the palette exists */
.toy-chip {
  position: fixed;
  right: calc(14px + env(safe-area-inset-right, 0px));
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  z-index: 6;
  display: inline-flex;
  gap: 4px;
  padding: 5px 7px;
  border: 1px solid rgba(45, 219, 240, 0.25);
  border-radius: 10px;
  background: rgba(8, 14, 26, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.toy-chip kbd {
  min-width: 20px;
  padding: 2px 5px;
  border-radius: 5px;
  background: rgba(45, 219, 240, 0.12);
  color: var(--ink, #d7f3fa);
  font: 11px/1.3 var(--mono, ui-monospace, Menlo, Consolas, monospace);
  text-align: center;
}

.toy-chip:hover,
.toy-chip:focus-visible {
  opacity: 1;
  border-color: rgba(45, 219, 240, 0.7);
  box-shadow: 0 0 14px rgba(45, 219, 240, 0.35);
  transform: translateY(-1px);
  outline: none;
}

/* The palette */
.toy-palette {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 14vh 16px 16px;
}

.toy-palette[hidden] {
  display: none;
}

.toy-palette-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 6, 12, 0.6);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.toy-palette-box {
  position: relative;
  width: min(560px, 100%);
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(45, 219, 240, 0.4);
  border-radius: 16px;
  background: linear-gradient(160deg, rgba(10, 18, 32, 0.96), rgba(5, 8, 16, 0.98));
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.65), 0 0 40px rgba(45, 219, 240, 0.12);
  color: var(--ink, #d7f3fa);
  font-family: var(--mono, ui-monospace, Menlo, Consolas, monospace);
}

.toy-palette-input {
  width: 100%;
  padding: 16px 18px;
  border: 0;
  border-bottom: 1px solid rgba(45, 219, 240, 0.2);
  background: transparent;
  color: inherit;
  font: 15px/1.4 var(--mono, ui-monospace, Menlo, Consolas, monospace);
  outline: none;
}

.toy-palette-input::placeholder {
  color: var(--muted, #5f8ea0);
}

.toy-palette-list {
  margin: 0;
  padding: 6px;
  list-style: none;
  overflow-y: auto;
}

.toy-palette-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 9px;
  font-size: 13px;
  cursor: pointer;
}

.toy-palette-list li[aria-selected="true"] {
  background: rgba(45, 219, 240, 0.16);
  box-shadow: inset 2px 0 0 #2ddbf0;
  color: #fff;
}

.toy-palette-kind {
  flex: none;
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid rgba(45, 219, 240, 0.25);
  color: var(--muted, #5f8ea0);
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.toy-palette-empty {
  margin: 0;
  padding: 18px;
  color: var(--muted, #5f8ea0);
  font-size: 13px;
  text-align: center;
}

.toy-palette-hint {
  margin: 0;
  padding: 8px 14px;
  border-top: 1px solid rgba(45, 219, 240, 0.14);
  color: var(--muted, #5f8ea0);
  font-size: 11px;
}

/* Toast */
.toy-toast {
  position: fixed;
  left: 50%;
  top: calc(64px + env(safe-area-inset-top, 0px));
  z-index: 91;
  transform: translate(-50%, -12px);
  padding: 9px 16px;
  border: 1px solid rgba(45, 219, 240, 0.5);
  border-radius: 999px;
  background: rgba(6, 11, 22, 0.94);
  color: #e2f4f8;
  font: 12px/1.4 var(--mono, ui-monospace, Menlo, Consolas, monospace);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toy-toast.is-on {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (prefers-reduced-motion: no-preference) {
  .toy-palette:not([hidden]) .toy-palette-box {
    animation: toy-pop 0.22s cubic-bezier(0.16, 1, 0.3, 1) backwards;
  }
  .toy-palette:not([hidden]) .toy-palette-backdrop {
    animation: toy-fade 0.2s ease backwards;
  }
}

@keyframes toy-pop {
  from { opacity: 0; transform: translateY(-10px) scale(0.97); }
}

@keyframes toy-fade {
  from { opacity: 0; }
}

@media (max-width: 640px) {
  .toy-palette { padding-top: 8vh; }
}
