:root{
  --ink:#34201b;
  --paper:#f8ead1;
  --paper-2:#fff5e4;
  --red:#9f2f24;
  --red-dark:#6f201b;
  --gold:#e7b45d;
  --gold-light:#ffe2a0;
  --cream:#fff8ea;
  --shadow:0 18px 50px rgba(49,27,18,.28);
}
*{box-sizing:border-box}
html,body{margin:0;width:100%;height:100%;overflow:hidden}
body{font-family:Georgia,"Times New Roman",serif;color:var(--ink);background:#6f2a20}
button,input{font:inherit}
button{cursor:pointer}
.yuki-app{width:100%;height:100dvh;overflow:hidden}
.yuki-scene{position:relative;width:100%;height:100%;overflow:hidden;background:#8d3b2d}
.scene-bg{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;object-position:center center;filter:saturate(.92) sepia(.12) contrast(.97);transform:scale(1.015)}
.scene-paper{position:absolute;inset:0;background:linear-gradient(180deg,rgba(255,235,192,.05),rgba(82,29,19,.18) 58%,rgba(42,18,12,.58));pointer-events:none}
.scene-vignette{position:absolute;inset:0;box-shadow:inset 0 0 110px rgba(42,18,12,.38);pointer-events:none}
.yuki-header{position:absolute;z-index:10;top:max(18px,env(safe-area-inset-top));left:0;right:0;display:flex;align-items:center;justify-content:space-between;padding:18px 24px}
.brand-mark{display:flex;align-items:center;gap:10px;padding:9px 14px;border:1px solid rgba(255,246,224,.62);background:rgba(255,247,226,.82);backdrop-filter:blur(12px);border-radius:18px;box-shadow:0 8px 25px rgba(45,20,13,.18)}
.brand-dot{width:10px;height:10px;border-radius:50%;background:#65a85a;box-shadow:0 0 0 4px rgba(101,168,90,.16)}
.brand-mark strong{display:block;font-size:21px;letter-spacing:.08em;line-height:1}
.brand-mark small{display:block;margin-top:4px;font-size:11px;letter-spacing:.08em;text-transform:uppercase;opacity:.68}
.presence{padding:9px 13px;border-radius:16px;background:rgba(255,247,226,.76);border:1px solid rgba(255,246,224,.62);font-size:11px;letter-spacing:.09em;text-transform:uppercase;backdrop-filter:blur(12px)}
.presence span{display:inline-block;width:7px;height:7px;border-radius:50%;background:#65a85a;margin-right:6px}
.character-stage{position:absolute;z-index:3;left:50%;top:44%;transform:translate(-50%,-50%);width:min(680px,78vw);height:min(610px,59vh);display:flex;align-items:center;justify-content:center;pointer-events:none}
.character-halo{position:absolute;width:min(500px,58vw);height:min(500px,55vh);border-radius:50%;background:radial-gradient(circle,rgba(255,246,221,.74) 0,rgba(255,246,221,.34) 45%,transparent 72%);filter:blur(2px)}
.character-wrap{position:relative;width:min(390px,48vw);height:min(480px,57vh);display:flex;align-items:flex-end;justify-content:center;filter:drop-shadow(0 22px 25px rgba(42,19,11,.30));animation:yukiFloat 5s ease-in-out infinite}
.character-shadow{position:absolute;bottom:4%;width:72%;height:11%;border-radius:50%;background:rgba(48,22,13,.28);filter:blur(14px);z-index:0}
.character-image{position:absolute;bottom:0;left:50%;transform:translateX(-50%);width:100%;height:100%;object-fit:contain;object-position:center bottom;z-index:2;transition:opacity .28s ease,filter .28s ease}
.character-image.character-back{opacity:0;z-index:1}
.character-particles{position:absolute;inset:0;z-index:5;pointer-events:none}
.character-particles i{position:absolute;font-style:normal;color:#fff0bd;text-shadow:0 2px 8px rgba(114,35,22,.4);animation:particleFloat 2.2s ease-in-out infinite}
.character-particles i:nth-child(1){right:12%;top:28%;font-size:25px}.character-particles i:nth-child(2){left:10%;top:39%;font-size:18px;animation-delay:.35s}.character-particles i:nth-child(3){right:7%;top:51%;font-size:16px;animation-delay:.7s}.character-particles i:nth-child(4){left:18%;top:20%;font-size:22px;animation-delay:1s}
.yuki-caption{position:absolute;bottom:-5px;left:50%;transform:translateX(-50%);display:flex;flex-direction:column;align-items:center;white-space:nowrap;text-align:center;text-shadow:0 2px 12px rgba(70,27,18,.3)}
.yuki-caption span{font-size:10px;letter-spacing:.15em;text-transform:uppercase;background:rgba(255,248,230,.72);padding:5px 10px;border-radius:20px;margin-bottom:5px}.yuki-caption b{font-size:15px;color:#fff8e8;font-weight:600}
.interaction{position:absolute;z-index:20;left:50%;bottom:max(14px,env(safe-area-inset-bottom));transform:translateX(-50%);width:min(850px,calc(100% - 28px));display:flex;flex-direction:column;gap:9px}
.mode-dock{display:flex;gap:8px;align-items:stretch;padding:7px;background:rgba(255,246,224,.90);border:1px solid rgba(255,252,240,.72);border-radius:23px;box-shadow:var(--shadow);backdrop-filter:blur(18px)}
.mode-choice,.speak-choice{border:0;background:transparent;color:var(--ink);border-radius:17px;min-height:56px;display:flex;align-items:center;gap:9px;padding:8px 14px;transition:.2s ease;position:relative}
.mode-choice{flex:1;text-align:left}.mode-choice:hover{background:rgba(159,47,36,.08)}.mode-choice.active{background:var(--red);color:#fff8e8;box-shadow:0 7px 18px rgba(111,32,27,.28)}
.mode-icon{font-family:Arial,sans-serif;font-size:20px;width:25px;text-align:center}.mode-choice b,.speak-choice b{display:block;font-family:Arial,sans-serif;font-size:11px;letter-spacing:.1em}.mode-choice small,.speak-choice small{display:block;font-size:10px;opacity:.72;margin-top:3px}.mode-choice.active small{opacity:.88}
.speak-choice{min-width:205px;cursor:pointer;background:rgba(111,32,27,.06);padding-right:48px}.speak-choice input{position:absolute;opacity:0;pointer-events:none}.speak-icon{font-size:19px}.switch-ui{position:absolute;right:14px;width:32px;height:18px;border-radius:20px;background:#c6b6a0;transition:.2s}.switch-ui:after{content:"";position:absolute;top:3px;left:3px;width:12px;height:12px;border-radius:50%;background:#fff;box-shadow:0 1px 3px rgba(0,0,0,.2);transition:.2s}.speak-choice input:checked~.switch-ui{background:var(--red)}.speak-choice input:checked~.switch-ui:after{transform:translateX(14px)}
.interaction-card{border:1px solid rgba(255,250,235,.7);background:rgba(255,247,229,.93);backdrop-filter:blur(18px);border-radius:23px;box-shadow:var(--shadow);overflow:hidden}.text-card{padding:10px 12px 9px}.messages{max-height:135px;overflow:auto;padding:3px 5px 4px;scrollbar-width:thin}.message-row{display:flex;margin:5px 0}.message-row.user{justify-content:flex-end}.message-bubble{max-width:min(620px,88%);padding:9px 13px;border-radius:16px;background:#fffaf0;font-family:Arial,sans-serif;font-size:13px;line-height:1.35;box-shadow:0 3px 12px rgba(72,31,19,.08)}.message-row.user .message-bubble{background:#9f2f24;color:#fff9ed}.message-time{display:block;font-size:8px;opacity:.48;margin-top:3px}.composer{display:flex;gap:8px;align-items:center;border-top:1px solid rgba(112,54,36,.12);padding-top:9px}.composer input{flex:1;min-width:0;border:1px solid rgba(112,54,36,.18);background:#fffdf7;border-radius:16px;padding:12px 14px;outline:0;color:var(--ink);font-family:Arial,sans-serif;font-size:14px}.composer input:focus{border-color:rgba(159,47,36,.5);box-shadow:0 0 0 3px rgba(159,47,36,.08)}.send{width:45px;height:43px;border:0;border-radius:14px;background:var(--red);color:#fff6e4;font-size:21px;box-shadow:0 5px 13px rgba(111,32,27,.24)}.voice-note{font-family:Arial,sans-serif;text-align:center;font-size:9px;letter-spacing:.08em;text-transform:uppercase;opacity:.58;padding-top:6px}
.voice-card{display:flex;align-items:center;justify-content:space-between;gap:20px;padding:13px 18px}.voice-copy{min-width:0}.voice-eyebrow{display:block;font-family:Arial,sans-serif;font-size:9px;letter-spacing:.16em;opacity:.58}.voice-copy strong{display:block;font-size:20px;margin-top:4px}.voice-copy p{margin:4px 0 0;font-family:Arial,sans-serif;font-size:11px;opacity:.67}.voice-talk-button{position:relative;width:82px;height:82px;flex:0 0 82px;border:0;border-radius:50%;background:var(--red);color:#fff4dc;display:flex;align-items:center;justify-content:center;box-shadow:0 8px 22px rgba(111,32,27,.32)}.voice-talk-icon{font-size:27px;position:relative;z-index:2}.voice-talk-button strong,.voice-talk-button small{position:absolute;display:none}.voice-ring{position:absolute;inset:-6px;border:1px solid rgba(159,47,36,.35);border-radius:50%;animation:voicePulse 2s ease-out infinite}.voice-mode-status{font-family:Arial,sans-serif;font-size:9px;letter-spacing:.08em;text-transform:uppercase;opacity:.58;min-width:120px;text-align:right}.voice-card[data-state="listening"] .voice-talk-button{background:#a92c22}.voice-card[data-state="speaking"] .voice-talk-button{background:#486e91}.voice-card[data-state="sending"] .voice-talk-button{background:#c06a28}.voice-card[data-state="listening"] .voice-ring{animation-duration:.8s}
.typing{font-family:Arial,sans-serif;font-size:10px;opacity:.65;display:flex;gap:3px;align-items:center;padding:4px 6px}.typing span{width:5px;height:5px;border-radius:50%;background:var(--red);animation:typing 1s infinite}.typing span:nth-child(2){animation-delay:.15s}.typing span:nth-child(3){animation-delay:.3s}.typing em{font-style:normal;margin-left:5px}
body.voice-mode-active .character-stage{top:41%}body.voice-mode-active .yuki-caption{bottom:-10px}body.voice-mode-active .text-card{display:none}body.voice-mode-active .voice-card{display:flex}
body.voice-mode-active.wake-listening .voice-card{box-shadow:0 0 0 2px rgba(159,47,36,.22),var(--shadow)}
body.is-listening .voice-card{box-shadow:0 0 0 3px rgba(169,44,34,.20),var(--shadow)}
body.is-speaking .character-wrap{animation:yukiFloat 2.3s ease-in-out infinite;filter:drop-shadow(0 22px 30px rgba(159,47,36,.35))}
@keyframes yukiFloat{0%,100%{transform:translateY(0)}50%{transform:translateY(-7px)}}
@keyframes particleFloat{0%,100%{transform:translateY(0) scale(.9);opacity:.35}50%{transform:translateY(-14px) scale(1.1);opacity:1}}
@keyframes voicePulse{0%{transform:scale(.82);opacity:.8}75%,100%{transform:scale(1.35);opacity:0}}
@keyframes typing{0%,100%{transform:translateY(0);opacity:.35}50%{transform:translateY(-3px);opacity:1}}
.character-emotion-layer{display:none!important}
[hidden]{display:none!important}
@media (max-width:700px){
  .scene-bg{object-position:center center}.yuki-header{padding:12px 13px}.brand-mark{padding:8px 11px;border-radius:15px}.brand-mark strong{font-size:17px}.brand-mark small{font-size:9px}.presence{padding:8px 10px;font-size:9px}
  .character-stage{top:50%;width:94vw;height:56vh}
  body.voice-mode-active .character-stage{top:50%}.character-wrap{width:min(360px,75vw);height:min(430px,52vh)}.character-halo{width:78vw;height:52vh}.yuki-caption b{font-size:13px}
  .interaction{width:calc(100% - 14px);bottom:max(7px,env(safe-area-inset-bottom));gap:7px}.mode-dock{padding:5px;border-radius:19px;gap:5px}.mode-choice,.speak-choice{min-height:51px;border-radius:14px;padding:7px 9px;gap:6px}.mode-icon,.speak-icon{font-size:17px}.mode-choice b,.speak-choice b{font-size:9px}.mode-choice small,.speak-choice small{font-size:8px}.speak-choice{min-width:125px;padding-right:37px}.switch-ui{right:9px;width:28px}.switch-ui:after{width:12px;height:12px}.speak-choice input:checked~.switch-ui:after{transform:translateX(10px)}
  .text-card{border-radius:18px;padding:7px 8px 6px}.messages{max-height:112px}.message-bubble{font-size:12px;padding:8px 11px}.composer input{padding:10px 11px;font-size:13px}.send{width:40px;height:40px}.voice-card{border-radius:18px;padding:10px 12px;gap:9px}.voice-copy strong{font-size:16px}.voice-copy p{font-size:10px}.voice-talk-button{width:67px;height:67px;flex-basis:67px}.voice-talk-icon{font-size:22px}.voice-mode-status{font-size:8px;min-width:73px}
}
@media (max-height:700px){.character-stage{top:47%;height:54vh}
body.voice-mode-active .character-stage{top:47%}.character-wrap{height:50vh}.interaction{bottom:5px}.messages{max-height:85px}.character-caption{display:none}.yuki-caption{display:none}}

/* ── Mini player Walkman ─────────────────────────────────────────── */
.yuki-player{position:relative;display:flex;align-items:center;gap:14px;padding:10px 46px 10px 10px;border:1px solid rgba(255,250,235,.7);background:linear-gradient(180deg,rgba(255,249,234,.96),rgba(250,236,210,.94));backdrop-filter:blur(18px);border-radius:23px;box-shadow:var(--shadow);animation:ypIn .45s cubic-bezier(.2,.9,.3,1.2)}
.yuki-player[hidden]{display:none}
.yp-cover{position:relative;flex:0 0 66px;width:66px;height:66px;border-radius:14px;overflow:hidden;background:var(--red-dark);box-shadow:0 6px 16px rgba(72,31,19,.28),inset 0 0 0 2px rgba(255,240,210,.5)}
.yp-cover img{width:100%;height:100%;object-fit:cover;display:block}
.yp-reels{position:absolute;left:0;right:0;bottom:6px;display:flex;justify-content:center;gap:12px;pointer-events:none}
.yp-reels i{width:16px;height:16px;border-radius:50%;background:radial-gradient(circle,#fff6e2 0 2px,transparent 2.5px),conic-gradient(rgba(52,32,27,.85) 0 25%,rgba(255,240,210,.9) 0 50%,rgba(52,32,27,.85) 0 75%,rgba(255,240,210,.9) 0);border:2px solid rgba(255,246,226,.92);box-shadow:0 1px 4px rgba(0,0,0,.3);animation:ypSpin 1.6s linear infinite;animation-play-state:paused}
.yuki-player.is-playing .yp-reels i{animation-play-state:running}
.yp-info{flex:1;min-width:0;display:flex;flex-direction:column}
.yp-eyebrow{font-family:Arial,sans-serif;font-size:9px;letter-spacing:.16em;opacity:.58}
.yp-eyebrow b{font-weight:700}
.yp-info strong{font-size:17px;line-height:1.15;margin-top:3px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.yp-info small{font-family:Arial,sans-serif;font-size:11px;opacity:.68;margin-top:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.yp-progress{display:flex;align-items:center;gap:8px;margin-top:6px}
.yp-progress span{font-family:Arial,sans-serif;font-size:10px;opacity:.6;min-width:34px;text-align:right;font-variant-numeric:tabular-nums}
#ypSeek{flex:1;min-width:0;-webkit-appearance:none;appearance:none;height:4px;border-radius:4px;background:linear-gradient(90deg,var(--red) var(--p,0%),rgba(112,54,36,.18) var(--p,0%));outline:0;margin:0}
#ypSeek::-webkit-slider-thumb{-webkit-appearance:none;width:13px;height:13px;border-radius:50%;background:var(--red);border:2px solid #fff6e4;box-shadow:0 1px 4px rgba(0,0,0,.25)}
#ypSeek::-moz-range-thumb{width:11px;height:11px;border-radius:50%;background:var(--red);border:2px solid #fff6e4}
.yp-controls{display:flex;align-items:center;gap:6px;flex:0 0 auto}
.yp-controls button{width:38px;height:38px;border:0;border-radius:50%;background:rgba(159,47,36,.09);color:var(--red-dark);display:flex;align-items:center;justify-content:center;transition:.15s}
.yp-controls button:active{transform:scale(.93)}
.yp-controls svg{width:17px;height:17px;fill:currentColor}
.yp-controls .yp-main{width:50px;height:50px;background:var(--red);color:#fff6e4;box-shadow:0 6px 16px rgba(111,32,27,.3)}
.yp-controls .yp-main svg{width:22px;height:22px}
.yp-icon-pause{display:none}.yuki-player.is-playing .yp-icon-pause{display:block}.yuki-player.is-playing .yp-icon-play{display:none}
.yp-close{position:absolute;top:8px;right:10px;width:28px;height:28px;border:0;border-radius:50%;background:transparent;color:var(--ink);opacity:.5;font-size:20px;line-height:1}
.yp-close:hover{opacity:.85;background:rgba(159,47,36,.08)}
.yuki-player.is-ducked{opacity:.82}
.yuki-player.is-error .yp-info small{color:var(--red);opacity:1}
@keyframes ypSpin{to{transform:rotate(360deg)}}
@keyframes ypIn{from{opacity:0;transform:translateY(14px) scale(.97)}to{opacity:1;transform:none}}
body.player-on .character-stage{top:38%}
@media (max-width:700px){
  .yuki-player{gap:10px;padding:8px 36px 8px 8px;border-radius:19px}
  .yp-cover{flex-basis:54px;width:54px;height:54px;border-radius:12px}
  .yp-reels{gap:8px;bottom:4px}.yp-reels i{width:13px;height:13px}
  .yp-info strong{font-size:15px}
  .yp-controls{gap:3px}.yp-controls button{width:32px;height:32px}.yp-controls .yp-main{width:42px;height:42px}
  .yp-close{top:4px;right:4px}
  body.player-on .character-stage{top:34%;height:min(560px,50vh)}
}
@media (max-height:700px){body.player-on .character-stage{top:40%;height:44vh}body.player-on .character-wrap{height:42vh}}

/* ── Buffering del brano ─────────────────────────────────────────── */
.yp-loader{position:absolute;inset:0;display:none;align-items:center;justify-content:center;background:rgba(52,24,18,.55);backdrop-filter:blur(1.5px)}
.yp-loader::before{content:"";position:absolute;width:44px;height:44px;border-radius:50%;
  background:conic-gradient(var(--gold-light) var(--load,0%),rgba(255,240,210,.22) 0);
  -webkit-mask:radial-gradient(farthest-side,transparent calc(100% - 4px),#000 calc(100% - 3px));
          mask:radial-gradient(farthest-side,transparent calc(100% - 4px),#000 calc(100% - 3px));
  transition:background .2s}
.yp-loader::after{content:"";position:absolute;width:44px;height:44px;border-radius:50%;border:3px solid transparent;border-top-color:rgba(255,240,210,.9);animation:ypSpin .9s linear infinite;opacity:.55}
.yp-loader b{position:relative;font-family:Arial,sans-serif;font-size:10px;font-weight:700;color:#fff6e2;letter-spacing:.02em}
.yuki-player.is-loading .yp-loader{display:flex}
.yuki-player.is-loading .yp-reels{display:none}
.yuki-player.is-loading .yp-info small{color:var(--red);opacity:.9}
.yuki-player.is-loading .yp-main{opacity:.55;pointer-events:none}
@media (max-width:700px){.yp-loader::before,.yp-loader::after{width:38px;height:38px}}
