.dice-launcher {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 20;
  box-shadow: 0 5px 25px #0008;
}

.dice-tray {
  position: fixed;
  right: 20px;
  bottom: 76px;
  z-index: 21;
  width: 360px;
  max-width: calc(100vw - 16px);
  display: flex;
  flex-direction: column;
  max-height: 33vh;
  max-height: 33dvh;
  overflow: hidden;
  border: 1px solid var(--cyan);
  border-radius: 6px;
  background: var(--panel);
  box-shadow: 0 12px 48px #000a;
  color: var(--ink);
  font: 14px/1.5 var(--sans);
}

.dice-tray[hidden], .dice-launcher[hidden], .dice-content[hidden], .dice-error[hidden], #dice-empty[hidden] { display: none; }
.dice-handle {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: #173039;
  cursor: move;
  touch-action: none;
  user-select: none;
}
.dice-handle h2 { margin: 0; font: 600 18px var(--serif); color: var(--cyan); }
.dice-window-actions { display: flex; gap: 5px; }
.dice-window-actions button {
  width: 34px;
  height: 34px;
  padding: 0;
  background: transparent;
  color: var(--cyan);
  border-color: var(--line);
  font-size: 22px;
}
.dice-content { padding: 10px; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.dice-entry { display: flex; gap: 8px; margin-top: 5px; }
.dice-entry input { min-width: 0; width: 100%; padding: 8px; }
.dice-entry button { padding: 8px 12px; }
.dice-shortcuts { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 12px; }
.dice-shortcuts button { padding: 4px 9px; font-size: 12px; }
.dice-help { color: var(--muted); font-size: 12px; margin: 10px 0; }
.dice-error { color: #ffc8b7; margin: 8px 0; }
.dice-log-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dice-log-heading h3 { margin: 8px 0; font-size: 14px; }
.dice-log-heading button { padding: 4px 8px; font-size: 12px; background: transparent; color: var(--cyan); }
.dice-rolls { margin: 0; padding: 0; list-style: none; }
.dice-rolls li { border-top: 1px solid var(--line); padding: 9px 0; overflow-wrap: anywhere; }
.dice-rolls strong { color: var(--cyan); }
.dice-roll-details { color: var(--muted); font-size: 12px; margin-top: 3px; }
.dice-announcement { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); margin: 0; }
@media(max-width: 600px) {
  .dice-launcher { right: 12px; bottom: 12px; padding: 9px 14px; }
  .dice-tray { right: 8px; bottom: 68px; width: 340px; }
}
