/* Wish Wall PAGE styles — not used by the 3D game shell. */

html,body{margin:0;min-height:100%;background:#16140f;color:#f1e8d8}
    html{overflow-x:hidden;overflow-y:scroll}
    body.wish-wall-page{
      display:flex;flex-direction:column;
      background:
        radial-gradient(90% 60% at 50% -10%,#3a3228 0%,#16140f 58%),
        #16140f;
      overflow-x:hidden;
      min-height:100%;
      height:auto;
    }
    .wish-page-bar{
      flex:none;display:flex;align-items:center;justify-content:space-between;gap:10px;
      padding:10px max(14px,env(safe-area-inset-right)) 8px max(14px,env(safe-area-inset-left));
      z-index:50;
    }
    .wish-page-left{display:flex;align-items:center;gap:8px;min-width:0}
    .wish-page-right{display:flex;align-items:center;gap:10px;flex:none}
    .wish-page-back,.wish-page-chant,.wish-page-support{
      display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:40px;padding:0 14px;
      border:1px solid #b99a6255;border-radius:999px;color:#d7c7a0;text-decoration:none;
      font:600 13px/1 system-ui,-apple-system,"PingFang SC",sans-serif;background:#ffffff08;
      cursor:pointer;touch-action:manipulation;-webkit-tap-highlight-color:transparent;
      transition:border-color .2s,background .2s,color .2s;
    }
    .wish-page-back:hover,.wish-page-chant:hover,.wish-page-support:hover{border-color:#b99a62;background:#b99a6214;color:#f1e8d8}
    .wish-page-support{
      width:40px;min-width:40px;padding:0;font-size:18px;line-height:1;
      border-color:#b99a6288;color:#e6d7b4;background:#b99a6214;
    }
    .wish-page-support:focus-visible{outline:2px solid #d7c7a0;outline-offset:3px}
    .wish-page-chant-wrap{display:inline-flex;align-items:center;gap:8px;min-width:0}
    .wish-page-chant{border-color:#b99a6288;color:#e6d7b4;background:#b99a6214}
    .wish-page-chant.is-playing{
      border-color:#b99a62;color:#b99a62;
      background:#b99a622e;
      box-shadow:0 0 0 1px #b99a6240;
    }
    .wish-chant-vol{
      display:inline-flex;align-items:center;gap:6px;min-height:36px;padding:0 10px 0 12px;
      border:1px solid #b99a6255;border-radius:999px;background:#ffffff08;color:#d7c7a0;
    }
    .wish-chant-vol input[type="range"]{
      -webkit-appearance:none;appearance:none;width:72px;height:4px;margin:0;padding:0;
      border-radius:999px;background:#b99a6244;outline:none;cursor:pointer;
    }
    .wish-chant-vol input[type="range"]::-webkit-slider-thumb{
      -webkit-appearance:none;appearance:none;width:14px;height:14px;border-radius:50%;
      background:#b99a62;border:0;cursor:pointer;
    }
    .wish-chant-vol input[type="range"]::-moz-range-thumb{
      width:14px;height:14px;border-radius:50%;background:#b99a62;border:0;cursor:pointer;
    }
    .wish-chant-vol-val{
      min-width:2.4em;font:600 11px/1 system-ui,sans-serif;color:#b99a62;
      font-variant-numeric:tabular-nums;text-align:right;
    }
    .wish-temple-switch{
      display:inline-flex;align-items:center;gap:10px;flex:none;min-width:0;
      margin-left:2px;padding-left:12px;border-left:1px solid #ffffff18;
    }
    .wish-temple-select{
      appearance:none;-webkit-appearance:none;
      min-height:36px;max-width:min(42vw,220px);padding:0 28px 0 12px;border-radius:999px;
      border:1px solid #b99a6255;background:#ffffff08 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23d7c7a0' d='M1 1l5 5 5-5'/%3E%3C/svg%3E") no-repeat right 10px center;
      color:#f1e8d8;font:600 13px/1 "Cormorant Garamond","Noto Serif SC",serif;letter-spacing:.02em;
      cursor:pointer;touch-action:manipulation;
    }
    .wish-temple-select:hover,.wish-temple-select:focus-visible{
      border-color:#b99a62;background-color:#b99a6214;outline:none;
    }
    .wish-temple-select option{color:#1a1612;background:#f1e8d8;font-family:system-ui,sans-serif}
    .wish-lang-select{
      appearance:none;-webkit-appearance:none;
      min-height:36px;padding:0 28px 0 12px;border-radius:999px;
      border:1px solid #b99a6255;background:#ffffff08 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23d7c7a0' d='M1 1l5 5 5-5'/%3E%3C/svg%3E") no-repeat right 10px center;
      color:#e6d7b4;font:600 12px/1 system-ui,-apple-system,"PingFang SC",sans-serif;
      cursor:pointer;touch-action:manipulation;
    }
    .wish-lang-select:hover,.wish-lang-select:focus-visible{
      border-color:#b99a62;background-color:#b99a6214;outline:none;
    }
    .wish-lang-select option{color:#1a1612;background:#f1e8d8}
    .visually-hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0;white-space:nowrap}
    .wish-page-hero{
      flex:none;width:min(1080px,calc(100vw - 16px));margin:6px auto 14px;
      display:flex;align-items:baseline;justify-content:center;flex-wrap:wrap;gap:10px 14px;
      text-align:center;
    }
    .wish-page-hero h1{
      margin:0;font:600 40px/1.1 "Cormorant Garamond","Noto Serif SC",serif;color:#f1e8d8;letter-spacing:.02em;
    }
    .wish-page-hero p{
      margin:0;max-width:36em;
      font:400 17px/1.35 system-ui,-apple-system,"PingFang SC",sans-serif;color:#b7a88a;
    }
    #wish-wall-mount{
      flex:none;
      width:min(1080px,calc(100vw - 16px));
      margin:0 auto;
      min-height:0;
    }
    /* Page mode: title lives outside; enlarge UI type for readability */
    body.wish-wall-page .ema-brand{display:none!important}
    body.wish-wall-page .ema-header{
      justify-content:flex-start;padding:12px 16px!important;
    }
    body.wish-wall-page .ema-header-right{
      width:100%;justify-content:flex-start;align-items:center;flex-wrap:nowrap;gap:10px;min-width:0;
    }
    body.wish-wall-page .ema-header .ema-stats{gap:8px;flex:none;flex-wrap:nowrap}
    body.wish-wall-page .ema-header .ema-stat{padding:6px 12px}
    body.wish-wall-page .ema-header .ema-stat span{font-size:12px!important}
    body.wish-wall-page .ema-header .ema-stat strong{font-size:18px!important}
    body.wish-wall-page .wish-temple-switch{flex:none}
    body.wish-wall-page .ema-header .wish-header-feed,
    body.wish-wall-page .ema-header .ema-feed-head{
      display:flex!important;align-items:baseline;flex-wrap:nowrap;gap:10px;
      margin:0 0 0 auto;min-width:0;flex:1;padding-left:8px;
    }
    body.wish-wall-page .ema-header .wish-header-feed h3,
    body.wish-wall-page .ema-header .ema-feed-head h3{
      margin:0;font-size:18px!important;flex:none;white-space:nowrap;color:#F1E8D8;
    }
    body.wish-wall-page .ema-header .wish-header-feed .ema-hint,
    body.wish-wall-page .ema-header .ema-feed-head .ema-hint{
      font-size:13px!important;color:#a8987c!important;margin:0!important;
      flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
    }
    body.wish-wall-page .ema-body{padding:14px 16px 20px;gap:12px}
    body.wish-wall-page .ema-feed > .ema-feed-head{display:none!important}
    body.wish-wall-page .ema-filter{padding:8px 14px;font-size:13px!important}
    body.wish-wall-page .ema-feed-status{font-size:13px!important;margin-bottom:8px}
    body.wish-wall-page .ema-feed.is-empty .ema-feed-status,
    body.wish-wall-page .ema-wish-dialog.is-wish-empty .ema-feed-status{
      font-size:16px!important;margin-top:6px;margin-bottom:0;
    }
    body.wish-wall-page .ema-wish-dialog.is-wish-empty .ema-main{gap:14px!important}
    body.wish-wall-page .ema-wish-dialog.is-wish-empty .ema-feed{min-height:0!important}
    body.wish-wall-page .ema-card{min-height:148px;max-height:200px;padding:14px}
    body.wish-wall-page .ema-card-top{font-size:12px!important}
    body.wish-wall-page .ema-card-text{font-size:15px!important;line-height:1.55!important;-webkit-line-clamp:5}
    body.wish-wall-page .ema-card-foot strong{font-size:12px!important}
    body.wish-wall-page .ema-bless{font-size:12px!important;padding:6px 10px}
    body.wish-wall-page .ema-compose h3{font-size:22px!important}
    body.wish-wall-page .ema-compose .ema-hint{font-size:14px!important}
    body.wish-wall-page .ema-cat{padding:8px 12px;font-size:13px!important;gap:6px}
    body.wish-wall-page .ema-cat .ema-ico{width:14px;height:14px}
    body.wish-wall-page .ema-write textarea{min-height:110px!important;max-height:180px!important;font-size:16px!important;line-height:1.55!important;padding:12px 14px}
    body.wish-wall-page .ema-anon,.wish-wall-page .ema-public{font-size:13px!important}
    body.wish-wall-page .ema-char{font-size:12px!important}
    body.wish-wall-page .ema-submit{min-height:46px;padding:0 20px;font-size:15px!important}
    body.wish-wall-page .ema-foot p{font-size:14px!important;white-space:normal}
    body.wish-wall-page .ema-tab{padding:10px 18px;font-size:14px}
    body.wish-wall-page .ema-wish-backdrop{display:none!important}
    body.wish-wall-page .ema-wish-dialog.wish-wall-dialog,
    body.wish-wall-page .ema-wish-dialog.game-dialog,
    body.wish-wall-page .ema-wish-dialog.is-page-stack{
      position:relative!important;inset:auto!important;margin:0 auto!important;
      width:100%!important;max-width:1080px!important;
      height:auto!important;max-height:none!important;border-radius:16px!important;
      align-self:center;overflow:visible!important;
    }
    body.wish-wall-page .ema-shell{max-height:none!important;height:auto!important;overflow:visible!important}
    body.wish-wall-page .ema-close{display:none!important}
    #support-dialog{
      width:min(420px,calc(100vw - 28px));max-height:min(88vh,640px);padding:18px 18px 16px;
      border:1px solid #5a4a36aa;border-radius:16px;background:#f5f1e8;color:#3d3f36;
      box-shadow:0 24px 60px #00000066;
    }
    #support-dialog::backdrop{background:#100e0bcc;backdrop-filter:blur(4px)}
    #support-dialog header{display:flex;align-items:center;justify-content:space-between;gap:10px;margin:0 0 8px}
    #support-dialog h2{margin:0;font:600 22px/1.2 "Cormorant Garamond","Noto Serif SC",serif;color:#40362B}
    #support-dialog .dialog-close{
      appearance:none;width:36px;height:36px;border:0;border-radius:8px;background:transparent;
      color:#6b6356;font-size:22px;line-height:1;cursor:pointer;
    }
    #support-dialog .dialog-close:hover{background:#00000010}
    #support-dialog .support-description{margin:0 0 4px;font:400 14px/1.5 system-ui,sans-serif;color:#5a6350}
    #support-dialog .cyber-incense-amounts{display:flex;flex-wrap:wrap;gap:8px;justify-content:center;margin:12px 0}
    #support-dialog .solid-button,#support-dialog .cyber-incense-amt{
      appearance:none;min-height:40px;padding:0 14px;border-radius:999px;border:1px solid #8a8068;
      background:#fffdf8;color:#40362B;font:600 13px/1 system-ui,sans-serif;cursor:pointer;
    }
    #support-dialog #cyber-incense-pay{
      width:100%;margin-top:4px;border:0;background:#403326;color:#B99A62;font-weight:650;
    }
    #support-dialog label{display:flex;flex-direction:column;gap:6px;margin:8px 0;font:500 13px/1.3 system-ui,sans-serif;color:#5a6350}
    #support-dialog input{
      padding:8px 10px;border-radius:8px;border:1px solid #8a8068;background:#fffdf8;color:#3d3f36;font:inherit;
    }
    #support-dialog .small-note{margin:10px 0 0;font:400 12px/1.45 system-ui,sans-serif;color:#7a7366}
    #support-dialog .support-qr,#support-dialog #support-link,#support-dialog #support-bmc-divider,#support-dialog #cyber-incense-support{display:none!important}
    .wish-seo{
      position:relative;z-index:2;
      background:linear-gradient(180deg,#171410,#12100c 40%,#100e0b);
      color:#e8e2d4;padding:56px 20px 80px;border-top:1px solid #ffffff10;margin-top:28px;
    }
    .wish-seo-inner{width:min(820px,100%);margin:0 auto}
    .wish-seo h2[data-wish-i18n="wish.seo.h1"]{margin:0 0 14px;font:600 32px/1.2 "Cormorant Garamond","Noto Serif SC",serif;color:#f2eadc}
    .wish-seo h2{margin:40px 0 12px;font:600 26px/1.25 "Cormorant Garamond","Noto Serif SC",serif;color:#f2eadc}
    .wish-seo h3{margin:24px 0 8px;font:600 20px/1.3 "Cormorant Garamond","Noto Serif SC",serif;color:#e7dfcf}
    .wish-seo p,.wish-seo li{font:400 15px/1.75 system-ui,-apple-system,"PingFang SC",sans-serif;color:#c9c2b2}
    .wish-seo ul,.wish-seo ol{padding-left:1.2em;margin:0 0 8px}
    .wish-seo a{color:#c4a86a;text-decoration:underline;text-underline-offset:3px}
    .wish-seo details{margin:0 0 10px;padding:12px 14px;border:1px solid #ffffff14;border-radius:10px;background:#1d1914}
    .wish-seo summary{cursor:pointer;font:600 15px/1.4 system-ui,sans-serif;color:#e7dfcf}
    .wish-seo details p{margin:8px 0 0}
    @media (max-width:720px){
      .wish-page-bar{gap:8px}
      .wish-page-chant{padding:0 12px}
      .wish-chant-vol{padding:0 8px 0 10px}
      .wish-chant-vol input[type="range"]{width:56px}
      .wish-temple-switch{padding-left:10px;gap:8px}
      .wish-temple-select{font-size:12px;max-width:34vw;padding:0 24px 0 10px}
      .wish-page-hero{width:calc(100% - 24px);margin:4px 12px 12px;gap:6px 10px}
      .wish-page-hero h1{font-size:30px}
      .wish-page-hero p{font-size:14px}
      #wish-wall-mount{width:100%}
      body.wish-wall-page .ema-wish-dialog.wish-wall-dialog,
      body.wish-wall-page .ema-wish-dialog.is-page-stack{
        width:100%!important;border-radius:12px 12px 0 0!important;
        height:auto!important;max-height:none!important;
      }
      body.wish-wall-page .ema-header .ema-stat span{font-size:11px!important}
      body.wish-wall-page .ema-header .ema-stat strong{font-size:15px!important}
      body.wish-wall-page .ema-header-right{gap:8px;overflow:hidden}
      body.wish-wall-page .ema-header .wish-header-feed h3{font-size:15px!important}
      body.wish-wall-page .ema-header .wish-header-feed .ema-hint{font-size:12px!important}
      body.wish-wall-page .wish-temple-select{max-width:28vw}
      body.wish-wall-page .ema-card-text{font-size:14px!important}
      .wish-seo{padding:40px 16px 72px;margin-top:18px}
      .wish-seo h2[data-wish-i18n="wish.seo.h1"]{font-size:26px}
      .wish-seo h2{font-size:22px}
    }


/* Ema wall UI (page copy) */

.wish-wall-labels{position:fixed;inset:0;pointer-events:none;z-index:4}
.wish-wall-label{position:fixed;left:0;top:0;pointer-events:auto;margin:0;padding:7px 14px;border:1px solid #efe6d26a;border-radius:999px;background:#2a352ccc;color:#f6f0e2;font:600 13px/1.2 system-ui,sans-serif;letter-spacing:.04em;cursor:pointer;box-shadow:0 8px 24px #0a120c55;backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px);z-index:4}
.wish-wall-label:hover,.wish-wall-label:focus-visible{background:#354338e6;outline:none}
/* Beads / dialogs: fixed wish labels sit above the game shell and steal taps */
.is-beading .wish-wall-labels,
.is-beading .wish-wall-label,
/* Use body class — :has([open]) can stick on some iOS WebKits after close */
body.cs-wish-open .wish-wall-labels,
body.cs-wish-open .wish-wall-label{
  display:none!important;pointer-events:none!important;visibility:hidden!important
}

/* Beads host: stay UNDER header while idle so iOS hit-testing reaches room/exit.
   Only lift above chrome when actually beading. */
#beads-host{
  position:absolute;inset:0;z-index:2;pointer-events:none;
}
.sansa-game.is-beading #beads-host,
#beads-host:has(.sansa-beads-view:not([hidden])),
#beads-host:has(.sansa-beads-view.is-visible){
  z-index:80!important;
  pointer-events:auto!important;
}
.sansa-beads-view{
  z-index:80!important;
  pointer-events:auto!important;
}
.beads-header{
  z-index:5!important;
  top:max(14px,calc(env(safe-area-inset-top,0px) + 12px))!important;
  left:max(12px,env(safe-area-inset-left,0px))!important;
  right:max(12px,env(safe-area-inset-right,0px))!important;
  pointer-events:none!important;
}
.beads-back,.beads-sound{
  pointer-events:auto!important;
  touch-action:manipulation!important;
  -webkit-tap-highlight-color:transparent;
  position:relative;
  z-index:6;
}
.beads-back{
  min-height:48px!important;
  min-width:96px!important;
  padding:0 16px 0 12px!important;
}

.ema-wish-backdrop{position:fixed;inset:0;z-index:40;background:#0c0a08c7;backdrop-filter:blur(3px);-webkit-backdrop-filter:blur(3px)}
/* Game CSS dialog-in only has 0%{opacity:0} — on iOS it freezes there (tap → blue lens, no panel).
   Kill the animation entirely and force visible. */
@keyframes dialog-in{
  0%{opacity:1;transform:none}
  100%{opacity:1;transform:none}
}
.game-dialog[open],
dialog.game-dialog[open],
dialog[open].game-dialog,
#room-dialog[open],
#settings-dialog[open],
#people-dialog[open],
#support-dialog[open],
#wish-wall-dialog[open],

.ema-wish-dialog.wish-wall-dialog[open],
.ema-wish-dialog.game-dialog[open]{
  opacity:1!important;
  transform:none!important;
  visibility:visible!important;
  animation:none!important;
}
/* Phone: room picker must be a readable full-width sheet with probe list */
@media (max-width:820px){
  #room-dialog.game-dialog,
  #room-dialog[open]{
    width:calc(100vw - 16px)!important;
    max-width:calc(100vw - 16px)!important;
    max-height:min(88dvh,760px)!important;
    margin:max(12px,env(safe-area-inset-top,0px)) auto max(12px,env(safe-area-inset-bottom,0px))!important;
    padding:18px 14px 16px!important;
    box-sizing:border-box;
  }
  #room-dialog .room-list{
    grid-template-columns:1fr!important;
    max-height:min(58dvh,520px)!important;
    gap:10px!important;
  }
  #room-dialog .room-choice{
    min-height:64px!important;
    padding:12px 14px!important;
  }
  #room-dialog .room-directory-heading{
    flex-wrap:wrap;gap:8px;font-size:14px!important
  }
  #room-dialog #room-refresh{
    min-height:40px!important;padding:0 12px!important;font-weight:600
  }
}
.ema-wish-dialog.wish-wall-dialog,.ema-wish-dialog.game-dialog{
  width:min(1080px,calc(100vw - 24px));max-width:1080px;height:min(720px,85vh);max-height:85vh;padding:0;
  border:1px solid #5a4a36aa;border-radius:16px;background:#29251F;color:#F1E8D8;
  overflow:hidden;box-shadow:0 28px 90px #00000099, inset 0 1px 0 #ffffff0d;
  opacity:1;
  animation:dialog-in .25s cubic-bezier(.22,1,.36,1) forwards;
}
.ema-wish-dialog::backdrop{background:#0c0a08cc;-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px)}
.ema-shell{display:flex;flex-direction:column;height:100%;max-height:85vh;position:relative;background:
  radial-gradient(120% 80% at 50% -10%,#3a3228 0%,#29251F 55%);overflow:hidden}
.ema-header{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 16px;border-bottom:1px solid #403326;background:linear-gradient(180deg,#342c24,#29251Fee);z-index:3;flex:none}
.ema-brand{display:flex;gap:10px;align-items:center;min-width:0}
.ema-lotus{display:inline-flex;width:28px;height:28px;flex:none;color:#B99A62;opacity:.92}
.ema-lotus svg{width:100%;height:100%;display:block}
.ema-header h2{margin:0;font:600 22px/1.1 "Cormorant Garamond","Noto Serif SC",serif;color:#F1E8D8;letter-spacing:.02em}
.ema-sub{margin:2px 0 0;font:400 12px/1.3 system-ui,-apple-system,"PingFang SC",sans-serif;color:#8B7B65}
.ema-header-right{display:flex;align-items:center;gap:8px;flex:none}
.ema-count-pill{font:600 11px/1 system-ui,sans-serif;color:#B99A62;border:1px solid #B99A6244;padding:6px 10px;border-radius:999px;background:#40332655;white-space:nowrap}
.ema-close{flex:none;min-width:36px;min-height:36px;border:0;background:transparent;color:#F1E8D8;font-size:22px;line-height:1;cursor:pointer;border-radius:8px}
.ema-close:hover,.ema-close:focus-visible{background:#ffffff12;outline:none}

.ema-body{flex:1;min-height:0;display:flex;flex-direction:column;padding:10px 14px 12px;gap:10px;overflow:hidden}
.ema-stats{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;flex:none}
.ema-stat{padding:8px 10px;border-radius:8px;background:#40332655;border:1px solid #5a4a3633}
.ema-stat span{display:block;font:500 10px/1.2 system-ui,sans-serif;color:#8B7B65;letter-spacing:.04em;text-transform:uppercase}
.ema-stat strong{display:block;margin-top:4px;font:600 20px/1 "Cormorant Garamond",serif;color:#B99A62}

.ema-tabs{display:flex;gap:6px;flex:none}
.ema-tab{padding:8px 18px;border-radius:999px;border:1px solid #5a4a36;background:transparent;color:#D9CBB5;font:600 13px/1 system-ui,sans-serif;cursor:pointer}
.ema-tab.is-active{border-color:#B99A62;color:#B99A62;background:#B99A6214}

.ema-main{flex:1;min-height:0;display:flex;flex-direction:column;overflow:hidden}

.ema-compose{margin:0;padding:14px 14px 12px;border-radius:12px;background:linear-gradient(180deg,#F6EEE0,#F1E8D8 40%,#EADFCC);color:#40362B;box-shadow:inset 0 0 0 1px #D9CBB5,0 8px 22px #00000033;position:relative;display:flex;flex-direction:column;min-height:0;overflow:auto;flex:1}
.ema-compose::before{content:"";position:absolute;inset:8px;border:1px solid #D9CBB566;border-radius:8px;pointer-events:none}
.ema-compose h3{margin:0 0 4px;font:600 20px/1.15 "Cormorant Garamond","Noto Serif SC",serif;color:#40362B;position:relative;flex:none}
.ema-hint{margin:0 0 10px;font:400 12px/1.4 system-ui,-apple-system,"PingFang SC",sans-serif;color:#8B7B65;position:relative}
.ema-cats{display:flex;flex-wrap:wrap;gap:6px;margin:0 0 10px;position:relative;flex:none}
.ema-cat{display:inline-flex;align-items:center;gap:5px;padding:6px 9px;border-radius:999px;border:1px solid #D9CBB5;background:#fffdf8aa;color:#40362B;font:600 11px/1 system-ui,sans-serif;cursor:pointer}
.ema-cat em{font-style:normal}
.ema-cat .ema-ico{display:inline-flex;width:12px;height:12px;opacity:.75}
.ema-cat .ema-ico svg{width:100%;height:100%}
.ema-cat.is-active{border-color:#B99A62;color:#6d5428;box-shadow:inset 0 0 0 1px #B99A62;background:#f7efd8}
.ema-cat.is-active .ema-ico{opacity:1;color:#B99A62}
.ema-write{display:block;position:relative;flex:1;min-height:0}
.ema-write textarea{width:100%;height:100%;min-height:84px;max-height:140px;box-sizing:border-box;padding:10px 12px;border:1px solid #D9CBB5;border-radius:8px;background:#fffdf8;color:#40362B;font:400 14px/1.5 "Noto Serif SC","Noto Serif",serif;resize:none;outline:none}
.ema-write textarea:focus{border-color:#B99A62;box-shadow:0 0 0 3px #B99A6222}
.ema-compose-bar{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-top:10px;flex-wrap:wrap;position:relative;flex:none}
.ema-compose-left{display:flex;align-items:center;gap:12px;flex-wrap:wrap}
.ema-anon,.ema-public{display:inline-flex;align-items:center;gap:6px;font:500 12px/1 system-ui,sans-serif;color:#8B7B65;cursor:pointer}
.ema-anon input,.ema-public input{accent-color:#403326;width:14px;height:14px}
.ema-char{font:500 11px/1 system-ui,sans-serif;color:#8B7B65;font-variant-numeric:tabular-nums}
.ema-submit{min-height:40px;padding:0 16px;border:0;border-radius:999px;background:#403326;color:#B99A62;font:650 13px/1 system-ui,sans-serif;cursor:pointer;transition:box-shadow .22s ease,background .15s}
.ema-submit:hover{box-shadow:0 0 18px #B99A6255;background:#4a3b2c}
.ema-submit.is-loading{opacity:.72;pointer-events:none}
.ema-submit.is-loading::after{content:"";display:inline-block;width:11px;height:11px;margin-left:7px;border:2px solid #B99A6644;border-top-color:#B99A62;border-radius:50%;animation:emaSpin .7s linear infinite;vertical-align:-1px}
.wish-status{margin:8px 0 0;font-size:12px;color:#8B7B65;position:relative;flex:none}
.wish-status.is-error{color:#c46a55}

.ema-feed{min-height:0;display:flex;flex-direction:column;overflow:hidden;padding:2px 2px 0;flex:1}
.ema-feed-head{flex:none}
.ema-feed h3{margin:0 0 2px;font:600 18px/1.15 "Cormorant Garamond","Noto Serif SC",serif;color:#F1E8D8}
.ema-feed .ema-hint{margin:0 0 8px;color:#8B7B65;display:-webkit-box;-webkit-line-clamp:1;-webkit-box-orient:vertical;overflow:hidden}
.ema-filters{display:flex;flex-wrap:wrap;gap:6px;margin:0 0 8px;flex:none}
.ema-filter{padding:5px 10px;border-radius:999px;border:1px solid #5a4a36;background:transparent;color:#D9CBB5;font:600 11px/1 system-ui,sans-serif;cursor:pointer}
.ema-filter.is-active{border-color:#B99A62;color:#B99A62;background:#B99A6214}
.ema-feed-status{margin:0 0 6px;font:400 12px/1.3 system-ui,sans-serif;color:#8B7B65;min-height:1em;flex:none}
.ema-feed-scroll{flex:1;min-height:0;overflow:auto;padding-right:2px;scrollbar-width:thin;scrollbar-color:#5a4a36 transparent;-webkit-overflow-scrolling:touch}
.ema-feed-scroll::-webkit-scrollbar{width:6px}
.ema-feed-scroll::-webkit-scrollbar-thumb{background:#5a4a36aa;border-radius:6px}

.ema-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;align-content:start}
.ema-card{position:relative;display:flex;flex-direction:column;gap:8px;min-height:118px;max-height:150px;padding:12px 12px 10px;border-radius:8px;color:#40362B;
  background:
    radial-gradient(circle at 50% 7px,#00000022 0 2.5px,transparent 3.5px),
    repeating-linear-gradient(92deg,#00000008 0 1px,transparent 1px 7px),
    linear-gradient(145deg,#d8be95 0%,#C9AD82 46%,#b89768 100%);
  box-shadow:0 8px 16px #00000044, inset 0 1px 0 #ffffff33;
  transform:rotate(calc((var(--r,0) - .5)*1.6deg))}
.ema-card:nth-child(3n+1){--r:.18}.ema-card:nth-child(3n+2){--r:.72}.ema-card:nth-child(3n){--r:.44}
.ema-card-top{display:flex;align-items:center;gap:6px;font:600 10px/1 system-ui,sans-serif;color:#6d5428;letter-spacing:.04em;text-transform:uppercase;flex:none}
.ema-card-icon{display:inline-flex;width:12px;height:12px;opacity:.85;color:#6d5428}
.ema-card-icon svg{width:100%;height:100%}
.ema-card-text{margin:0;flex:1;min-height:0;overflow:hidden;font:400 13px/1.45 "Noto Serif SC","Noto Serif",serif;white-space:pre-wrap;word-break:break-word;display:-webkit-box;-webkit-line-clamp:4;-webkit-box-orient:vertical}
.ema-card-foot{display:flex;align-items:flex-end;justify-content:space-between;gap:6px;flex:none}
.ema-card-foot strong{display:block;font:650 11px/1.2 system-ui,sans-serif;color:#40362B}
.ema-card-foot time{display:block;margin-top:2px;font:400 10px/1 system-ui,sans-serif;color:#8B7B65}
.ema-bless{border:0;background:#00000012;color:#6d5428;border-radius:999px;padding:5px 8px;font:600 11px/1 system-ui,sans-serif;cursor:pointer;display:inline-flex;align-items:center;gap:4px}
.ema-bless svg{width:11px;height:11px}
.ema-bless.is-active{color:#8a3d2f;background:#8a3d2f1c}
.ema-bless.is-active svg{fill:currentColor}

.ema-foot{margin-top:8px;padding-top:6px;text-align:center;color:#8B7B65;flex:none;border-top:1px solid #40332666}
.ema-foot p{margin:0;font:400 12px/1.4 "Cormorant Garamond","Noto Serif SC",serif;font-style:italic;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ema-foot-ornament{display:none}

.ema-success{position:absolute;inset:0;z-index:5;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;padding:24px;background:#29251Ff5;text-align:center}
.ema-success[hidden]{display:none!important}
.ema-success.is-show{animation:emaIn .7s ease}
.ema-success-glow{position:absolute;width:200px;height:200px;border-radius:50%;background:radial-gradient(circle,#B99A6238,transparent 68%);pointer-events:none;animation:emaGlow 1.4s ease}
.ema-card-success{width:min(260px,78%);z-index:1;animation:emaFloat .85s ease;transform:none!important;max-height:none}
.ema-success h3{margin:8px 0 0;font:600 22px/1.25 "Cormorant Garamond","Noto Serif SC",serif;color:#F1E8D8;z-index:1}
.ema-success p{margin:0;color:#8B7B65;z-index:1;font:400 13px/1.45 system-ui,sans-serif}
.ema-return{z-index:1;margin-top:6px;min-height:40px;padding:0 18px;border-radius:999px;border:1px solid #B99A62;background:transparent;color:#B99A62;font:650 13px/1 system-ui,sans-serif;cursor:pointer}
.visually-hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}
@keyframes emaIn{from{opacity:0}to{opacity:1}}
@keyframes emaFloat{from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:translateY(0)}}
@keyframes emaGlow{from{opacity:0;transform:scale(.82)}to{opacity:1;transform:scale(1)}}
@keyframes emaSpin{to{transform:rotate(360deg)}}

@media (max-width:900px){
  .ema-wish-dialog.wish-wall-dialog{width:calc(100vw - 14px);height:min(760px,90vh);max-height:90vh;border-radius:14px}
  .ema-shell{max-height:90vh}
  .ema-grid{grid-template-columns:1fr}
}
@media (max-width:720px){
  /* True edge-to-edge sheet — kills the thin white side/top gap from
     native <dialog> centering + .game-dialog light borders */
  .ema-wish-dialog.wish-wall-dialog,
  .ema-wish-dialog.game-dialog,
  dialog#wish-wall-dialog{
    position:fixed!important;
    inset:0!important;
    left:0!important;right:0!important;top:0!important;bottom:0!important;
    width:100%!important;width:100dvw!important;
    max-width:none!important;
    height:100%!important;height:100dvh!important;
    max-height:none!important;
    margin:0!important;
    padding:0!important;
    border:0!important;
    border-radius:0!important;
    box-shadow:none!important;
    box-sizing:border-box!important;
    opacity:1!important;transform:none!important;
    animation:none!important;
  }
  .ema-wish-dialog.wish-wall-dialog[open],
  .ema-wish-dialog.game-dialog[open],
  dialog#wish-wall-dialog[open]{
    opacity:1!important;transform:none!important;
  }
  .ema-wish-dialog::backdrop,
  dialog#wish-wall-dialog::backdrop{
    background:#29251F!important;
  }
  .ema-wish-backdrop{background:#29251F;display:none!important}
  .ema-shell{max-height:none!important;height:100%!important;min-height:100%;border:0;border-radius:0}
  .ema-header{
    padding:10px 12px;
    padding-top:max(10px,env(safe-area-inset-top,0px));
    border-radius:0;
  }
  .ema-header h2{font-size:18px}
  .ema-count-pill{display:none}
  .ema-body{padding:8px 10px max(12px,env(safe-area-inset-bottom,0px));gap:8px;overflow:auto}
  .ema-compose{overflow:visible}
  .ema-write textarea{max-height:96px;min-height:72px;height:72px}
  .ema-feed{min-height:220px}
  .ema-feed-scroll{max-height:none}
  .ema-feed .ema-hint{display:none}
  .ema-submit{width:100%}
  .ema-compose-bar{align-items:stretch}
  .ema-compose-left{width:100%;justify-content:space-between}
  .ema-grid{grid-template-columns:1fr}
  .ema-foot p{white-space:normal}
}


/* SEO landing → temple handoff overrides */
html.sansa-in-temple,
body.sansa-in-temple{
  height:100%!important;
  height:100dvh!important;
  min-height:-webkit-fill-available;
  max-height:none!important;
  overflow:hidden!important;
  overscroll-behavior:none!important;
}
body.sansa-in-temple #sansa-game-shell,
body.sansa-in-temple #app{
  height:100%!important;
  height:100dvh!important;
  min-height:-webkit-fill-available;
  max-height:none!important;
  overflow:hidden!important;
}
body.sansa-in-temple #sansa-seo{display:none!important}
html.sansa-landing-active{
  overflow:auto!important;
  overflow-y:scroll!important;
  height:auto!important;
  max-height:none!important;
}
body.sansa-landing-active{
  overflow:auto!important;
  overflow-x:hidden!important;
  height:auto!important;
  max-height:none!important;
  min-height:100dvh;
}
body.sansa-landing-active #app{
  height:100dvh!important;
  overflow:hidden!important;
}
body.sansa-landing-active #sansa-seo{
  position:relative;
  z-index:2;
}
#sansa-seo{position:relative;z-index:2}


/* hide retired game-nav */
#game-nav,.game-tools #game-nav{display:none!important}


/* Landing feature chips (mobile polish shared) */
body.sansa-landing-active .sansa-game-shell canvas{opacity:1}


/* Dedicated /wish-wall/ page: plaques first, write form below, page scrolls */
body.wish-wall-page .ema-wish-dialog.is-page-stack,
body.wish-wall-page dialog#wish-wall-dialog.is-page-stack{
  height:auto!important;
  max-height:none!important;
  overflow:visible!important;
  position:relative!important;
  inset:auto!important;
}
body.wish-wall-page .ema-wish-dialog.is-page-stack .ema-shell{
  height:auto!important;
  max-height:none!important;
  overflow:visible!important;
}
body.wish-wall-page .ema-wish-dialog.is-page-stack .ema-tabs{display:none!important}
body.wish-wall-page .ema-wish-dialog.is-page-stack .ema-body{
  overflow:visible!important;
  height:auto!important;
  min-height:0;
}
body.wish-wall-page .ema-wish-dialog.is-page-stack .ema-main{
  overflow:visible!important;
  height:auto!important;
  display:flex!important;
  flex-direction:column!important;
  gap:28px;
}
/* Always: others' wishes first, write form below */
body.wish-wall-page .ema-wish-dialog.is-page-stack .ema-feed{
  order:1;
  flex:none!important;
  overflow:visible!important;
  height:auto!important;
  min-height:min(42vh,420px);
}
body.wish-wall-page .ema-wish-dialog.is-page-stack .ema-compose{
  order:2;
  flex:none!important;
  overflow:visible!important;
  height:auto!important;
  min-height:0;
  margin-top:4px;
}
body.wish-wall-page .ema-wish-dialog.is-page-stack .ema-feed-scroll{
  flex:none!important;
  overflow:visible!important;
  max-height:none!important;
  min-height:160px;
}
/* Empty: collapse dead space, pull write form up */
body.wish-wall-page .ema-wish-dialog.is-page-stack.is-wish-empty .ema-main,
.ema-wish-dialog.is-wish-empty .ema-main{
  gap:14px!important;
}
body.wish-wall-page .ema-wish-dialog.is-page-stack.is-wish-empty .ema-feed,
.ema-wish-dialog.is-wish-empty .ema-feed,
body.wish-wall-page .ema-wish-dialog.is-page-stack .ema-feed.is-empty{
  min-height:0!important;
}
body.wish-wall-page .ema-wish-dialog.is-page-stack.is-wish-empty .ema-feed-scroll,
.ema-wish-dialog.is-wish-empty .ema-feed-scroll,
body.wish-wall-page .ema-wish-dialog.is-page-stack .ema-feed.is-empty .ema-feed-scroll{
  min-height:0!important;
  display:none!important;
}
.ema-feed.is-empty .ema-feed-status,
.ema-wish-dialog.is-wish-empty .ema-feed-status{
  display:flex;align-items:center;justify-content:center;
  min-height:72px;margin:4px 0 0;padding:18px 16px;
  border:1px dashed #b99a6244;border-radius:12px;background:#ffffff08;
  text-align:center;font:500 15px/1.45 system-ui,-apple-system,"PingFang SC",sans-serif;color:#d7c7a0!important;
}
.ema-feed.is-empty .ema-foot,
.ema-wish-dialog.is-wish-empty .ema-foot{
  margin-top:10px;padding-top:0;border-top:0;
}
.ema-wish-dialog.is-wish-empty .ema-compose{
  margin-top:0;
}
body.wish-wall-page .ema-wish-dialog.is-page-stack .ema-grid{
  grid-template-columns:repeat(auto-fill,minmax(220px,1fr));
  gap:12px;
}
body.wish-wall-page .ema-wish-dialog.is-page-stack .ema-header-right{
  display:flex;align-items:center;flex-wrap:nowrap;gap:10px;min-width:0;width:100%;
}
body.wish-wall-page .ema-wish-dialog.is-page-stack .ema-header .wish-header-feed{
  display:flex;align-items:baseline;flex-wrap:nowrap;gap:10px;
  margin:0 0 0 auto;min-width:0;flex:1;
}
body.wish-wall-page .ema-wish-dialog.is-page-stack .ema-header .wish-header-feed h3{
  margin:0;flex:none;white-space:nowrap;
  font:600 18px/1.15 "Cormorant Garamond","Noto Serif SC",serif;color:#F1E8D8;
}
body.wish-wall-page .ema-wish-dialog.is-page-stack .ema-header .wish-header-feed .ema-hint{
  display:block;margin:0;min-width:0;flex:1;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#8B7B65;
}
body.wish-wall-page .ema-wish-dialog.is-page-stack .ema-feed > .ema-feed-head{display:none!important}
body.wish-wall-page .ema-wish-dialog.is-page-stack .ema-write textarea{
  height:96px;
  max-height:140px;
}
@media (max-width:720px){
  body.wish-wall-page .ema-wish-dialog.is-page-stack,
  body.wish-wall-page dialog#wish-wall-dialog.is-page-stack{
    position:relative!important;
    inset:auto!important;
    width:100%!important;
    height:auto!important;
    max-height:none!important;
    border-radius:12px 12px 0 0!important;
  }
}

