/* Nim's mechanism and service window. Scoped so other hosts retain their layout. */
#wheel-modal {
  width:min(1180px,calc(var(--safe-vw) - 48px)); height:min(670px,calc(var(--safe-dvh) - 48px)); max-height:none;
  display:flex; flex-direction:column; gap:20px; padding:26px 30px 24px; overflow:hidden;
  border:1px solid #28281f; border-radius:9px; color:#e8dcc5; letter-spacing:0;
  font:400 14px/1.4 "Segoe UI",system-ui,sans-serif;
  background:url('../assets/ui/character-surface.svg') repeat,radial-gradient(ellipse at 44% 62%,#69532d30,transparent 65%),linear-gradient(135deg,#262821,#121a1b 70%);
  box-shadow:0 28px 80px #000d,inset 0 0 0 10px #101612,inset 0 0 38px #0008;
}
#wheel-modal::before { content:""; position:absolute; inset:0; border:30px solid transparent; border-image:url('../assets/ui/skill-window-frame.svg') 40 / 30px stretch; pointer-events:none; z-index:3; }
#wheel-modal button { min-width:44px!important; min-height:44px!important; padding:8px 12px!important; border:1px solid #6e6047; border-radius:3px; box-shadow:inset 0 1px #dac99c16,inset 0 -2px #0004; background:linear-gradient(135deg,#34392e,#202a25); color:#e8dcc5; font:600 13px/1.25 "Segoe UI",system-ui; text-transform:none; letter-spacing:0; transform:none; outline:none; }
#wheel-modal button:hover:not(:disabled) { border-color:#c7ab76; background:linear-gradient(135deg,#484838,#2b3830); transform:none; }
#wheel-modal button:focus-visible,#wheel-modal summary:focus-visible { outline:2px solid #e9ca8f; outline-offset:2px; }
#wheel-modal button:disabled { opacity:.5; cursor:default; }
.fortune-header { display:flex; align-items:center; gap:18px; padding-bottom:14px; border-bottom:1px solid #8c744850; flex:none; }
.fortune-title-block { display:flex; align-items:center; gap:12px; flex:1; min-width:0; }
.fortune-host-face { display:none; width:44px; height:44px; object-fit:cover; object-position:50% 10%; border-radius:50%; background:#171d18; }
.fortune-eyebrow { margin:0 0 3px; color:#b5a17c; font-size:11px; }
#wheel-modal h2 { margin:0; padding:0; border:0; color:#f3e4c5; font:32px/1.1 Georgia,serif; }
.fortune-wallet { display:flex; gap:14px; color:#d2bb8e; font-size:12px; }
#wheel-modal .modal-close { position:static; flex:none; font-size:12px!important; background:transparent; }
.fortune-workspace { display:grid; grid-template-columns:160px minmax(0,1fr) 300px; gap:22px; flex:1; min-height:0; }
#wheel-modal .fortune-host { display:flex; flex-direction:column; justify-content:center; max-height:none; min-height:0; }
#wheel-modal .service-npc-stage { padding:0; flex:1; min-height:0; display:flex; align-items:flex-end; }
#wheel-modal .service-npc-figure { height:100%; max-height:360px; object-fit:contain; image-rendering:auto; }
#wheel-modal .service-npc-copy { position:static; max-height:150px; padding:14px 0 0; margin-top:12px; background:none; border:0; border-top:1px solid #7c684c55; overflow-y:auto; flex:none; scrollbar-width:thin; scrollbar-color:#746243 #1b241e; }
#wheel-modal .service-npc-copy h3 { color:#e1c595; font:22px Georgia,serif; }
#wheel-modal .service-npc-greeting { font:12px/1.5 "Segoe UI",system-ui; }
#wheel-modal .service-npc-story { font:11px/1.5 "Segoe UI",system-ui; }
#wheel-modal .service-npc-story summary { min-height:44px; display:flex; align-items:center; }
.fortune-mechanism { min-height:0; display:flex; flex-direction:column; justify-content:center; gap:18px; align-items:center; position:relative; }
.fortune-mechanism::before { content:""; position:absolute; inset:0; background:radial-gradient(ellipse,#a2833925,transparent 66%); pointer-events:none; }
.wheel-stage { --wheel-radius:33%; position:relative; width:100%; max-width:440px; aspect-ratio:1; flex:none; isolation:isolate; }
.lucky-wheel { position:absolute; inset:6%; border-radius:50%; overflow:hidden; transition:transform var(--spin-duration,3600ms) cubic-bezier(.12,.72,.08,1); box-shadow:0 12px 30px #000b; }
.fortune-plates { position:absolute; inset:0; width:100%; height:100%; }
.fortune-marker { position:absolute; width:19%; text-align:center; transform:translate(-50%,-50%); }
.fortune-marker-content { display:flex; flex-direction:column; align-items:center; gap:2px; transition:transform var(--spin-duration,3600ms) cubic-bezier(.12,.72,.08,1); }
.fortune-marker img,.fortune-marker svg { width:38px; height:38px; object-fit:contain; filter:drop-shadow(0 2px 2px #0009); }
.fortune-marker small { font-size:11px; color:#e0d3b5; line-height:1.1; text-shadow:0 1px 3px #000; }
.fortune-marker[data-landed="true"] small { color:#fff2c7; }
.fortune-marker[data-landed="true"] img,.fortune-marker[data-landed="true"] svg { filter:drop-shadow(0 0 5px #d8b66c); }
.fortune-rim { position:absolute; inset:0; background:url('../assets/ui/fortune-rim.svg') center/contain no-repeat; pointer-events:none; }
.fortune-hub { position:absolute; inset:36%; display:flex; flex-direction:column; align-items:center; justify-content:center; color:#c9ab75; background:radial-gradient(circle at 35% 25%,#464536,#18241f 68%); border:4px double #a28b5e; border-radius:50%; box-shadow:0 4px 12px #0009,inset 0 0 0 4px #111c16,inset 0 0 0 5px #695a40; pointer-events:none; }
.fortune-hub span { font-size:10px; letter-spacing:2px; }
.fortune-hub strong { font:italic 22px Georgia,serif; color:#ead6a9; }
.fortune-hub small { font-size:8px; letter-spacing:1px; margin-top:4px; }
.wheel-pointer { position:absolute; top:2%; left:50%; width:7%; height:11%; z-index:2; transform:translateX(-50%); clip-path:polygon(15% 0,85% 0,100% 25%,50% 100%,0 25%); background:linear-gradient(100deg,#6d5a3e,#e4c58b 48%,#98805b 50%,#493d2d); filter:drop-shadow(0 3px 2px #000); }
.fortune-meter { width:80%; max-width:320px; flex:none; }
.fortune-meter>div:first-child { display:flex; justify-content:space-between; gap:8px; font-size:11px; color:#cfbb92; }
.fortune-meter-note { color:#9da695; }
.fortune-pips { display:grid; grid-template-columns:repeat(10,1fr); gap:5px; margin-top:8px; }
.fortune-pips span { height:5px; background:#18241d; border:1px solid #61563e; transform:skewX(-20deg); }
.fortune-pips span.is-filled { background:#c1a26a; border-color:#d2b27a; }
.fortune-controls { display:flex; flex-direction:column; justify-content:center; min-height:0; gap:14px; padding-left:20px; border-left:1px solid #74624355; }
.fortune-result-panel { display:flex; gap:12px; align-items:center; min-height:120px; flex:none; border-bottom:1px solid #74624355; padding-bottom:16px; }
.fortune-result-panel>div { min-width:0; }
.fortune-result-symbol { width:54px; height:54px; flex:none; display:grid; place-items:center; border:1px solid #8e795455; transform:rotate(45deg); background:#9c7d3820; }
.fortune-result-symbol>* { width:42px; height:42px; object-fit:contain; transform:rotate(-45deg); }
.wheel-result { margin:2px 0 6px; color:#f3e4c5; font:24px/1.15 Georgia,serif; overflow-wrap:anywhere; }
#wheel-result-note { margin:0; font-size:12px; line-height:1.4; color:#aeb2a4; }
.wheel-cooldown { color:#c7b78d; font-size:12px; margin:0; flex:none; }
.wheel-actions { display:grid; gap:10px; flex:none; }
#wheel-modal .wheel-actions button { display:flex; align-items:center; justify-content:space-between; gap:10px; text-align:left; min-height:64px!important; }
.wheel-actions strong { display:block; font-size:15px; font-weight:600; }
.wheel-actions small { display:block; margin-top:4px; color:#aeb2a4; font-size:11px; font-weight:400; }
.fortune-price { font-size:12px; white-space:nowrap; color:#ddc598; }
#wheel-modal #btn-spin-free { border-color:#b39a67; background:linear-gradient(120deg,#5c5033,#343d2d); }
#wheel-modal #btn-spin-celestial { border-color:#667f78; }
.fortune-rules { font-size:11px; color:#aeb2a4; min-height:44px; overflow-y:auto; scrollbar-width:thin; scrollbar-color:#746243 #1b241e; }
.fortune-rules summary { min-height:44px; display:flex; align-items:center; cursor:pointer; color:#ccb58a; }
.fortune-rules summary::after { content:"+"; margin-left:auto; font-size:18px; }
.fortune-rules[open] summary::after { content:"−"; }
.fortune-rules p { margin:0 0 8px; }
#wheel-rewards { margin:0; padding:0 0 0 16px; display:grid; grid-template-columns:1fr 1fr; gap:3px 8px; }
@media(max-width:1100px),(max-height:600px) {
  #wheel-modal { width:calc(var(--safe-vw) - 20px); height:min(620px,calc(var(--safe-dvh) - 20px)); padding:16px 20px; gap:12px; }
  #wheel-modal .fortune-host { display:none; }
  .fortune-host-face { display:block; }
  .fortune-workspace { grid-template-columns:minmax(0,1fr) minmax(260px,.8fr); gap:18px; }
  .fortune-mechanism { gap:10px; }
  #wheel-modal::before { border-width:18px; border-image-width:18px; }
}
@media(max-height:520px) and (min-width:561px) {
  #wheel-modal { padding:10px 16px; gap:8px; }
  .fortune-header { padding-bottom:6px; gap:12px; }
  #wheel-modal h2 { font-size:23px; }
  .fortune-eyebrow { font-size:10px; }
  .fortune-workspace { grid-template-columns:minmax(0,1fr) minmax(270px,.9fr); gap:14px; }
  .wheel-stage { width:min(100%,calc(var(--safe-dvh) - 116px)); }
  .fortune-marker img,.fortune-marker svg { width:24px; height:24px; }
  .fortune-marker small { font-size:9px; }
  .fortune-hub { border-width:3px; }
  .fortune-hub strong { font-size:16px; }
  .fortune-hub small { display:none; }
  .fortune-hub span { font-size:8px; }
  .fortune-meter { width:85%; }
  .fortune-meter-note { display:none; }
  .fortune-pips { margin-top:5px; gap:4px; }
  .fortune-controls { gap:6px; padding-left:14px; }
  .fortune-result-panel { min-height:62px; padding-bottom:6px; gap:12px; }
  .fortune-result-symbol { width:36px; height:36px; }
  .fortune-result-symbol>* { width:28px; height:28px; }
  .wheel-result { font-size:19px; margin-bottom:3px; }
  #wheel-result-note,.wheel-cooldown { font-size:11px; }
  .wheel-actions { gap:5px; }
  #wheel-modal .wheel-actions button { min-height:44px!important; padding:5px 10px!important; }
  .wheel-actions strong { font-size:13px; }
  .wheel-actions small { display:none; }
  .fortune-rules { min-height:44px; }
}
@media(max-width:560px) {
  #wheel-modal { padding:16px; gap:10px; }
  .fortune-header { flex-wrap:wrap; gap:6px 10px; padding-bottom:8px; }
  #wheel-modal h2 { font-size:22px; }
  .fortune-wallet { order:3; width:100%; justify-content:flex-end; font-size:11px; }
  .fortune-title-block { gap:7px; }
  .fortune-host-face { width:32px; height:40px; }
  .fortune-workspace { display:flex; flex-direction:column; gap:14px; overflow-y:auto; scrollbar-width:thin; scrollbar-color:#746243 #1b241e; }
  .fortune-mechanism { flex:none; }
  .wheel-stage { width:min(260px,100%); }
  .fortune-hub strong { font-size:18px; }
  .fortune-marker img,.fortune-marker svg { width:28px; height:28px; }
  .fortune-marker small { font-size:9px; }
  .fortune-controls { padding:0; border:0; flex:none; gap:8px; }
  .fortune-result-panel { min-height:80px; }
  .wheel-result { font-size:22px; }
  #wheel-modal .wheel-actions button { min-height:52px!important; }
  .fortune-rules { overflow:visible; }
}
@media(hover:none) and (pointer:coarse) { #wheel-modal .kbd { display:none; } }
@media(prefers-reduced-motion:reduce) { #wheel-modal .lucky-wheel,#wheel-modal .fortune-marker-content { transition:none; } }
