* { box-sizing: border-box; }
:root {
  color-scheme: light;
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif;
  color: #1d1d1f;
  background: #f5f5f7;
  --blue: #0066cc;
  --muted: #515154;
  --line: #d2d2d7;
}
body { margin: 0; }
[hidden] { display: none !important; }
header { background: #fff; border-bottom: 1px solid #e8e8ed; }
.topbar {
  min-height: 60px; max-width: 1120px; margin: auto; padding: 8px clamp(16px, 4vw, 32px);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
a { color: var(--blue); text-underline-offset: .2em; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; font-weight: 720; }
.brand span { display: grid; place-items: center; min-width: 36px; min-height: 34px; border-radius: 9px; background: #1468cb; color: white; font-size: .78rem; }
.topbar > a:last-child { font-size: .875rem; }
main { max-width: 1040px; padding: clamp(30px, 6vw, 74px) clamp(16px, 4vw, 32px) 48px; margin: auto; }
.page-heading { max-width: 760px; margin: 0 auto clamp(22px, 4vw, 38px); text-align: center; }
h1 { margin: 0; font-size: clamp(2.1rem, 6.5vw, 4rem); line-height: 1.04; letter-spacing: -.055em; text-wrap: balance; }
h2 { line-height: 1.15; letter-spacing: -.025em; }
.eyebrow { margin: 0 0 12px; color: var(--blue); font-weight: 700; font-size: .875rem; }
.intro { margin: 14px auto 0; color: var(--muted); max-width: 58ch; font-size: clamp(1rem, 2vw, 1.17rem); text-wrap: pretty; }
.panel { padding: clamp(17px, 4vw, 38px); border: 1px solid #e8e8ed; border-radius: 26px; background: #fff; box-shadow: 0 8px 32px #1d1d1f09; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 16px; }
label { display: grid; gap: 7px; font-weight: 650; min-width: 0; }
input, select, textarea, button { font: inherit; }
input, select, textarea {
  width: 100%; min-width: 0; min-height: 48px; padding: 10px 13px;
  border: 1px solid var(--line); border-radius: 12px; background: #fafafc; color: inherit;
}
input[type=color] { padding: 6px; cursor: pointer; }
input[type=checkbox] { width: 18px; min-height: auto; height: 18px; accent-color: var(--blue); }
textarea { resize: vertical; }
button {
  min-height: 44px; border: 0; border-radius: 999px; padding: 10px 19px;
  background: var(--blue); color: white; font-weight: 650; cursor: pointer;
}
button:hover:not(:disabled) { background: #0059b3; }
button:disabled { opacity: .65; cursor: default; }
button.secondary, #pause, button[type=reset], #add-field, #download-form, #form-fields button {
  background: #edf3fb; color: #0057ac;
}
button.secondary:hover, #pause:hover, button[type=reset]:hover, #add-field:hover, #download-form:hover, #form-fields button:hover { background: #e1ecfa; }
:focus-visible { outline: 3px solid #0875db; outline-offset: 3px; }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; margin-top: 18px; }
.result { margin-top: 20px; border-radius: 17px; background: #eef5ff; padding: 18px; color: #153754; font-size: clamp(1.05rem, 2vw, 1.25rem); font-weight: 650; overflow-wrap: anywhere; white-space: pre-line; }
.result:empty { display: none; }
.panel > p, form > p { color: var(--muted); font-size: .92rem; }
.back { display: table; margin: 24px auto 0; }
.wheel { display: block; width: min(100%, 350px); height: auto; margin: 0 auto; }
.wheel-layout, .builder-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(16px, 4vw, 30px); align-items: start; }
.wheel-layout form > label + label { margin-top: 12px; }
.wheel-stage { background: #f5f5f7; border-radius: 21px; padding: 12px; }
.wheel-stage .result { margin: 8px 0 0; text-align: center; }
.wheel-panel { background:linear-gradient(145deg,#ffffff 32%,#eef5ff 100%); }
.wheel-panel .wheel-layout { grid-template-columns:minmax(0,.85fr) minmax(0,1.15fr); }
.wheel-glass { background:linear-gradient(150deg,#ffffffd9,#dceafa99),radial-gradient(at 80% 86%,#b5d5ff,transparent 70%); border:1px solid #fff; box-shadow:inset 0 1px 0 #fff,0 14px 38px #466f9b1c; backdrop-filter:blur(18px); padding:clamp(10px,3vw,25px); }
.wheel-glass .wheel { width:min(100%, 470px); filter:drop-shadow(0 12px 16px #275b8d27); }
.wheel-glass .result { background:#ffffffbc; border:1px solid white; font-size:clamp(1.2rem,3vw,1.5rem); }
.wheel-palettes { padding:0; margin:16px 0 0; border:0; min-width:0; }
.wheel-palettes legend { padding:0; font-weight:650; margin-bottom:8px; }
.palette-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
.palette-grid button { display:grid; gap:4px; justify-items:start; border-radius:13px; background:#fff; color:#24334c; border:1px solid #d7e1ee; padding:8px 10px; font-size:.85rem; }
.palette-grid button:hover:not(:disabled), .palette-grid button[aria-pressed=true] { background:#e9f2ff; border-color:#0066cc; }
.palette-swatches { display:flex; gap:2px; flex-wrap:wrap; }
.palette-swatches i { width:12px; height:12px; border-radius:50%; border:1px solid #0002; }
#spin-wheel { width:100%; font-size:1.13rem; min-height:50px; }
.wheel-hit, .wheel-hit:hover:not(:disabled) { position:relative; display:block; width:min(100%, 470px); margin:auto; padding:0; border-radius:50%; background:transparent; }
.wheel-pointer { position:absolute; z-index:1; top:1.8%; left:50%; width:7%; aspect-ratio:1; transform:translateX(-50%); background:var(--pointer-colour,#23344e); clip-path:polygon(0 0,100% 0,50% 100%); pointer-events:none; }
.wheel-hit canvas { transform-origin:center; }
.wheel-hub { position:absolute; z-index:1; top:50%; left:50%; transform:translate(-50%,-50%); width:19%; aspect-ratio:1; display:grid; place-items:center; padding:4px; border:2px solid var(--pointer-colour,#23344e); border-radius:50%; background:linear-gradient(#fff,#f8fbff 46%,#d5e5f7); box-shadow:0 4px 12px #17365647; color:#17233a; font-size:clamp(.65rem,2.4vw,1rem); font-weight:800; line-height:1; overflow-wrap:anywhere; pointer-events:none; }
.wheel-hit:disabled { opacity:1; }
.wheel-title { margin:0 0 10px; text-align:center; overflow-wrap:anywhere; }
.wheel-design { margin-top:16px; padding:11px 14px; border:1px solid #d7e1ee; border-radius:14px; background:#ffffffb8; }
.wheel-design summary { cursor:pointer; font-weight:700; }
.wheel-design label { margin-top:10px; }
.wheel-settings { min-width:0; }
.wheel-settings > summary { cursor:pointer; font-weight:700; padding:12px 14px; margin:0 0 12px; border:1px solid #d7e1ee; border-radius:14px; background:#ffffffb8; }
.wheel-style-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
.wheel-style-grid button { display:grid; gap:5px; align-content:start; text-align:left; border:1px solid #d7e1ee; border-radius:14px; background:#fff; color:#24334c; padding:9px; font-size:.8rem; }
.wheel-style-grid button:hover:not(:disabled), .wheel-style-grid button[aria-pressed=true] { background:#e9f2ff; border-color:#0066cc; }
.wheel-style-grid small { color:var(--muted); line-height:1.35; }
.wheel-style-sample { width:40px; aspect-ratio:1; border-radius:50%; border:3px solid #d3e4f5; background:conic-gradient(#a8c9ff 25%,#8ddfe2 25% 50%,#bfe9c0 50% 75%,#c5c8fa 75%); }
.wheel-style-sample.style-1 { border-color:#8670e9; box-shadow:0 0 6px #f372dc; background:conic-gradient(#22f3de 25%,#ff72dc 25% 50%,#ab77ff 50% 75%,#fbff6d 75%); }
.wheel-style-sample.style-2 { border:4px dotted #fff2a8; background:conic-gradient(#ffb39e 25%,#ffd887 25% 50%,#f6b7cf 50% 75%,#fb9fa5 75%); box-shadow:0 0 0 1px #a27524; }
.wheel-style-sample.style-3 { border-color:#cabdef; background:conic-gradient(#cfbcfa,#f5c0df,#c4d7ff,#e5cffa,#99dce7,#cfbcfa); }
.wheel-glass[data-wheel-style="Neon Arcade"] { background:radial-gradient(at 47% 42%,#24274b,#100f21 75%); border-color:#5b5095; box-shadow:0 14px 32px #33307045; }
.wheel-glass[data-wheel-style="Neon Arcade"] .wheel-title { color:#fff; }
.wheel-glass[data-wheel-style="Golden Carousel"] { background:linear-gradient(145deg,#fff9e8,#f4dbad); }
.wheel-glass[data-wheel-style="Crystal Prism"] { background:linear-gradient(145deg,#eaf9ff,#f0eaff 57%,#eafaf5); }
.wheel-confetti { position:fixed; inset:0; overflow:hidden; pointer-events:none; z-index:20; }
.wheel-confetti i { position:absolute; top:28%; left:50%; width:10px; height:15px; border-radius:3px; animation:wheel-confetti-fall 1.6s ease-out both; }
@keyframes wheel-confetti-fall {
  from { transform:translate(0,0) rotate(0deg); opacity:1; }
  22% { transform:translate(calc(var(--flight-x) * .4),-105px) rotate(calc(var(--flight-turn) * .3)); }
  to { transform:translate(var(--flight-x),var(--flight-y)) rotate(var(--flight-turn)); opacity:0; }
}
.answers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.answers button { border-radius: 14px; padding: 12px 16px; background: #f3f5f8; color: #1d1d1f; text-align: left; overflow-wrap: anywhere; }
.answers button:hover:not(:disabled) { background: #e7effb; }
.answers button[data-answer=correct] { background: #e6f6ec; color: #13592d; opacity: 1; }
.answers button[data-answer=incorrect] { background: #fcebe9; color: #8b2119; opacity: 1; }
#quiz-stage:not(:empty) { background: #fafafc; margin-top: 24px; padding: clamp(14px, 3vw, 24px); border-radius: 19px; }
#quiz-stage progress { width: 100%; height: 7px; accent-color: var(--blue); }
.quiz-mode { max-width: 420px; margin-bottom: 16px; }
.quiz-picture { display: block; width: min(100%, 420px); height: auto; margin: 0 auto 16px; background: #eef5ff; border-radius: 16px; }
#quiz-stage h2 { margin: 10px 0 16px; }
.preview { border: 1px solid #e5e5eb; border-top: 4px solid var(--blue); border-radius: 18px; padding: 18px; background: #fafafc; }
.preview h2 { margin: 0 0 16px; }
.preview fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.preview label + label { margin-top: 12px; }
.preview button { margin-top: 12px; }
.builder-output > label { margin-top: 18px; }
.builder-output textarea { font-family: ui-monospace, monospace; font-size: .8rem; }
#form-fields fieldset { min-width: 0; padding: 12px; border: 1px solid #e5e5eb; border-radius: 14px; margin: 12px 0 0; }
#form-fields legend { font-size: .84rem; color: var(--muted); }
.check { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.timer-display { text-align: center; font-size: clamp(3rem, 11vw, 6rem); line-height: 1; letter-spacing: -.06em; font-variant-numeric: tabular-nums; margin: 0 0 20px; padding: 22px 8px; }
.mortgage-layout { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:clamp(18px,4vw,32px); align-items:start; }
.mortgage-inputs { display:grid; gap:16px; }
.mortgage-slider { display:grid; gap:2px; }
.mortgage-slider > label { grid-template-columns:minmax(0,1fr) minmax(92px,38%); align-items:center; }
.mortgage-slider input[type=number] { text-align:right; font-variant-numeric:tabular-nums; padding-inline:9px; }
.mortgage-slider input[type=range] { accent-color:var(--blue); margin:0; min-height:32px; padding:0; background:transparent; border:0; cursor:pointer; }
.mortgage-result { padding:clamp(16px,4vw,30px); border-radius:22px; color:#172a44; background:linear-gradient(145deg,#eff7ff,#edf1fa); border:1px solid #e3eaf5; }
.mortgage-result > p:first-child { margin:0; font-weight:650; }
#mortgage-total { display:block; overflow-wrap:anywhere; letter-spacing:-.045em; font-weight:760; font-size:clamp(1.9rem,5vw,3rem); line-height:1.2; margin:8px 0 16px; }
.mortgage-bar { height:8px; border-radius:100px; background:#b0d6cf; overflow:hidden; }
.mortgage-bar span:first-child { display:block;height:100%;background:#1769cb; }
.mortgage-result dl { margin:16px 0 0; }
.mortgage-result dl div { display:flex; justify-content:space-between; gap:10px; padding:8px 0; border-bottom:1px solid #d9e3ee; font-size:.9rem; }
.mortgage-result dd { margin:0; font-variant-numeric:tabular-nums; font-weight:650; text-align:right; }
.mortgage-note { color:var(--muted); font-size:.84rem; }
.mortgage-panel details > summary { cursor:pointer; font-weight:700; padding:8px 0; }
.mortgage-extra { border-top:1px solid #e8e8ed; margin:18px 0 0; padding-top:8px; }
.mortgage-resources { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,220px),1fr)); gap:10px; margin-top:10px; }
.mortgage-resources article, #mortgage-quotes article { padding:14px; border-radius:14px; border:1px solid #e5e5eb; background:#fafafc; }
.mortgage-resources article h3, #mortgage-quotes h3 { margin:0; font-size:1rem; }
.mortgage-resources article p, #mortgage-quotes article p { margin:7px 0; color:var(--muted); font-size:.9rem; }
@media (max-width:720px) { .mortgage-layout { grid-template-columns:minmax(0,1fr); } }
.builder-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) 92px auto; align-items: end; gap: 12px; margin-bottom: 22px; }
.visual-builder .builder-layout { grid-template-columns: minmax(160px, .65fr) minmax(0, 2fr); }
.field-palette { display: grid; gap: 7px; min-width: 0; }
.field-palette h2 { margin: 0; font-size: 1.15rem; }
.field-palette p { margin: 0 0 4px; font-size: .875rem; color: var(--muted); }
.field-palette button { text-align: left; border-radius: 12px; cursor: grab; }
.field-palette span { margin-right: 4px; }
.form-canvas { min-width: 0; background: #f5f5f7; border-radius: 20px; padding: clamp(12px, 3vw, 22px); }
.form-canvas > label input { background: white; font-size: 1.2rem; font-weight: 700; }
#form-fields fieldset { background: white; }
.field-sample { margin-top: 8px; background: #f5f5f7; border: 1px solid #e6e6eb; border-radius: 9px; padding: 7px 11px; color: var(--muted); font-size: .86rem; }
.field-controls { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.field-controls label { margin: 0 auto 0 0; font-size: .86rem; }
#form-fields .field-controls button { padding: 0; min-width: 36px; min-height: 36px; }
.drag-field { cursor: grab; }
#field-drop-end { text-align: center; border: 1px dashed #9fb3ca; border-radius: 12px; margin-top: 12px; padding: 12px; color: var(--muted); font-size: .86rem; }
#form-fields .drop-target, #field-drop-end.drop-target { outline: 2px solid var(--blue); background: #eef5ff; }
.show-preview #form-fields, .show-preview #field-drop-end { display: none; }
.publish-tools { border-top: 1px solid #e5e5eb; margin-top: 22px; padding-top: 14px; }
.publish-tools summary { cursor: pointer; color: var(--blue); font-weight: 700; padding: 5px 0; }
.publish-tools details { margin-top: 10px; }
.publish-tools textarea { font-family: ui-monospace, monospace; font-size: .8rem; }
.visually-hidden { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
.template-picker { position:relative; align-self:end; }
.template-picker summary { min-height:48px; padding:11px 14px; background:#f5f5f7; border:1px solid var(--line); border-radius:12px; cursor:pointer; font-weight:650; }
.template-cards { position:absolute; z-index:2; top:calc(100% + 8px); left:0; width:min(560px, 76vw); padding:12px; border:1px solid #e5e5eb; border-radius:18px; background:white; box-shadow:0 16px 36px #1d1d1f20; display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:9px; }
.template-card { display:grid; gap:7px; text-align:left; border-radius:12px; background:#f5f5f7; color:#1d1d1f; padding:8px; font-size:.78rem; }
.template-card:hover:not(:disabled), .template-card[aria-pressed=true] { background:#e6f0fd; }
.template-mini { display:grid; gap:5px; padding:8px; border-radius:8px; background:white; border-top:3px solid var(--sample-accent,#0066cc); }
.template-mini b,.template-mini i,.template-mini em { display:block; border-radius:3px; background:#e9e9ee; height:6px; }
.template-mini b { width:65%; background:#bfc4cd; }.template-mini em { width:35%; background:#323238; }
.template-mini [data-mini-type=textarea] { height:12px; }
.template-mini [data-mini-type=checkbox] { width:50%; }
.published-form { max-width:42rem; margin:auto; padding:clamp(18px,5vw,30px); color:#1d1d1f; background:white; border:1px solid #e5e5eb; border-top:4px solid var(--form-accent,#0066cc); border-radius:22px; font:16px/1.5 -apple-system,BlinkMacSystemFont,system-ui,sans-serif; }
.published-form .form-name { display:block; margin:0 0 20px; font-size:clamp(1.55rem,5vw,2rem); line-height:1.15; letter-spacing:-.035em; font-weight:750; }
.published-form .published-field { display:grid; gap:6px; margin:0 0 14px; font-weight:650; }
.published-form .published-check { display:flex; gap:8px; align-items:center; }
.published-form .published-control:not([type=checkbox]) { min-height:46px; width:100%; border:1px solid #d2d2d7; border-radius:12px; background:#fafafc; padding:10px 12px; font:inherit; font-weight:400; color:#1d1d1f; }
.published-form textarea.published-control { min-height:88px; }
.published-form .published-control[type=checkbox] { width:18px; height:18px; min-height:0; accent-color:var(--form-accent,#0066cc); }
.published-form .published-send { min-height:44px; border:0; border-radius:999px; background:#1d1d1f; color:white; font:inherit; font-weight:650; padding:10px 23px; }
.published-form .published-credit { margin:16px 0 0; font-size:.8rem; color:#0059b3; }
#published-preview fieldset { border:0; padding:0; margin:0; min-width:0; }
.published-form .inline-edit { width:100%; min-height:0; border:0; padding:0; background:transparent; border-radius:4px; color:inherit; }
.published-form .inline-edit:hover { box-shadow:0 2px #9abce8; }
#form-fields fieldset { position:relative; padding:0; margin:0; border:0; }
#form-fields .published-field:not(.published-check) { grid-template-columns:minmax(0,1fr) auto; }
#form-fields .published-field:not(.published-check) .published-control { grid-column:1/-1; }
#form-fields .published-check .published-control { order:-1; }
.required-mark { color:#a74124; }
#form-fields .field-controls { display:none; padding:6px; border-radius:11px; background:#eef5ff; margin:0 0 12px; }
#form-fields fieldset:hover .field-controls, #form-fields fieldset:focus-within .field-controls { display:flex; }
.editable-form #field-drop-end { margin:0 0 12px; }
.form-field-rules { margin:0 0 14px; padding:8px 10px; border:1px solid #dce7f4; border-radius:10px; background:#f5f9ff; }
.form-field-rules summary { cursor:pointer; color:#0057ac; font-size:.86rem; font-weight:650; }
.form-field-rules label { margin-top:8px; }
.published-form .quiz-score { margin:12px 0 0; font-weight:700; color:#0059b3; }
.quiz-score:empty { display:none; }
.signature-sample { grid-column:1/-1; min-height:82px; display:grid; place-items:center; background:#fafafc; border:1px dashed #a4b7ce; border-radius:12px; color:var(--muted); }
.signature-pad { display:grid; gap:8px; justify-items:start; }
.signature-pad canvas { width:100%; max-width:420px; height:auto; display:block; background:#fafafc; border:1px solid #d2d2d7; border-radius:12px; touch-action:none; }
.hosted-form main { max-width:740px; padding:12px; }
.hosted-form .published-send + p[role=status]:empty { display:none; }
#form-library > label { margin-top:10px; }
#saved-form-responses details { border-top:1px solid #e5e5eb; padding:8px 0; }
#saved-form-responses p { overflow-wrap:anywhere; }
#saved-form-responses img { display:block; max-width:min(100%,300px); border:1px solid #e5e5eb; border-radius:8px; }
@media (max-width: 720px) { .builder-layout, .wheel-layout { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 720px) {
  .wheel-panel .wheel-layout { grid-template-columns:minmax(0, 1fr); }
  .wheel-glass { grid-row:1; }
  body[data-utility="wheel-spinner"] .page-heading, body[data-utility="wheel-spinner"] .back { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); }
  body[data-utility="wheel-spinner"] main { padding-top:12px; }
  body[data-utility="wheel-spinner"] .wheel-panel { padding:9px; }
  .wheel-settings > summary { margin:0; }
  .wheel-settings[open] > summary { margin-bottom:12px; }
  .visual-builder .builder-layout { grid-template-columns: minmax(0, 1fr); }
  .field-palette { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field-palette h2, .field-palette p { grid-column: 1 / -1; }
  .field-palette button { cursor: pointer; padding-inline: 10px; }
  .builder-toolbar { grid-template-columns: minmax(0, 1fr) 84px; }
  .builder-toolbar button { grid-column: 1 / -1; justify-self: start; }
  #form-fields .field-controls button { min-width: 44px; min-height: 44px; }
  #form-fields .field-controls { display:flex; }
}
@media (max-width: 480px) { .panel { border-radius: 20px; } .answers { grid-template-columns: 1fr; } .actions > button { flex: 1 1 auto; } }
.dice-panel { max-width:720px; margin:auto; text-align:center; }
.dice-panel label { text-align:left; }
.dice-stage { --tray-light:#3f6859; --tray-dark:#183730; display:block; width:100%; max-width:500px; margin:0 auto; min-height:190px; padding:24px 10px; border-radius:24px; border:1px solid var(--tray-dark); box-shadow:inset 0 1px 2px #ffffff40,inset 0 -8px 20px #081b1833,0 9px 23px #172a3424; }
.dice-stage, .dice-stage:hover:not(:disabled) { background:radial-gradient(ellipse at 48% 20%,#ffffff26,transparent 65%),repeating-linear-gradient(37deg,#ffffff0c 0 1px,transparent 1px 4px),linear-gradient(145deg,var(--tray-light),var(--tray-dark)); }
.dice-stage[data-tray="navy"] { --tray-light:#344f78; --tray-dark:#121d36; }
.dice-stage[data-tray="plum"] { --tray-light:#704465; --tray-dark:#311e3b; }
.dice-stage[data-tray="sand"] { --tray-light:#e5c69c; --tray-dark:#b58c62; }
.dice-stage:disabled { opacity:1; }
.dice-tray { display:flex; flex-wrap:wrap; justify-content:center; align-items:center; gap:12px; }
.dice-object { --die-size:clamp(55px,16vw,89px); position:relative; display:grid; place-items:center; width:calc(var(--die-size) * 1.3); height:calc(var(--die-size) * 1.5); perspective:460px; }
.dice-object::before { content:""; position:absolute; bottom:3%; left:18%; width:84%; height:18%; border-radius:50%; background:#071813b3; filter:blur(6px); }
.dice-solid { --rest-pitch:-49deg; --rest-yaw:-17deg; display:block; position:relative; width:var(--die-size); height:var(--die-size); transform-style:preserve-3d; transform:rotateX(var(--rest-pitch)) rotateY(var(--rest-yaw)); }
.dice-face { position:absolute; inset:0; display:grid; grid-template:repeat(3,1fr)/repeat(3,1fr); place-items:center; padding:12%; border:1px solid #b9ad98; border-radius:8%; background:radial-gradient(ellipse at 25% 8%,#fffefa,transparent 70%),linear-gradient(145deg,#fff8e8,#e2d3b9); box-shadow:inset 1px 2px 3px #fff,inset -2px -4px 7px #8d79594d; color:#28261e; backface-visibility:hidden; }
.dice-front { transform:translateZ(calc(var(--die-size) / 2)); }
.dice-right { transform:rotateY(90deg) translateZ(calc(var(--die-size) / 2)); background:linear-gradient(125deg,#ede1ca,#baa989); box-shadow:inset 1px 2px 3px #fff8,inset -2px -4px 7px #6f5b3c4d; }
.dice-left { transform:rotateY(-90deg) translateZ(calc(var(--die-size) / 2)); }
.dice-top { transform:rotateX(90deg) translateZ(calc(var(--die-size) / 2)); background:radial-gradient(ellipse at 26% 15%,#fff 6%,#fff7e8 72%,#e9d9bc); }
.dice-bottom { transform:rotateX(-90deg) translateZ(calc(var(--die-size) / 2)); }
.dice-back { transform:rotateY(180deg) translateZ(calc(var(--die-size) / 2)); }
.dice-gem { transform:rotateX(-12deg) rotateY(-14deg); }
.dice-gem .dice-face { transform:none; clip-path:polygon(50% 0,96% 27%,96% 73%,50% 100%,4% 73%,4% 27%); background:conic-gradient(from 28deg at 50% 50%,#a0b9ea,#d7dbff,#bacbfa,#e8f3ff,#a0b9ea); }
.dice-number { display:grid; grid-template:none; font-size:clamp(1.3rem,5vw,2.1rem); font-weight:800; }
.pip { background:radial-gradient(circle at 62% 76%,#584b3a,#1c1b17 63%); box-shadow:inset 0 1px 2px #030300bd,0 1px 0 #fff9; border-radius:50%; width:55%; aspect-ratio:1; }
[data-appearance="casino"] .dice-solid:not(.dice-gem) .dice-face { border:1px solid #ff9d9099; border-radius:2%; background:#b80b2c url('/dice-casino.png') center / 100% 100% no-repeat; box-shadow:inset 0 0 4px #ffb09566; }
.dice-solid:not(.dice-gem) { --rest-yaw:-43deg; }
[data-appearance="casino"] .dice-solid:not(.dice-gem) .dice-top { background-color:#e32940; background-blend-mode:screen; }
[data-appearance="casino"] .dice-solid:not(.dice-gem) .dice-right { background-color:#98283f; background-blend-mode:multiply; }
[data-appearance="casino"] .dice-solid:not(.dice-gem) .pip { width:69%; background:radial-gradient(circle at 35% 24%,#fff 36%,#f0d9d7 92%); box-shadow:0 0 0 1px #74051e66,inset 0 1px 1px #fff; }
[data-appearance="wood"] .dice-solid:not(.dice-gem) .dice-face { border-color:#ae7748; border-radius:12%; background:repeating-linear-gradient(28deg,#87552912 0 1px,transparent 1px 4px),linear-gradient(145deg,#f7dc9f,#bf894c); }
.dice-photo { position:relative; display:block; width:100%; aspect-ratio:1; background:url('/dice-game.png') center / contain no-repeat; }
.dice-photo-pip { position:absolute; width:10%; height:6%; border-radius:50%; background:radial-gradient(ellipse at 35% 30%,#fff 42%,#e2cbcc); transform:translate(-50%,-50%) rotate(var(--pip-angle)); box-shadow:0 0 1px #4d1020; }
[data-appearance="wood"] .dice-photo { background-image:url('/dice-wood.png'); }
[data-appearance="ivory"] .dice-photo { background-image:url('/dice-ivory.png'); }
[data-appearance="wood"] .dice-photo-pip, [data-appearance="ivory"] .dice-photo-pip { background:radial-gradient(ellipse at 65% 70%,#41382e,#14110f 76%); box-shadow:0 1px 0 #fffb; }
.dice-settings [data-dice-appearance][hidden] { display:none; }
.pip-1 { grid-area:1/1; }.pip-3 { grid-area:1/3; }.pip-4 { grid-area:2/1; }.pip-5 { grid-area:2/2; }.pip-6 { grid-area:2/3; }.pip-7 { grid-area:3/1; }.pip-9 { grid-area:3/3; }
.dice-total { font-weight:750; font-size:1.2rem; }
.dice-modes { display:flex; gap:6px; max-width:500px; margin:0 auto 12px; padding:4px; border-radius:14px; background:#eaf0f6; }
.dice-modes button { flex:1; padding:8px; border-radius:10px; color:#294564; background:transparent; }
.dice-modes button[aria-pressed="true"] { color:#195bd5; background:#fff; box-shadow:0 1px 4px #243b5522; }
.dice-stage-action:not([hidden]) { display:block; margin-top:8px; color:#fff; text-shadow:0 1px 4px #000; }
.dice-game { max-width:500px; margin:16px auto 0; text-align:left; }
.dice-game-actions { display:flex; flex-wrap:wrap; align-items:end; gap:8px; grid-column:1/-1; }
.dice-game-actions label { flex:1 1 200px; min-width:0; }
.dice-invite-row { display:flex; align-items:center; gap:6px; }
.dice-invite-row input { flex:1; width:0; min-height:40px; padding:6px 9px; font-size:.85rem; }
.dice-invite button { min-height:44px; padding:6px 11px; font-size:.82rem; white-space:nowrap; }
.dice-invite [data-show-invite] { background:#edf3fa; color:#25446a; }
.dice-invite [data-invite-status] { margin-left:6px; font-size:.8rem; color:#246549; }
.dice-game [hidden] { display:none !important; }
.dice-game ul { list-style:none; padding:0; display:grid; gap:6px; }
.dice-game .dice-player-results { grid-template-columns:repeat(auto-fit,minmax(min(100%,190px),1fr)); }
.dice-slider { gap:2px; }
.dice-slider > span { display:flex; justify-content:space-between; align-items:center; gap:6px; font-size:.88rem; }
.dice-slider output { min-width:2ch; color:#165ad1; text-align:right; font-variant-numeric:tabular-nums; }
.dice-slider input[type="range"] { min-height:35px; padding:0; margin:0; border:0; background:transparent; accent-color:#255ce7; }
.dice-game li { padding:9px 12px; border-radius:9px; background:#fff; overflow-wrap:anywhere; }
.dice-game p:empty { display:none; }
.dice-game [data-leaderboard] { margin-top:18px; border:1px solid #dce4ed; border-radius:20px; background:#f5f8fc; padding:12px; }
.dice-board-banner { position:relative; overflow:hidden; border-radius:14px; padding:16px; color:#173754; background:#e7eef8; }
.dice-board-banner h3, .dice-board-banner p { margin:0; position:relative; z-index:1; }
.dice-board-banner p { margin-top:4px; font-weight:700; overflow-wrap:anywhere; }
.dice-celebration { color:#fff; background:linear-gradient(120deg,#152c50,#1d4c78); }
.dice-celebration p { color:#ffdf83; font-size:clamp(1.2rem,5vw,1.65rem); }
.dice-podium { display:grid; gap:6px; list-style:none; margin:10px 0; padding:0; }
.dice-podium li { display:grid; grid-template-columns:auto minmax(0,1fr) auto; align-items:center; gap:9px; }
.dice-podium li > span:last-child { font-variant-numeric:tabular-nums; font-weight:700; }
.dice-rank { display:grid; place-items:center; min-width:28px; height:28px; border-radius:50%; background:#e7eef8; }
.dice-podium .dice-winner { background:#fff3cb; color:#563c0b; animation:dice-winner-rise .55s ease-out both; animation-delay:calc(var(--rank-order) * 90ms); }
.dice-winner .dice-rank { background:#ebbc50; }
.dice-round-history summary { cursor:pointer; padding:6px 2px; font-weight:700; }
.dice-round-history li { display:grid; gap:3px; }
.dice-round-history li span { font-size:.9rem; }
.dice-finale { box-sizing:border-box; width:min(520px,calc(100% - 24px)); max-height:calc(100% - 24px); padding:0; overflow:visible; border:0; border-radius:22px; background:#f5f8fc; color:#173754; box-shadow:0 16px 64px #07152a66; }
.dice-finale::backdrop { background:#0a1b36b3; }
.dice-finale-scroll { box-sizing:border-box; max-height:calc(100vh - 32px); max-height:calc(100dvh - 32px); overflow:auto; overscroll-behavior:contain; padding:clamp(12px,4vw,20px); border-radius:inherit; }
.dice-finale-header { display:flex; justify-content:space-between; align-items:center; gap:10px; margin-bottom:12px; }
.dice-finale-header h2 { margin:0; font-size:1.2rem; }
.dice-finale-header button { flex:none; min-height:44px; }
.dice-finale-scroll > .dice-game-actions { margin-bottom:14px; }
.dice-finale-scroll > .dice-game-actions:not(:has(> button:not([hidden]), > p:not(:empty))) { display:none; }
.dice-confetti { position:fixed; z-index:2; inset:0; width:100%; height:100%; overflow:hidden; pointer-events:none; }
.dice-confetti i { position:absolute; left:var(--x); top:0; width:8px; height:13px; border-radius:2px; background:hsl(var(--hue), 90%, 58%); box-shadow:0 0 0 1px #172b3e33; animation:dice-confetti-fall 2.4s linear var(--delay) both; }
@keyframes dice-confetti-fall {
  0% { transform:translate3d(0,-16px,0) rotate(0deg); opacity:0; }
  12%, 78% { opacity:1; }
  100% { transform:translate3d(-12px,100vh,0) rotate(470deg); opacity:0; }
}
@keyframes dice-winner-rise { from { transform:translateY(8px); opacity:.45; } to { transform:translateY(0); opacity:1; } }
@media (prefers-reduced-motion:reduce) { .dice-confetti { display:none; } .dice-podium .dice-winner { animation:none; } }
.dice-settings { margin:14px auto 0; width:100%; max-width:460px; }
.dice-settings summary { cursor:pointer; color:#425165; padding:7px; font-size:.88rem; }
.dice-settings[open] summary { margin-bottom:10px; }
body[data-utility="dice-roller"] .page-heading, body[data-utility="dice-roller"] .back { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); }
body[data-utility="dice-roller"] main { padding-top:16px; }
.dice-motion { justify-content:center; margin-top:14px; color:#515154; font-size:.9rem; }
.dice-in-flight { --drift:12px; --pitch-turn:360deg; --yaw-turn:720deg; animation:dice-flight .9s linear both; }
.dice-in-flight:nth-child(2n) { --drift:-13px; --pitch-turn:720deg; --yaw-turn:-360deg; }
.dice-in-flight:nth-child(3n) { --drift:8px; --pitch-turn:-360deg; --yaw-turn:360deg; }
.dice-in-flight::before { animation:dice-shadow .9s linear both; }
@keyframes dice-flight {
  0%,100% { transform:translate3d(0,0,0); }
  24% { transform:translate3d(var(--drift),-22px,0); animation-timing-function:ease-in; }
  56% { transform:translate3d(calc(var(--drift) * .33),0,0); animation-timing-function:ease-out; }
  68% { transform:translate3d(calc(var(--drift) * -.24),-7px,0); animation-timing-function:ease-in; }
  82% { transform:translate3d(0,0,0); animation-timing-function:ease-out; }
  90% { transform:translate3d(0,-2px,0); }
}
@keyframes dice-shadow {
  0%,56%,82%,100% { opacity:1; transform:scale(1); }
  24% { opacity:.4; transform:translateY(22px) scale(.72); }
  68% { opacity:.7; transform:translateY(7px) scale(.88); }
}
.dice-photo.dice-pop { animation:dice-photo-roll .9s linear both; }
@keyframes dice-photo-roll {
  0% { transform:rotate(0deg); animation-timing-function:ease-in; }
  24% { transform:rotate(calc(var(--pitch-turn) * .35)) rotateY(36deg) scale(1.08); }
  56% { transform:rotate(calc(var(--pitch-turn) * .86)) rotateY(-18deg) scale(1.03,.92); animation-timing-function:ease-out; }
  82% { transform:rotate(calc(var(--pitch-turn) + 7deg)) rotateY(12deg); animation-timing-function:ease-in-out; }
  100% { transform:rotate(var(--pitch-turn)); }
}
.dice-gem.dice-pop { animation:dice-gem-pop .9s linear both; }
@keyframes dice-gem-pop {
  0% { transform:rotateX(-12deg) rotateY(-14deg) rotateZ(0); animation-timing-function:ease-out; }
  56% { transform:rotateX(42deg) rotateY(-48deg) rotateZ(calc(var(--pitch-turn) - 36deg)); animation-timing-function:ease-out; }
  82% { transform:rotateX(-16deg) rotateY(-10deg) rotateZ(calc(var(--pitch-turn) + 7deg)); }
  100% { transform:rotateX(-12deg) rotateY(-14deg) rotateZ(var(--pitch-turn)); }
}
