/* Settings, the being card and the Crumb Log. Owner: J34. One shell, never modal, nothing behind them is dimmed. */
.panel {
  position: absolute;
  right: calc(env(safe-area-inset-right) + 14px);
  top: calc(env(safe-area-inset-top) + 80px);
  z-index: 31;
  width: min(440px, calc(100vw - 28px - env(safe-area-inset-left) - env(safe-area-inset-right)));
  max-height: calc(100vh - 108px - env(safe-area-inset-top));
  max-height: calc(100dvh - 108px - env(safe-area-inset-top));
  display: flex; flex-direction: column;
  border-radius: 26px;
  background: rgba(251, 240, 226, .96);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .55), 0 12px 34px rgba(74, 63, 74, .2);
  color: var(--ink);
  pointer-events: auto;
  visibility: hidden;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity .24s ease, transform .24s ease, visibility 0s linear .24s;
}
.panel.panel-open {
  visibility: visible;
  opacity: 1;
  transform: none;
  transition: opacity .24s ease, transform .24s ease, visibility 0s;
}
.calm .panel, .calm .panel-open { transition-duration: .001s; transition-delay: 0s; transform: none; }

.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 8px 2px 20px;
  flex: none;
}
.panel-title { margin: 0; font: 800 20px/1.2 var(--font); }
.panel-close {
  display: flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; padding: 0;
  border: 0; border-radius: 50%;
  background: transparent;
  cursor: pointer;
  transition: background-color .2s ease;
}
.panel-close:hover { background: rgba(255, 255, 255, .7); }
.panel-body { padding: 4px 16px 16px; overflow-y: auto; overscroll-behavior: contain; }
.panel button:focus-visible, .panel input:focus-visible { outline: 3px solid #b77a9b; outline-offset: 2px; }

/* Settings */
.set-row { margin-top: 12px; }
.set-label { display: block; margin: 0 2px 6px; font: 700 16px/1.25 var(--font); }
.set-hint { display: block; margin-top: 1px; font: 500 14px/1.25 var(--font); opacity: .72; }
.set-choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.set-choice {
  min-height: 48px; padding: 6px;
  border: 0; border-radius: 15px;
  background: rgba(255, 255, 255, .62);
  color: var(--ink);
  font: 600 15px/1.15 var(--font);
  cursor: pointer;
  transition: background-color .2s ease, box-shadow .2s ease;
}
.set-choice:hover { background: rgba(255, 255, 255, .95); }
.set-choice[aria-pressed="true"] { background: #ffe9ae; box-shadow: inset 0 0 0 2.5px #f5c869; }

.set-toggle {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; min-height: 56px; padding: 7px 12px 7px 14px;
  border: 0; border-radius: 16px;
  background: rgba(255, 255, 255, .55);
  color: var(--ink);
  font-family: var(--font);
  text-align: left;
  cursor: pointer;
  transition: background-color .2s ease;
}
.set-toggle:hover { background: rgba(255, 255, 255, .92); }
.set-toggle .set-label { margin: 0; }
.set-words { flex: 1; }
.set-pill {
  position: relative; flex: none;
  width: 52px; height: 30px;
  border-radius: 15px;
  background: #d9cdbc;
  transition: background-color .22s ease;
}
.set-pill::after {
  content: '';
  position: absolute; top: 3px; left: 3px;
  width: 24px; height: 24px; border-radius: 50%;
  background: #fffdf8;
  box-shadow: 0 1px 3px rgba(74, 63, 74, .24);
  transition: transform .22s ease;
}
.set-toggle[aria-checked="true"] .set-pill { background: #9fcf86; }
.set-toggle[aria-checked="true"] .set-pill::after { transform: translateX(22px); }

.set-slider-row { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.set-slider-row .set-label { flex: none; width: 118px; margin: 0 2px; }
.set-range {
  flex: 1; min-width: 0; height: 48px; margin: 0;
  background: transparent; cursor: pointer;
  -webkit-appearance: none; appearance: none;
}
.set-range::-webkit-slider-runnable-track { height: 8px; border-radius: 4px; background: #e2d6c4; }
.set-range::-moz-range-track { height: 8px; border-radius: 4px; background: #e2d6c4; }
.set-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 26px; height: 26px; margin-top: -9px;
  border-radius: 50%;
  background: #9fcf86;
  box-shadow: 0 0 0 3px #fffaf2, 0 2px 6px rgba(74, 63, 74, .25);
}
.set-range::-moz-range-thumb {
  width: 26px; height: 26px; border: 0;
  border-radius: 50%;
  background: #9fcf86;
  box-shadow: 0 0 0 3px #fffaf2, 0 2px 6px rgba(74, 63, 74, .25);
}

.set-actions { display: grid; gap: 7px; margin-top: 14px; }
.set-action {
  min-height: 50px; padding: 8px 12px;
  border: 0; border-radius: 16px;
  background: rgba(255, 255, 255, .62);
  color: var(--ink);
  font: 600 16px/1.15 var(--font);
  cursor: pointer;
  transition: background-color .2s ease;
}
.set-action:hover { background: rgba(255, 255, 255, .95); }
.set-message { margin: 10px 2px 0; font: italic 500 15px/1.3 var(--font); opacity: .85; }
.set-message:empty { display: none; }
.set-file { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* Crumb Log */
.panel-log .log-list { list-style: none; margin: 4px 0 0; padding: 0; }
.log-item {
  padding: 9px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .5);
  font: italic 500 16px/1.3 var(--font);
  user-select: text; -webkit-user-select: text;
}
.log-item + .log-item { margin-top: 6px; }
.log-empty { display: none; margin: 8px 4px 2px; font: italic 500 16px/1.3 var(--font); opacity: .75; }
.log-empty.show { display: block; }

/* The being card */
.panel-card .panel-title { display: none; }
.panel-card .panel-head { position: absolute; top: 2px; right: 0; padding: 4px; }
.panel-card .panel-body { display: flex; gap: 14px; padding: 16px; }
.card-art {
  flex: none;
  width: 118px; height: 118px;
  border-radius: 22px;
  overflow: hidden;
  background: linear-gradient(#cfe8f5, #f7efe2);
}
.card-art svg { display: block; width: 100%; height: 100%; }
.card-words { flex: 1; min-width: 0; padding-right: 26px; }
.card-name-row { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; }
.card-name { margin: 0; font: 800 23px/1.15 var(--font); overflow-wrap: anywhere; }
.card-rename, .card-keep {
  min-height: 48px; padding: 4px 13px;
  border: 0; border-radius: 15px;
  background: rgba(255, 255, 255, .62);
  color: var(--ink);
  font: 600 15px/1.1 var(--font);
  cursor: pointer;
}
.card-rename:hover, .card-keep:hover { background: rgba(255, 255, 255, .95); }
.card-edit-row { display: none; gap: 6px; }
.card-editing .card-edit-row { display: flex; }
.card-editing .card-name-row { display: none; }
.card-name-field {
  flex: 1; min-width: 0; height: 48px; padding: 0 12px;
  border: 0; border-radius: 14px;
  background: #fff;
  box-shadow: inset 0 0 0 2px #e8c97a;
  color: var(--ink);
  font: 700 18px/1.1 var(--font);
  user-select: text; -webkit-user-select: text;
}
.card-nick { display: none; margin: 1px 0 0; font: italic 600 15px/1.25 var(--font); opacity: .78; }
.card-nick.show { display: block; }
.card-species { margin: 4px 0 0; font: 600 15px/1.3 var(--font); opacity: .86; }
.card-species.crayon { opacity: 1; color: #b06a54; font-size: 16px; font-weight: 700; transform: rotate(-1.2deg); transform-origin: left center; }
.crayon-strike { position: relative; color: #8f8383; font-weight: 600; }
.crayon-strike::after {
  content: '';
  position: absolute; left: -3px; right: -3px; top: 52%;
  height: 4px; border-radius: 3px;
  background: #f08a7a;
  transform: rotate(-3deg);
}
.card-rows { margin: 9px 0 0; }
.card-row { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; }
.card-key { font: 500 14px/1.25 var(--font); opacity: .7; }
.card-value { margin: 0; font: 700 14px/1.25 var(--font); text-align: right; }

/* Phones: the card goes full width at the top, smaller art, so the ring and the joystick stay free. */
@media (max-width: 480px) {
  .panel { left: calc(env(safe-area-inset-left) + 14px); right: calc(env(safe-area-inset-right) + 14px); width: auto; }
  .card-art { width: 84px; height: 84px; border-radius: 18px; }
  .panel-card .panel-body { gap: 10px; padding: 12px; }
  .card-name { font-size: 20px; }
  .card-row { padding: 1px 0; }
}
