/* Date night dice: three 3D CSS cubes on a tray, lock state, plan card, editor. */
.tool { --dd-size: 92px; --dd-half: 46px; }
.tool .dd-top { padding: 22px 8px 18px; border-radius: 28px; background: radial-gradient(120% 90% at 50% 0%, rgb(var(--accent) / .16), rgb(var(--accent) / .04) 70%); box-shadow: inset 0 0 0 1px rgb(var(--ink) / .05); }
.tool .dd-tray { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; justify-items: center; }
.tool .dd-slot { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.tool .dd-name { font-size: 12px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; color: rgb(var(--ink) / .55); }
.tool .dd-die { position: relative; width: var(--dd-size); height: var(--dd-size); padding: 0; border-radius: 22px; perspective: 520px; }
.tool .dd-die:focus-visible { outline: 3px solid rgb(var(--accent)); outline-offset: 6px; }
.tool .dd-scene { display: block; width: 100%; height: 100%; transform-style: preserve-3d; transform: rotateX(-9deg) rotateY(11deg); }
.tool .dd-slot:nth-child(2) .dd-scene { transform: rotateX(-9deg) rotateY(0deg); }
.tool .dd-slot:nth-child(3) .dd-scene { transform: rotateX(-9deg) rotateY(-11deg); }
.tool .dd-cube { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform 1.05s cubic-bezier(.2, .8, .25, 1.06); }
.tool .dd-cube:not(.is-rolling) { transition-duration: .5s; }
.tool .dd-face {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 8px; text-align: center; border-radius: 20px;
  background: var(--surface); color: rgb(var(--ink)); font-size: 16px; line-height: 19px; font-weight: 900; letter-spacing: -.01em;
  box-shadow: inset 0 0 0 1px rgb(var(--ink) / .08), inset 0 -6px 0 rgb(var(--ink) / .06); backface-visibility: hidden; -webkit-backface-visibility: hidden;
  overflow-wrap: normal; word-break: normal; hyphens: manual;
}
.tool .dd-face.is-long { font-size: 13.5px; line-height: 16px; }
.tool .dd-slot:nth-child(1) .dd-face { background: linear-gradient(160deg, var(--rz-1), var(--surface) 85%); }
.tool .dd-slot:nth-child(2) .dd-face { background: linear-gradient(160deg, var(--rz-3), var(--surface) 85%); }
.tool .dd-slot:nth-child(3) .dd-face { background: linear-gradient(160deg, var(--rz-4), var(--surface) 85%); }
.tool .dd-die::after { content: ""; position: absolute; left: 12%; right: 12%; bottom: -14px; height: 10px; border-radius: 50%; background: rgb(var(--ink) / .14); filter: blur(4px); z-index: -1; }
.tool .dd-slot.is-hop .dd-die { animation: dd-hop 1.05s cubic-bezier(.3, .7, .4, 1); }
@keyframes dd-hop { 0% { transform: translateY(0); } 22% { transform: translateY(-16px); } 48% { transform: translateY(0); } 62% { transform: translateY(-9px); } 76%, 100% { transform: translateY(0); } }
.tool .dd-lock { position: absolute; top: -8px; right: -8px; width: 26px; height: 26px; border-radius: 13px; display: grid; place-items: center; background: rgb(var(--ink)); color: var(--surface); transform: scale(.25); opacity: 0; filter: blur(4px); transition: transform .2s cubic-bezier(.2, 0, 0, 1), opacity .2s cubic-bezier(.2, 0, 0, 1), filter .2s cubic-bezier(.2, 0, 0, 1); z-index: 2; }
.tool .dd-slot.is-locked .dd-lock { transform: none; opacity: 1; filter: none; }
.tool .dd-slot.is-locked .dd-die { box-shadow: 0 0 0 3px rgb(var(--ink)); }
.tool .dd-slot.is-locked .dd-name { color: rgb(var(--ink)); }

.tool .dd-plan { min-height: 132px; padding: 22px; }
.tool .dd-plan .dd-sentence { font-size: 22px; line-height: 30px; font-weight: 900; color: rgb(var(--ink)); text-wrap: balance; margin: 0; }
.tool .dd-plan small { font-size: 15px; line-height: 22px; font-weight: 650; margin-top: 10px; color: rgb(var(--ink) / .62); text-wrap: pretty; }
.tool .dd-empty { margin: 0; font-size: 20px; line-height: 28px; font-weight: 900; color: rgb(var(--ink)); }
.tool .dd-after { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.tool .dd-after .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; padding: 0 10px; font-size: 15px; width: 100%; }
.tool .dd-after .btn svg { width: 18px; height: 18px; flex: 0 0 auto; }
.tool .dd-hint { text-align: center; margin-top: -4px; }
.tool .dd-setrow { display: flex; flex-direction: column; gap: 8px; }
.tool .dd-sets .dd-edit { box-shadow: inset 0 0 0 1.5px rgb(var(--accent) / .5); color: var(--link); background: transparent; }
.tool .dd-editor { display: flex; flex-direction: column; gap: 12px; padding: 18px; border-radius: 20px; background: var(--surface); }
.tool .dd-cols { display: grid; grid-template-columns: 1fr; gap: 12px; }
.tool .dd-col { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.tool .dd-col legend { font-size: 13px; font-weight: 850; text-transform: uppercase; letter-spacing: .06em; color: rgb(var(--ink) / .6); margin-bottom: 6px; }
.tool .dd-col input { min-height: 44px; padding: 8px 12px; font-size: 16px; }
.tool .dd-hlist { display: grid; gap: 6px; margin-top: 8px; }
.tool .dd-hlist li { display: grid; grid-template-columns: 52px 1fr; gap: 8px; padding: 10px 14px; border-radius: 14px; background: var(--surface); font-size: 14px; line-height: 20px; }
.tool .dd-hd { font-weight: 850; color: rgb(var(--ink) / .5); }
@media (min-width: 600px) {
  .tool { --dd-size: 120px; --dd-half: 60px; }
  .tool .dd-face { font-size: 19px; line-height: 23px; } .tool .dd-face.is-long { font-size: 16px; line-height: 19px; }
  .tool .dd-cols { grid-template-columns: repeat(3, 1fr); }
  .tool .dd-col { grid-template-columns: 1fr; }
  .tool .dd-plan .dd-sentence { font-size: 26px; line-height: 34px; }
}
@media (max-width: 360px) { .tool { --dd-size: 80px; --dd-half: 40px; } .tool .dd-after2 .btn { font-size: 13px; } .tool .dd-after2 .btn svg { display: none; } }
@media (prefers-reduced-motion: reduce) { .tool .dd-cube { transition: none; } .tool .dd-slot.is-hop .dd-die { animation: none; } }
.tool .dd-cube, .tool .dd-face, .tool .dd-scene { pointer-events: none; }
.tool .dd-top { position: relative; z-index: 0; }

/* Round 2: only the front face shows its label at rest (no slivers from side faces), faint locks, accept as the main action */
.tool .dd-cube:not(.is-rolling) .dd-face:not(.is-front) { visibility: hidden; }
.tool .dd-cube.is-rolling .dd-face { color: transparent; }
.tool .dd-face { transition: color .18s ease; }
.tool .dd-face.is-xlong { font-size: 12px; line-height: 14px; padding: 6px; }
.tool .dd-hint { margin: 14px 0 0; }
.tool .dd-after { grid-template-columns: 1fr; }
.tool .dd-after2 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.tool .dd-after2 .btn { font-size: 14px; padding: 0 6px; }
.tool .dd-roll[hidden] { display: none; }
.tool .dd-name { position: relative; z-index: 3; }
.tool .dd-can { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; margin: 12px 0 0; }
.tool .dd-can li { display: flex; align-items: center; gap: 6px; font-size: 14px; line-height: 18px; font-weight: 750; color: rgb(var(--ink) / .7); }
.tool .dd-can svg { width: 16px; height: 16px; color: rgb(var(--accent)); flex: 0 0 auto; }
.tool .dd-tpl { margin-top: -2px; }
.tool .dd-setrow .tool-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -4px; padding: 2px 4px; }
.tool .dd-setrow .tool-chips::-webkit-scrollbar { display: none; }
.tool .dd-setrow .tool-chips > button { flex: 0 0 auto; white-space: nowrap; }
.tool .dd-roll .btn.is-quiet { background: var(--surface); color: rgb(var(--ink)); box-shadow: inset 0 0 0 2px rgb(var(--accent) / .55); }
.tool .dd-roll .btn.is-quiet:not(:disabled):hover { box-shadow: inset 0 0 0 2px rgb(var(--accent)); }
.tool .dd-sentence { animation: dd-up .22s cubic-bezier(.2, 0, 0, 1) both; }
@keyframes dd-up { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-color-scheme: dark) {
  .tool .dd-after .btn-secondary, .tool .dd-editor .btn-secondary { box-shadow: inset 0 0 0 1px rgb(var(--ink) / .3); }
  .tool .dd-roll .btn.is-quiet { box-shadow: inset 0 0 0 2px rgb(var(--accent) / .8); }
}
@media (min-width: 600px) { .tool .dd-face.is-xlong { font-size: 15px; line-height: 18px; } }
@media (prefers-reduced-motion: reduce) { .tool .dd-sentence { animation: none; } }
.tool .dd-can li { text-align: left; }
.tool .dd-plan .dd-can { justify-content: start; }
/* Round 4: concentric lock ring, wrapped set chips on phones, smaller plan line */

.tool .dd-lock { top: auto; bottom: -10px; right: 50%; margin-right: -13px; }
.tool .dd-plan .tool-cta { margin: 12px 0 0; font-size: 14px; }
@media (max-width: 599px) {
  .tool .dd-setrow .tool-chips { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; }
  .tool .dd-plan .dd-sentence { font-size: 20px; line-height: 27px; }
}
.tool .dd-slot.is-locked .dd-die { box-shadow: none; }
.tool .dd-slot.is-locked .dd-face.is-front { box-shadow: inset 0 0 0 3px rgb(var(--ink)), inset 0 -6px 0 rgb(var(--ink) / .06); }
/* Round 5: the roll stays inside the tray, more air between dice, one scrolling set row with an edge fade */
.tool .dd-top { overflow: clip; }
.tool .dd-tray { gap: 14px; }
.tool .dd-face.is-xlong { font-size: 13px; line-height: 15px; }
@media (max-width: 599px) {
  .tool { --dd-size: 88px; --dd-half: 44px; }
  .tool .dd-setrow .tool-chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 -4px; padding: 2px 4px; -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
}
/* Round 7: the roll shrinks inside the tray and hides the labels, crisp solid faces, straight locked die with the badge
   top right, wrapped set chips with a one-line set note, an edit link on the tray, a deliberate fourth re-roll. */
.tool .dd-setrow .tool-chips, .tool .dd-setrow .tool-chips[class] { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; -webkit-mask-image: none; mask-image: none; }
@media (max-width: 599px) {
  .tool { --dd-size: 90px; --dd-half: 45px; }
  .tool .dd-tray { gap: 10px; }
  .tool .dd-setrow .tool-chips { gap: 6px; }
  .tool .dd-setrow .tool-chips > button { min-height: 40px; padding: 0 12px; font-size: 14px; }
  .tool .dd-after2 .btn svg { display: none; }
}
.tool .dd-tag { margin: 2px 0 0; font-size: 14px; line-height: 20px; font-weight: 700; color: rgb(var(--ink) / .72); }
.tool .dd-name, .tool .dd-hint { color: rgb(var(--ink) / .74); transition: opacity .15s ease; }
.tool .dd-top.is-rolling .dd-name, .tool .dd-top.is-rolling .dd-hint { opacity: 0; }
.tool .dd-scene, .tool .dd-slot:nth-child(2) .dd-scene, .tool .dd-slot:nth-child(3) .dd-scene { transform: rotateX(-7deg); transition: transform .3s cubic-bezier(.2, 0, 0, 1); }
.tool .dd-die { perspective: 900px; }
.tool .dd-top.is-rolling .dd-scene { transform: scale(.74); }
.tool .dd-slot.is-hop .dd-die { animation-name: dd-hop2; }
@keyframes dd-hop2 { 0% { transform: translateY(0); } 25% { transform: translateY(-8px); } 50% { transform: translateY(0); } 64% { transform: translateY(-4px); } 78%, 100% { transform: translateY(0); } }
.tool .dd-slot:nth-child(1) .dd-face { background: var(--rz-1); }
.tool .dd-slot:nth-child(2) .dd-face { background: var(--rz-3); }
.tool .dd-slot:nth-child(3) .dd-face { background: var(--rz-4); }
.tool .dd-face { color: rgb(var(--rz-ink)); text-shadow: none; -webkit-font-smoothing: antialiased; }
.tool .dd-slot.is-locked .dd-scene { transform: none; }
.tool .dd-slot.is-locked .dd-lock { top: -9px; right: -9px; bottom: auto; margin: 0; }
.tool .dd-slot.is-locked .dd-die { animation: dd-settle .22s cubic-bezier(.2, 0, 0, 1); }
@keyframes dd-settle { 50% { transform: scale(.95); } }
.tool .dd-editrow { display: flex; justify-content: center; margin-top: -6px; }
.tool .dd-editlink { min-height: 44px; padding: 0 12px; font-size: 15px; font-weight: 800; color: var(--link); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1.5px; background: transparent; }
.tool .dd-plan .dd-can { padding: 0; list-style: none; margin: 0; }
.tool .dd-plan:has(.dd-can) { min-height: 0; padding: 18px 20px; }
.tool .dd-after .btn.is-over { box-shadow: inset 0 0 0 1.5px rgb(var(--ink) / .2); color: rgb(var(--ink) / .7); background: transparent; }
.tool .dd-hlist li { grid-template-columns: 52px 1fr 32px; align-items: center; }
.tool .dd-hist .dd-editlink { padding: 0; margin-top: 4px; }
@media (min-width: 600px) { .tool .dd-plan .dd-can { grid-template-columns: repeat(4, auto); justify-content: center; } }
@media (prefers-reduced-motion: reduce) { .tool .dd-scene { transition: none; } .tool .dd-slot.is-locked .dd-die { animation: none; } }
