﻿/* ---------- /stamp AI stamp modal & chat ---------- */
.stamp-modal-backdrop{
  position:fixed;inset:0;z-index:2147483200;display:flex;align-items:center;justify-content:center;
  padding:max(12px,env(safe-area-inset-top)) 12px max(12px,env(safe-area-inset-bottom));
  background:rgba(2,6,14,.62);backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px);
  opacity:0;visibility:hidden;pointer-events:none;transition:opacity .18s ease,visibility 0s linear .2s;
}
.stamp-modal-backdrop.open{opacity:1;visibility:visible;pointer-events:auto;transition-delay:0s}
.stamp-modal{
  width:min(94vw,560px);max-height:min(88dvh,760px);display:flex;flex-direction:column;overflow:hidden;
  border:1px solid rgba(255,255,255,.14);border-radius:22px;color:#eef4ff;
  background:linear-gradient(180deg,rgba(22,29,43,.93),rgba(12,17,28,.91));
  box-shadow:0 28px 90px rgba(0,0,0,.48),inset 0 1px 0 rgba(255,255,255,.08);
  backdrop-filter:blur(26px) saturate(150%);-webkit-backdrop-filter:blur(26px) saturate(150%);
  transform:translateY(10px) scale(.985);transition:transform .22s cubic-bezier(.2,.8,.2,1);
}
.stamp-modal-backdrop.open .stamp-modal{transform:none}
.stamp-modal-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;padding:15px 16px 12px;border-bottom:1px solid rgba(255,255,255,.10)}
.stamp-modal-title{font-size:18px;font-weight:950;letter-spacing:.01em}
.stamp-modal-subtitle{margin-top:3px;color:#aeb9ca;font-size:12px;line-height:1.45}
.stamp-modal-close{flex:0 0 auto;width:36px;height:36px;padding:0;border:1px solid rgba(255,255,255,.12);border-radius:12px;background:rgba(255,255,255,.07);color:#eef4ff;font-size:23px;line-height:1;cursor:pointer}
.stamp-tabs{display:grid;grid-template-columns:1fr 1fr;gap:5px;padding:9px 12px 0}
.stamp-tab{min-height:40px;border:0;border-radius:12px 12px 8px 8px;background:rgba(255,255,255,.045);color:#9eabc0;font-weight:900;cursor:pointer}
.stamp-tab.is-active{background:rgba(75,126,214,.25);color:#fff;box-shadow:inset 0 0 0 1px rgba(92,148,240,.32)}
.stamp-tab:disabled{opacity:.45;cursor:not-allowed}
.stamp-modal-body{min-height:0;overflow:auto;padding:12px;overscroll-behavior:contain}
.stamp-panel{display:none}.stamp-panel.is-active{display:block}
.stamp-field{display:flex;flex-direction:column;gap:7px;margin-bottom:12px}
.stamp-field-label{font-size:12px;font-weight:850;color:#c8d3e4}
.stamp-field-hint{margin-top:-3px;color:#8f9db2;font-size:10px;line-height:1.45}
.stamp-upload-row{display:flex;align-items:center;gap:9px;min-width:0}
.stamp-selected-file{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#9aa8bd;font-size:11px}
.stamp-text-input{width:100%;min-height:82px;resize:vertical;padding:11px 12px;border:1px solid rgba(255,255,255,.13);border-radius:13px;background:rgba(5,10,19,.45);color:#f3f7ff;outline:none;font:inherit;font-size:14px;line-height:1.5}
.stamp-text-input:focus{border-color:rgba(91,151,255,.72);box-shadow:0 0 0 3px rgba(72,134,235,.13)}
.stamp-text-count{align-self:flex-end;margin-top:-4px;color:#7f8ca0;font-size:10px}
.stamp-overlay-input{width:100%;min-height:44px;padding:0 12px;border:1px solid rgba(255,255,255,.13);border-radius:13px;background:rgba(5,10,19,.45);color:#f3f7ff;outline:none;font:inherit;font-size:14px}
.stamp-overlay-input:focus{border-color:rgba(91,151,255,.72);box-shadow:0 0 0 3px rgba(72,134,235,.13)}
.stamp-style-choices{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px}
.stamp-style-choice{min-height:37px;padding:0 7px;border:1px solid rgba(255,255,255,.10);border-radius:11px;background:rgba(255,255,255,.05);color:#aeb9ca;font:inherit;font-size:11px;font-weight:850;cursor:pointer}
.stamp-style-choice.is-active{background:rgba(75,126,214,.25);border-color:rgba(92,148,240,.36);color:#fff}
.stamp-style-choice:disabled{opacity:.48;cursor:not-allowed}
.stamp-primary-btn,.stamp-secondary-btn,.stamp-mini-btn{appearance:none;-webkit-appearance:none;border:1px solid rgba(255,255,255,.12);cursor:pointer;font:inherit;font-weight:900}
.stamp-primary-btn{width:100%;min-height:44px;padding:0 14px;border-radius:14px;background:linear-gradient(180deg,#568ee8,#376fc8);color:#fff;box-shadow:0 9px 22px rgba(43,99,191,.23)}
.stamp-secondary-btn{min-height:38px;padding:0 13px;border-radius:12px;background:rgba(255,255,255,.075);color:#e8effc}
.stamp-mini-btn{min-height:30px;padding:0 10px;border-radius:9px;background:rgba(255,255,255,.07);color:#e8effc;font-size:11px}
.stamp-primary-btn:disabled,.stamp-secondary-btn:disabled{opacity:.5;cursor:not-allowed;box-shadow:none}
.stamp-source-preview{position:relative;margin:-2px 0 12px;width:112px;aspect-ratio:1;border-radius:15px;overflow:hidden;border:1px solid rgba(255,255,255,.12);background:rgba(0,0,0,.2)}
.stamp-source-preview img{width:100%;height:100%;display:block;object-fit:cover}
.stamp-source-remove{position:absolute;top:5px;right:5px;width:28px;height:28px;border:1px solid rgba(255,255,255,.28);border-radius:50%;background:rgba(7,12,21,.78);color:#fff;font-size:18px;line-height:1;cursor:pointer}
.stamp-generate-status,.stamp-mine-status{min-height:20px;margin-top:8px;color:#aebbd0;font-size:11px;line-height:1.5;white-space:pre-line}
.stamp-loading{margin-top:12px;padding:15px;border-radius:15px;background:rgba(72,125,214,.10);border:1px solid rgba(83,142,237,.18);display:grid;grid-template-columns:auto 1fr;gap:2px 10px;align-items:center}
.stamp-loading[hidden]{display:none}.stamp-loading strong{font-size:13px}.stamp-loading small{grid-column:2;color:#9eacc1;font-size:10px}
.stamp-spinner{grid-row:1/3;width:24px;height:24px;border:3px solid rgba(255,255,255,.18);border-top-color:#79abff;border-radius:50%;animation:stampSpin .8s linear infinite}
@keyframes stampSpin{to{transform:rotate(360deg)}}
.stamp-generated-preview{margin-top:13px;padding-top:13px;border-top:1px solid rgba(255,255,255,.10)}
.stamp-generated-preview[hidden]{display:none}
.stamp-preview-canvas{position:relative;width:min(100%,300px);aspect-ratio:1;margin:0 auto;display:flex;align-items:center;justify-content:center;border-radius:20px;overflow:hidden;background:radial-gradient(circle at 50% 35%,rgba(255,255,255,.08),rgba(255,255,255,.025));border:1px solid rgba(255,255,255,.09)}
.stamp-preview-canvas img{width:100%;height:100%;object-fit:contain;display:block}
.stamp-generated-meta{text-align:center;margin:8px 0 10px;color:#9eacc1;font-size:11px}
.stamp-preview-actions{display:grid;grid-template-columns:1.3fr 1fr 1fr;gap:7px}.stamp-preview-actions .stamp-primary-btn{min-height:40px}
.stamp-mine-head{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:7px;color:#9eacc1;font-size:10px;line-height:1.45}
.stamp-mine-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:9px}
.stamp-mine-card{position:relative;min-width:0;border-radius:15px;border:1px solid rgba(255,255,255,.10);background:rgba(255,255,255,.045);overflow:hidden}
.stamp-mine-send{width:100%;padding:7px 6px 8px;border:0;background:transparent;color:inherit;cursor:pointer;display:flex;flex-direction:column;align-items:center;gap:4px}
.stamp-mine-send:disabled{opacity:.5}
.stamp-mine-delete{position:absolute;top:4px;right:4px;width:25px;height:25px;padding:0;border:1px solid rgba(255,255,255,.16);border-radius:50%;background:rgba(7,12,21,.72);color:#fff;font-size:15px;line-height:1;cursor:pointer;z-index:2}
.stamp-mine-info{font-size:9px;color:#9aa7ba}
.stamp-ax-notice{margin-bottom:12px;padding:11px 12px;border:1px solid rgba(255,188,80,.30);border-radius:13px;background:rgba(120,75,10,.18);color:#ffd99b;font-size:11px;line-height:1.5}

/* timeline stamp */
.message.stamp-message{max-width:min(82%,230px)}
.message.stamp-message .message-content{min-width:0;max-width:100%}
.message.stamp-message .stamp-chat-shell{padding:1px 4px 3px;background:transparent!important;border:0!important;box-shadow:none!important}
.stamp-visual{position:relative;width:min(176px,52vw);min-height:76px;display:flex;align-items:center;justify-content:center;overflow:hidden;border-radius:17px;background:transparent}
.stamp-visual img{display:block;width:100%;height:auto;max-height:176px;object-fit:contain;filter:drop-shadow(0 5px 8px rgba(0,0,0,.16))}
.stamp-visual.is-compact{width:100%;aspect-ratio:1;min-height:0;border-radius:11px}.stamp-visual.is-compact img{width:100%;height:100%;max-height:none;object-fit:contain}
.stamp-overlay-text{position:absolute;left:7%;right:7%;bottom:7%;z-index:2;text-align:center;color:#fff;font-size:clamp(20px,8vw,38px);font-weight:950;line-height:1.05;letter-spacing:.02em;overflow-wrap:anywhere;pointer-events:none;text-shadow:0 2px 2px rgba(0,0,0,.95),2px 0 1px rgba(0,0,0,.9),-2px 0 1px rgba(0,0,0,.9),0 -2px 1px rgba(0,0,0,.9);-webkit-text-stroke:1px rgba(0,0,0,.72)}
.stamp-overlay-text[data-length="0"]{display:none}
.stamp-overlay-text[data-length]{max-height:2.2em;overflow:hidden}
.stamp-overlay-text.is-long{font-size:clamp(17px,6.5vw,30px)}
.stamp-overlay-text.is-very-long{font-size:clamp(14px,5.5vw,24px)}
.stamp-visual.is-compact .stamp-overlay-text{left:5%;right:5%;bottom:5%;font-size:clamp(10px,4vw,17px);-webkit-text-stroke:.5px rgba(0,0,0,.72)}
.stamp-visual.is-expired,.stamp-visual.is-ax-blocked,.stamp-visual.is-ax-loading{min-height:80px;padding:9px;flex-direction:column;gap:4px;border:1px dashed rgba(255,255,255,.16);background:rgba(255,255,255,.045);color:#9ba8bb;text-align:center}
.stamp-visual.is-expired small,.stamp-visual.is-ax-blocked small,.stamp-visual.is-ax-loading small{font-size:9px;line-height:1.4}

body.local-light .stamp-modal{background:linear-gradient(180deg,rgba(255,255,255,.96),rgba(245,248,252,.95));border-color:rgba(34,55,84,.14);color:#162033;box-shadow:0 26px 70px rgba(31,50,76,.18)}
body.local-light .stamp-modal-subtitle,body.local-light .stamp-field-label,body.local-light .stamp-selected-file,body.local-light .stamp-generated-meta,body.local-light .stamp-mine-head,body.local-light .stamp-mine-info,body.local-light .stamp-generate-status,body.local-light .stamp-mine-status{color:#5d6b7d!important}
body.local-light .stamp-modal-close,body.local-light .stamp-secondary-btn,body.local-light .stamp-mini-btn{background:rgba(34,60,95,.06)!important;color:#1b2a3f!important;border-color:rgba(34,60,95,.14)!important}
body.local-light .stamp-tab{background:rgba(34,60,95,.045)!important;color:#667386!important}body.local-light .stamp-tab.is-active{background:#e3efff!important;color:#245a91!important;box-shadow:inset 0 0 0 1px #c6dcf8!important}
body.local-light .stamp-text-input,body.local-light .stamp-overlay-input{background:rgba(255,255,255,.86)!important;color:#17212f!important;border-color:rgba(34,60,95,.16)!important}
body.local-light .stamp-field-hint{color:#6f7d90!important}
body.local-light .stamp-style-choice{background:rgba(34,60,95,.045)!important;color:#667386!important;border-color:rgba(34,60,95,.10)!important}body.local-light .stamp-style-choice.is-active{background:#e3efff!important;color:#245a91!important;border-color:#c6dcf8!important}
body.local-light .stamp-mine-card{background:rgba(39,63,95,.04)!important;border-color:rgba(39,63,95,.12)!important}
body.local-light .stamp-mine-delete{background:rgba(255,255,255,.9)!important;color:#29394e!important;border-color:rgba(39,63,95,.18)!important}
body.local-light .stamp-visual.is-expired,body.local-light .stamp-visual.is-ax-blocked,body.local-light .stamp-visual.is-ax-loading{background:rgba(39,63,95,.04)!important;border-color:rgba(39,63,95,.16)!important;color:#68778a!important}

@media(max-width:430px){
  .stamp-modal-backdrop{padding:7px}
  .stamp-modal{width:100%;max-height:92dvh;border-radius:18px}
  .stamp-modal-head{padding:12px}.stamp-modal-title{font-size:16px}.stamp-modal-subtitle{font-size:10px}
  .stamp-modal-body{padding:10px}.stamp-mine-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:6px}
  .stamp-preview-actions{grid-template-columns:1fr}.stamp-preview-actions button{width:100%}
  .stamp-style-choices{grid-template-columns:repeat(2,minmax(0,1fr))}
  .stamp-visual{width:min(170px,55vw)}
}
@media(max-width:300px){
  .stamp-modal-backdrop{padding:4px}.stamp-modal{max-height:96dvh;border-radius:13px}.stamp-modal-head{padding:9px}.stamp-modal-title{font-size:14px}.stamp-modal-subtitle{font-size:9px}.stamp-modal-close{width:30px;height:30px;font-size:19px}
  .stamp-tabs{padding:6px 7px 0}.stamp-tab{min-height:34px;font-size:10px}.stamp-modal-body{padding:7px}.stamp-field{margin-bottom:8px;gap:4px}.stamp-field-label{font-size:9px}.stamp-text-input{min-height:62px;padding:8px;font-size:11px}.stamp-overlay-input{min-height:36px;font-size:11px}.stamp-field-hint{font-size:8px}.stamp-style-choice{min-height:32px;font-size:9px}.stamp-secondary-btn{min-height:33px;padding:0 9px;font-size:10px}.stamp-primary-btn{min-height:38px;font-size:11px}.stamp-mine-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.stamp-mine-head{font-size:8px}.stamp-visual{width:min(145px,60vw)}.message.stamp-message{max-width:92%}
}

.stamp-visual.is-ax-loading>span:first-child{display:inline-block;font-size:18px;animation:stampAxSpin 1s linear infinite}
@keyframes stampAxSpin{to{transform:rotate(360deg)}}
