:root{
    --wood-dark:#241509;
    --wood-mid:#3d2412;
    --wood-light:#5a3820;
    --lacquer:#7c2e28;
    --lacquer-light:#a54338;
    --brass:#c9a227;
    --brass-light:#f0d27a;
    --parchment:#ede4d3;
    --jade:#3e8564;
    --void:#0a0705;
  }
  *{box-sizing:border-box;}
  html,body{
    margin:0;
    min-height:100%;
    overscroll-behavior:none;
    -webkit-user-select:none;
    user-select:none;
    background:
      radial-gradient(ellipse at 50% -10%, #4a2f1a 0%, transparent 60%),
      repeating-linear-gradient(90deg, var(--wood-dark) 0 3px, var(--wood-mid) 3px 6px);
    font-family:'Zen Kaku Gothic New', sans-serif;
    color:var(--parchment);
    display:flex;
    align-items:flex-start;
    justify-content:center;
    padding:calc(24px + env(safe-area-inset-top)) calc(12px + env(safe-area-inset-right)) calc(60px + env(safe-area-inset-bottom)) calc(12px + env(safe-area-inset-left));
    transition:background .4s ease;
  }
  body.theme-europe{
    background:
      radial-gradient(ellipse at 50% -10%, #33465a 0%, transparent 60%),
      repeating-linear-gradient(90deg, #14181f 0 3px, #1d232c 3px 6px);
  }
  .wrap{
    width:100%;
    max-width:680px;
  }
  header{
    text-align:center;
    margin-bottom:14px;
  }
  h1{
    font-family:'Shippori Mincho', serif;
    font-weight:800;
    font-size:clamp(24px,5vw,34px);
    margin:0 0 4px;
    letter-spacing:.08em;
    color:var(--brass-light);
    text-shadow:0 2px 0 #000, 0 0 18px rgba(201,162,39,.35);
    transition:color .4s ease;
  }
  body.theme-europe h1{
    font-family:'Cinzel', serif;
    color:#dfe8f0;
    text-shadow:0 2px 0 #000, 0 0 18px rgba(140,180,220,.4);
  }
  .sub{
    font-size:12px;
    letter-spacing:.25em;
    color:#c8b48f;
    opacity:.8;
  }
  .hud{
    display:flex;
    flex-wrap:wrap;
    gap:8px;
    justify-content:center;
    margin:14px 0 10px;
  }
  .pill{
    background:linear-gradient(180deg,#3a2313,#241407);
    border:1px solid #6b4a25;
    border-radius:999px;
    padding:6px 14px;
    font-size:13px;
    display:flex;
    align-items:center;
    gap:6px;
    box-shadow:inset 0 1px 0 rgba(255,255,255,.08), 0 2px 4px rgba(0,0,0,.4);
  }
  .pill b{color:var(--brass-light);font-weight:700;}
  .pill.hidden{display:none;}
  select, button{
    font-family:inherit;
    font-size:13px;
    background:linear-gradient(180deg,#4a2f18,#2b1a0c);
    color:var(--parchment);
    border:1px solid #6b4a25;
    border-radius:999px;
    padding:6px 14px;
    cursor:pointer;
    box-shadow:inset 0 1px 0 rgba(255,255,255,.08), 0 2px 4px rgba(0,0,0,.4);
  }
  button:hover, select:hover{border-color:var(--brass);}
  button:active{transform:translateY(1px);}
  .toast{
    text-align:center;
    height:20px;
    font-size:13px;
    color:var(--brass-light);
    letter-spacing:.1em;
    opacity:0;
    transition:opacity .25s ease;
    margin-bottom:4px;
  }
  .toast.show{opacity:1;}
  .field-banner{position:fixed;left:50%;top:22%;z-index:45;pointer-events:none;transform:translate(-50%,-12px) scale(.94);opacity:0;padding:12px 28px;border:1px solid rgba(240,210,122,.65);border-radius:999px;background:rgba(18,12,9,.88);color:#fff2c4;font-family:'Shippori Mincho',serif;font-size:22px;font-weight:800;letter-spacing:.16em;text-shadow:0 2px 4px #000;box-shadow:0 8px 28px rgba(0,0,0,.55);transition:opacity .25s,transform .25s;}
  .save-pill{font-size:10px;min-width:72px;text-align:center;transition:border-color .2s,color .2s,box-shadow .2s;}
  .save-pill.saved{color:#bfffd8;border-color:#65c88a;box-shadow:0 0 12px rgba(101,200,138,.35);}
  .field-banner.show{opacity:1;transform:translate(-50%,0) scale(1);}
  .field-banner.ice{border-color:#c9f3ff;background:rgba(24,70,94,.9);color:#ecfbff;box-shadow:0 0 28px rgba(140,225,255,.55);}
  .field-banner.gear{border-color:#e1b95b;background:rgba(59,43,24,.94);color:#ffe08f;box-shadow:0 0 28px rgba(210,159,57,.5);}

  .frame{
    position:relative;
    margin:0 auto;
    padding:16px;
    border-radius:10px;
    background:
      linear-gradient(145deg, var(--wood-light), var(--wood-dark) 60%);
    box-shadow:
      0 10px 30px rgba(0,0,0,.55),
      inset 0 0 0 2px #1a0f05,
      inset 0 0 40px rgba(0,0,0,.5);
    width:fit-content;
    max-width:100%;
    transition:background .4s ease;
  }
  body.theme-europe .frame{
    background:linear-gradient(145deg, #3d4a58, #1a2129 60%);
    box-shadow:
      0 10px 30px rgba(0,0,0,.55),
      inset 0 0 0 2px #0a0d11,
      inset 0 0 40px rgba(0,0,0,.5);
  }
  body.theme-europe .frame::before{ border-color:#0a0d11; }
  body.theme-europe .corner{
    background:radial-gradient(circle at 35% 30%, #e8eef5, #9fb3c4 55%, #4a5866 100%);
  }
  .frame::before{
    content:"";
    position:absolute;inset:6px;
    border:2px solid #1a0f05;
    border-radius:6px;
    pointer-events:none;
  }
  .corner{
    position:absolute;
    width:16px;height:16px;
    border-radius:50%;
    background:radial-gradient(circle at 35% 30%, var(--brass-light), var(--brass) 55%, #7a5f14 100%);
    box-shadow:0 1px 2px rgba(0,0,0,.6), inset 0 0 2px rgba(0,0,0,.5);
  }
  .corner.tl{top:6px;left:6px;} .corner.tr{top:6px;right:6px;}
  .corner.bl{bottom:6px;left:6px;} .corner.br{bottom:6px;right:6px;}

  canvas{
    display:block;
    max-width:100%;
    height:auto;
    border-radius:3px;
    touch-action:none;
    cursor:grab;
  }
  canvas:active{cursor:grabbing;}

  footer{
    text-align:center;
    margin-top:16px;
    font-size:12px;
    color:#c8b48f;
    line-height:1.8;
  }
  .controls-row{
    display:flex;
    gap:8px;
    justify-content:center;
    margin-top:10px;
    flex-wrap:wrap;
  }
  kbd{
    background:#241407;
    border:1px solid #6b4a25;
    border-radius:4px;
    padding:1px 6px;
    font-size:11px;
    color:var(--brass-light);
  }
  .treasure-log{
    max-width:480px;
    margin:14px auto 0;
    display:flex;
    flex-direction:column;
    gap:4px;
  }
  .treasure-log .item{
    font-size:12px;
    background:rgba(0,0,0,.25);
    border:1px solid rgba(201,162,39,.25);
    border-radius:6px;
    padding:5px 10px;
    display:flex;
    justify-content:space-between;
    gap:8px;
  }
  .treasure-log .item .name{color:var(--parchment); display:flex; align-items:center; gap:5px;}
  .treasure-log .item .name svg{flex-shrink:0;}
  .item-sprite{
    display:inline-block;
    width:30px;height:30px;
    flex:0 0 30px;
    vertical-align:middle;
    background-image:url('assets/karakuri-items-v1.png');
    background-size:400% 300%;
    background-repeat:no-repeat;
    filter:drop-shadow(0 1px 2px rgba(0,0,0,.75));
  }
  .item-single-sprite{
    display:inline-block;
    width:30px;height:30px;
    flex:0 0 30px;
    vertical-align:middle;
    background-size:contain;
    background-position:center;
    background-repeat:no-repeat;
    filter:drop-shadow(0 1px 2px rgba(0,0,0,.75));
  }
  .silver-hinge-sprite{background-image:url('assets/silver-hinge-v1.png');}
  .controls-row .hidden{display:none!important;}
  .attack-row .hidden{display:none!important;}
  .attack-row{display:flex;justify-content:flex-end;align-items:center;gap:10px;max-width:620px;margin:10px auto 0;padding:0 4px;}
  #needleBtn{position:static;width:78px;height:78px;flex:0 0 78px;border-radius:50%;padding:5px;font-size:12px;font-weight:700;line-height:1.25;touch-action:manipulation;opacity:.9;}
  #needleBtn.ready{border:2px solid #fff0a8;box-shadow:0 0 18px rgba(240,210,122,.65),inset 0 0 12px rgba(255,255,255,.12);}
  #needleBtn.attacking{background:linear-gradient(180deg,#c55a3e,#5d1f18);color:#fff3cf;transform:scale(1.08);}
  #needleBtn:disabled{opacity:.5;cursor:not-allowed;}
  #companionAbilityBtn{min-width:118px;height:64px;border-radius:18px;padding:6px 12px;font-size:12px;font-weight:700;line-height:1.35;touch-action:manipulation;}
  .mobile-pad{display:none;width:190px;margin:10px auto 4px;grid-template-columns:repeat(3,58px);grid-template-rows:repeat(3,58px);gap:7px;justify-content:center;touch-action:none;user-select:none;}
  .mobile-pad button{width:58px;height:58px;margin:0;padding:0;border-radius:16px;font-size:22px;font-weight:900;touch-action:none;-webkit-tap-highlight-color:transparent;}
  .mobile-pad .pad-center{font-size:15px;color:#9e8251;}
  .mobile-pad button.pressed{transform:translateY(2px) scale(.96);border-color:#fff0a8;background:linear-gradient(180deg,#8c493d,#4b251d);box-shadow:0 0 16px rgba(240,210,122,.5);}
  @media(hover:none),(pointer:coarse){
    .mobile-pad{display:grid;}
    .controls-row button{min-height:44px;}
    select,.hud button{min-height:40px;}
  }
  #companionAbilityBtn.ready{border-color:#9fe8ff;box-shadow:0 0 16px rgba(120,220,255,.55),inset 0 0 10px rgba(255,255,255,.1);}
  #companionAbilityBtn.active{border-color:#fff0a8;background:linear-gradient(180deg,#496d72,#233c46);box-shadow:0 0 22px rgba(160,235,255,.8);}
  #companionAbilityBtn:disabled{opacity:.52;cursor:not-allowed;}
  @media(max-width:520px){.attack-row{padding:0 8px;}#needleBtn{width:84px;height:84px;flex-basis:84px;font-size:13px;}#companionAbilityBtn{min-width:124px;height:72px;font-size:13px;}}
  .companion-sprite{
    display:inline-block;width:58px;height:58px;flex:0 0 58px;
    background-image:url('assets/karakuri-characters-v3.png');
    background-size:700% 100%;background-repeat:no-repeat;background-position-y:center;
    filter:drop-shadow(0 2px 3px rgba(0,0,0,.8));
  }
  .treasure-log .item .rarity{font-weight:700;letter-spacing:.05em;}

  .modal-overlay{
    position:fixed;
    inset:0;
    background:rgba(0,0,0,.65);
    display:flex;
    align-items:center;
    justify-content:center;
    z-index:50;
    padding:20px;
  }
  .modal-overlay.hidden{display:none;}
  .start-overlay{z-index:80;background:radial-gradient(circle,rgba(58,35,19,.82),rgba(0,0,0,.94));}
  .start-actions{display:grid;gap:10px;margin-top:16px;}
  .start-actions button{width:100%;margin:0;padding:11px 16px;font-size:15px;}
  .modal-box{
    background:linear-gradient(160deg,#3a2313,#1c1108);
    border:1px solid #6b4a25;
    border-radius:12px;
    padding:22px 26px;
    max-width:420px;
    width:100%;
    text-align:center;
    box-shadow:0 20px 50px rgba(0,0,0,.6);
  }
  .modal-box h2{
    font-family:'Shippori Mincho', serif;
    color:var(--brass-light);
    margin:0 0 10px;
    letter-spacing:.1em;
  }
  .modal-box p{font-size:14px;line-height:1.7;color:var(--parchment);}
  .modal-box button{margin-top:12px;}
  .result-box{max-width:560px;height:min(720px,calc(100vh - 32px));height:min(720px,calc(100dvh - 32px));display:flex;flex-direction:column;overflow:hidden;}
  .result-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin:14px 0;}
  .result-stat{padding:10px 6px;border:1px solid rgba(201,162,39,.28);border-radius:9px;background:rgba(0,0,0,.24);}
  .result-stat span{display:block;font-size:10px;color:#bfae91;letter-spacing:.08em;}
  .result-stat b{display:block;margin-top:4px;color:#fff0bd;font-size:17px;}
  .result-highlight{margin:8px 0;padding:9px 12px;border-radius:8px;background:linear-gradient(90deg,rgba(201,162,39,.08),rgba(201,162,39,.2),rgba(201,162,39,.08));font-size:12px;color:#e9d9b8;}
  .carry-help{margin:5px 0;font-size:12px!important;color:#c8b48f!important;}
  #carryChoices{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));align-content:start;flex:1 1 auto;min-height:0;max-height:none;overflow-y:auto;overscroll-behavior:contain;padding:3px 5px 10px 1px;margin:6px 0;}
  #carryChoices button{width:100%;min-height:44px;margin:0;text-align:left;line-height:1.35;}
  #carryChoices .carry-choice.selected{border-color:var(--carry-color,var(--brass-light));background:linear-gradient(180deg,rgba(201,162,39,.32),rgba(74,45,21,.92));box-shadow:0 0 0 2px rgba(240,210,122,.22),0 0 14px rgba(240,210,122,.22);}
  #carryChoices .carry-choice.selected::before{content:'✓ ';color:#fff0a8;font-weight:900;}
  .result-confirm-bar{flex:0 0 auto;margin:0 -6px -4px;padding:8px 6px 4px;border-top:1px solid rgba(240,210,122,.3);background:linear-gradient(180deg,rgba(28,17,8,.72),#1c1108 34%);box-shadow:0 -10px 22px rgba(0,0,0,.38);}
  #carrySelectionSummary{min-height:18px;color:#f0d27a;font-size:12px;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
  #gameOverRetryBtn{width:100%;min-height:48px;margin-top:5px;padding:11px 14px;font-size:15px;font-weight:800;box-shadow:0 4px 14px rgba(0,0,0,.38),inset 0 1px 0 rgba(255,255,255,.08);}
  @media(max-width:520px){
    .modal-overlay{padding:8px;}
    .result-box{height:calc(100dvh - 16px);padding:12px 12px 10px;}
    .result-box h2{margin-bottom:4px;font-size:20px;}
    .result-box>p{margin:4px 0;font-size:11px!important;line-height:1.45;}
    .result-grid{grid-template-columns:repeat(3,1fr);gap:5px;margin:7px 0;}
    .result-stat{padding:6px 3px;}.result-stat b{font-size:14px;}
    .result-highlight{margin:5px 0;padding:6px 8px;}
    #carryChoices{grid-template-columns:1fr;gap:7px;margin:4px 0;}
    #carryChoices button{min-height:46px;font-size:12px;}
    .result-confirm-bar{margin:0 -2px -2px;padding:7px 2px 2px;}
    #gameOverRetryBtn{min-height:52px;font-size:15px;}
  }
  @media(max-height:520px){
    .result-box{padding-top:9px;padding-bottom:7px;}
    .result-box h2{font-size:18px;margin-bottom:1px;}
    #gameOverStats,.result-highlight,.carry-help{display:none;}
    .result-grid{margin:4px 0;gap:4px;}
    .result-stat{padding:3px 2px;}.result-stat b{font-size:12px;margin-top:1px;}
    #carryChoices{min-height:46px;}
    #gameOverRetryBtn{min-height:44px;padding:7px 10px;}
  }
  .collection-book-box{max-width:1120px;height:min(88dvh,820px);display:flex;flex-direction:column;}
  .collection-grid{
    display:grid;
    grid-template-columns:repeat(4,minmax(0,1fr));
    gap:12px;
    min-height:0;
    max-height:none;
    flex:1;
    overflow-y:auto;
    margin:10px 0;
    text-align:left;
  }
  .collection-cell{
    background:rgba(0,0,0,.28);
    border:1px solid rgba(201,162,39,.25);
    border-radius:8px;
    padding:12px;
    font-size:12px;
    min-width:0;
  }
  .collection-cell.locked{opacity:.62;filter:saturate(.25);}
  .collection-cell .cname{display:flex;align-items:center;gap:5px;color:var(--parchment);font-weight:600;}
  .collection-cell .cname svg{flex-shrink:0;}
  .collection-cell .cdesc{
    display:block;
    margin-top:4px;
    font-size:10.5px;
    line-height:1.5;
    color:#b9a880;
    font-style:italic;
  }

  .craft-list{
    display:flex;
    flex-direction:column;
    gap:10px;
    max-height:55vh;
    overflow-y:auto;
    margin:10px 0;
    text-align:left;
  }
  .craft-card{
    background:rgba(0,0,0,.28);
    border:1px solid rgba(201,162,39,.3);
    border-radius:8px;
    padding:10px 12px;
  }
  .craft-card h3{
    margin:0 0 4px;
    font-size:14px;
    color:var(--brass-light);
  }
  .craft-card .cdesc{
    font-size:11px;
    color:#b9a880;
    font-style:italic;
    display:block;
    margin-bottom:6px;
  }
  .craft-need{font-size:12px;margin:2px 0;}
  .craft-need.ok{color:#9fe0bd;}
  .craft-need.ng{color:#e0a89f;}
  .craft-card button{
    margin-top:8px;
    width:100%;
  }
  .craft-card button:disabled{
    opacity:.4;
    cursor:not-allowed;
  }
  .collection-cell .crarity{font-size:11px;letter-spacing:.04em;}
  .collection-cell .ccount{float:right;color:#c8b48f;font-size:11px;}
  .collection-art{height:104px;display:flex;align-items:center;justify-content:center;margin-bottom:8px;border-radius:7px;background:radial-gradient(circle,rgba(240,210,122,.12),rgba(0,0,0,.18));}
  .collection-art .item-sprite,.collection-art .item-single-sprite{width:88px;height:88px;flex-basis:88px;}
  .collection-art svg{width:76px;height:76px;filter:drop-shadow(0 3px 4px rgba(0,0,0,.65));}
  .collection-art .companion-sprite,.collection-art .enemy-book-sprite{width:92px;height:92px;flex-basis:92px;}
  .collection-unknown{font:bold 58px/1 serif;color:#70695e;text-shadow:0 2px 3px #000;}
  .collection-cell .cname{justify-content:space-between;align-items:flex-start;font-size:13px;}
  .collection-cell.companion-entry{min-height:180px;background:linear-gradient(120deg,rgba(0,0,0,.34),rgba(201,162,39,.09));}
  .collection-section{grid-column:1/-1;margin-top:8px;padding:7px 10px;border-bottom:1px solid rgba(240,210,122,.35);color:#f0d27a;font-family:'Shippori Mincho',serif;font-weight:700;letter-spacing:.14em;}
  .enemy-book-sprite{display:inline-block;width:46px;height:46px;flex:0 0 46px;background-image:url('assets/karakuri-enemies-v1.png');background-size:400% 100%;background-repeat:no-repeat;background-position-y:center;filter:drop-shadow(0 2px 3px rgba(0,0,0,.8));}
  .collection-cell.enemy-entry{min-height:82px;background:linear-gradient(140deg,rgba(67,25,20,.35),rgba(0,0,0,.3));}
  @media(max-width:900px){.collection-grid{grid-template-columns:repeat(3,minmax(0,1fr));}}
  @media(max-width:650px){.collection-book-box{height:94dvh;padding:14px}.collection-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.collection-art{height:88px}.collection-art .item-sprite,.collection-art .item-single-sprite{width:74px;height:74px;flex-basis:74px;}}
  @media(max-width:380px){.collection-grid{grid-template-columns:1fr;}}

  .rare-banner{
    position:fixed;
    top:0; left:0; right:0; bottom:0;
    display:flex;
    align-items:center;
    justify-content:center;
    pointer-events:none;
    z-index:60;
  }
  .rare-banner.hidden{display:none;}
  .rare-banner-inner{
    position:relative;
    text-align:center;
    animation:rarePop 1.8s cubic-bezier(.2,1.6,.4,1) forwards;
  }
  .rare-burst{
    position:absolute;
    top:50%; left:50%;
    width:420px; height:420px;
    transform:translate(-50%,-50%);
    background:conic-gradient(from 0deg,
      rgba(240,210,122,0) 0deg, rgba(240,210,122,.55) 8deg, rgba(240,210,122,0) 20deg,
      rgba(240,210,122,0) 60deg, rgba(240,210,122,.55) 68deg, rgba(240,210,122,0) 80deg,
      rgba(240,210,122,0) 120deg, rgba(240,210,122,.55) 128deg, rgba(240,210,122,0) 140deg,
      rgba(240,210,122,0) 180deg, rgba(240,210,122,.55) 188deg, rgba(240,210,122,0) 200deg,
      rgba(240,210,122,0) 240deg, rgba(240,210,122,.55) 248deg, rgba(240,210,122,0) 260deg,
      rgba(240,210,122,0) 300deg, rgba(240,210,122,.55) 308deg, rgba(240,210,122,0) 320deg,
      rgba(240,210,122,0) 360deg);
    animation:burstSpin 1.8s linear forwards;
    z-index:-1;
  }
  .rare-banner.legendary .rare-burst{
    background:conic-gradient(from 0deg,
      rgba(231,158,224,0) 0deg, rgba(231,158,224,.6) 8deg, rgba(231,158,224,0) 20deg,
      rgba(231,158,224,0) 60deg, rgba(188,217,236,.6) 68deg, rgba(188,217,236,0) 80deg,
      rgba(231,158,224,0) 120deg, rgba(240,210,122,.6) 128deg, rgba(240,210,122,0) 140deg,
      rgba(231,158,224,0) 180deg, rgba(231,158,224,.6) 188deg, rgba(231,158,224,0) 200deg,
      rgba(231,158,224,0) 240deg, rgba(188,217,236,.6) 248deg, rgba(188,217,236,0) 260deg,
      rgba(231,158,224,0) 300deg, rgba(240,210,122,.6) 308deg, rgba(240,210,122,0) 320deg,
      rgba(231,158,224,0) 360deg);
  }
  @keyframes burstSpin{
    0%{ transform:translate(-50%,-50%) rotate(0deg) scale(.4); opacity:0; }
    20%{ opacity:1; }
    100%{ transform:translate(-50%,-50%) rotate(300deg) scale(1.3); opacity:0; }
  }
  .rare-banner-title{
    font-family:'Shippori Mincho', serif;
    font-size:26px;
    font-weight:800;
    letter-spacing:.22em;
    color:#f0d27a;
    text-shadow:0 0 24px rgba(240,210,122,.9), 0 2px 0 #000;
  }
  .rare-banner-name{
    font-size:19px;
    font-weight:700;
    color:#fff3cf;
    margin-top:6px;
    text-shadow:0 0 16px rgba(240,210,122,.7);
  }
  .rare-banner-icon{
    display:flex;
    justify-content:center;
    margin-bottom:6px;
    filter:drop-shadow(0 0 14px rgba(240,210,122,.8));
  }
  .rare-banner.legendary .rare-banner-title{
    background:linear-gradient(90deg,#e79ee0,#bcd9ec,#f0d27a,#e79ee0);
    background-size:300% 100%;
    -webkit-background-clip:text;
    background-clip:text;
    color:transparent;
    animation:rareGradient 1.4s linear infinite;
    text-shadow:none;
    font-size:29px;
  }
  @keyframes rareGradient{
    0%{ background-position:0% 50%; }
    100%{ background-position:300% 50%; }
  }
  @keyframes rarePop{
    0%{ transform:scale(.4) rotate(-6deg); opacity:0; }
    15%{ transform:scale(1.18) rotate(2deg); opacity:1; }
    28%{ transform:scale(1) rotate(0deg); opacity:1; }
    82%{ transform:scale(1) rotate(0deg); opacity:1; }
    100%{ transform:scale(1.08); opacity:0; }
  }
  .tool-equipped{border-color:var(--brass-light);box-shadow:0 0 12px rgba(240,210,122,.2);}
  .tool-actions{display:flex;gap:6px;margin-top:8px;}.tool-actions button{flex:1;margin:0;}
  .rare-banner-icon .item-sprite,.rare-banner-icon .item-single-sprite,.rare-banner-icon .companion-sprite{width:92px;height:92px;flex-basis:92px;}
  .rare-banner-icon svg{width:92px;height:92px;}
  .loot-reveal{position:fixed;inset:0;z-index:58;display:flex;align-items:center;justify-content:center;pointer-events:none;}
  .loot-reveal.hidden{display:none;}
  .loot-card{min-width:190px;padding:14px 20px;border-radius:14px;text-align:center;background:linear-gradient(160deg,rgba(64,40,20,.97),rgba(20,12,7,.97));border:2px solid var(--brass-light);box-shadow:0 14px 40px #000,0 0 28px rgba(240,210,122,.35);animation:lootFly 1.55s cubic-bezier(.18,.8,.3,1) forwards;}
  .loot-card .item-sprite,.loot-card .item-single-sprite{display:block;width:76px;height:76px;margin:0 auto 6px;}
  .loot-card svg{display:block;width:76px;height:76px;margin:0 auto 6px;}
  .loot-card-name{font-weight:700;font-size:16px;color:#fff3cf;}
  .loot-card-rarity{font-size:11px;letter-spacing:.18em;margin-top:3px;}
  @keyframes lootFly{
    0%{transform:translateY(30px) scale(.25) rotate(-7deg);opacity:0;}
    18%{transform:translateY(0) scale(1.12) rotate(2deg);opacity:1;}
    66%{transform:translateY(0) scale(1) rotate(0);opacity:1;}
    100%{transform:translate(38vw,-38vh) scale(.12) rotate(8deg);opacity:0;}
  }

  .flash-overlay{
    position:fixed;
    inset:0;
    pointer-events:none;
    z-index:55;
    background:radial-gradient(circle, rgba(255,250,220,.95) 0%, rgba(240,210,122,.4) 40%, rgba(240,210,122,0) 75%);
    opacity:0;
  }
  .flash-overlay.flash-play{ animation:flashPulse .7s ease-out; }
  .flash-overlay.flash-legendary{ background:radial-gradient(circle, rgba(255,240,255,.95) 0%, rgba(231,158,224,.45) 40%, rgba(231,158,224,0) 75%); }
  .flash-overlay.flash-legendary.flash-play{ animation:flashPulse 1s ease-out; }
  @keyframes flashPulse{
    0%{ opacity:0; }
    10%{ opacity:1; }
    100%{ opacity:0; }
  }

  .frame.shake{ animation:frameShake .45s ease; }
  @keyframes frameShake{
    0%,100%{ transform:translate(0,0); }
    15%{ transform:translate(-6px,3px) rotate(-0.6deg); }
    30%{ transform:translate(5px,-4px) rotate(0.6deg); }
    45%{ transform:translate(-4px,4px) rotate(-0.4deg); }
    60%{ transform:translate(4px,-3px) rotate(0.4deg); }
    75%{ transform:translate(-2px,2px); }
  }
