:root { color-scheme: dark; }
    input, select, textarea { color-scheme: dark; }
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: #0f172a; color: #e2e8f0; min-height: 100vh; display: flex; justify-content: center; align-items: center; }
.container { width: 100%; max-width: 560px; padding: 20px; }
.card { background: #1e293b; border-radius: 16px; padding: 32px 28px; border: 1px solid #334155; }
h1 { font-size: 24px; margin-bottom: 8px; color: #f1f5f9; }
.subtitle { color: #94a3b8; font-size: 14px; margin-bottom: 28px; }
label { display: block; font-size: 14px; color: #94a3b8; margin-bottom: 6px; font-weight: 500; }
input[type="text"] { width: 100%; padding: 12px 14px; border: 1px solid #475569; border-radius: 10px; font-size: 15px; background: #0f172a; color: #e2e8f0; outline: none; transition: border-color .2s; }
input[type="text"]:focus { border-color: #3b82f6; }
input[type="text"]::placeholder { color: #64748b; }
.input-wrap { position: relative; }
.input-wrap input { padding-right: 36px; }
.clear-btn { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); width: 24px; height: 24px; border: none; background: #475569; color: #e2e8f0; border-radius: 50%; cursor: pointer; font-size: 14px; display: none; align-items: center; justify-content: center; line-height: 1; }
.clear-btn.show { display: flex; }
.clear-btn:hover { background: #64748b; }
.input-group { margin-bottom: 20px; }
.btn { width: 100%; padding: 13px; border: none; border-radius: 10px; font-size: 16px; font-weight: 600; cursor: pointer; transition: all .2s; }
.btn-primary { background: #3b82f6; color: #fff; }
.btn-primary:hover { background: #2563eb; }
.btn-primary:disabled { background: #475569; cursor: not-allowed; }
.help-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; font-size: 13px; font-weight: 600; color: #e2e8f0; background: #334155; border: 1px solid #475569; border-radius: 10px; cursor: pointer; transition: all .2s; white-space: nowrap; }
.help-btn:hover { background: #475569; color: #fff; border-color: #64748b; }
.help-btn:active { transform: scale(.96); }
.card-status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 4px 10px; border-radius: 20px; margin-top: 8px; word-break: keep-all; overflow-wrap: normal; line-height: 1.7; }
.card-valid { background: #065f46; color: #6ee7b7; }
.card-invalid { background: #7f1d1d; color: #fca5a5; }
.card-timeout { background: #334155; color: #94a3b8; }
.card-checking { background: #334155; color: #94a3b8; }
.result-box { margin-top: 24px; padding: 18px; background: #0f172a; border-radius: 10px; border: 1px solid #334155; display: none; }
.result-box.show { display: block; }
.result-box .url { word-break: break-all; font-size: 14px; color: #93c5fd; margin-bottom: 12px; line-height: 1.5; }
.result-box .copy-btn { padding: 10px 20px; background: #059669; color: #fff; border: none; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 500; transition: transform .15s, background .2s, box-shadow .2s; position: relative; overflow: hidden; }
.result-box .copy-btn:hover { background: #047857; }
.result-box .copy-btn:active { transform: scale(0.94); }
.result-box .copy-btn.copied { background: #6366f1; box-shadow: 0 0 0 4px rgba(99,102,241,.35); }
/* 116: browser download + copy, then cloud download + its own copy. */
.result-box[data-platform="116pan"] #downloadActions {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 72px;
  gap: 10px;
  align-items: stretch;
}
.result-box[data-platform="116pan"] #downloadActions > .copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  width: 100%;
  height: 40px;
  padding: 0 6px;
  font-family: inherit;
  font-size: 13px;
  line-height: 20px;
  white-space: nowrap;
  text-decoration: none;
}
.result-box[data-platform="116pan"] #dlTip116 {
  grid-column: 1 / -1;
  min-width: 0;
  line-height: 1.65;
}
.result-box[data-platform="116pan"] #b116DlBtn { grid-area: 1 / 1; }
.result-box[data-platform="116pan"] #copyBtn { grid-area: 1 / 2; background: rgba(14,165,233,.08); color: #7dd3fc; border: 1px solid #075985; }
.result-box[data-platform="116pan"] #cloud116Btn { grid-area: 2 / 1; }
.result-box[data-platform="116pan"] #cloud116CopyBtn { grid-area: 2 / 2; background: rgba(124,58,237,.08); color: #c4b5fd; border: 1px solid #5b21b6; }
.result-box[data-platform="116pan"] #copyBtn:hover { background: rgba(14,165,233,.16); }
.result-box[data-platform="116pan"] #cloud116CopyBtn:hover { background: rgba(124,58,237,.16); }
.result-box[data-platform="116pan"] #copyBtn.copied { background: #334155; color: #a5b4fc; }
.result-box[data-platform="116pan"] #cloud116CopyBtn:disabled { opacity: .6; cursor: wait; }
@media (max-width: 380px) {
  .result-box[data-platform="116pan"] { margin-left: -12px; margin-right: -12px; padding: 12px; }
  .result-box[data-platform="116pan"] #downloadActions { gap: 8px; grid-template-columns: minmax(0, 1fr) 64px; }
  .result-box[data-platform="116pan"] #downloadActions > .copy-btn { padding: 0 2px; font-size: 12px; }
}
.result-box .w77-delivery-actions { grid-template-columns: minmax(0, 1fr) 76px; gap: 10px; align-items: stretch; }
.result-box .w77-delivery-actions .copy-btn { display: inline-flex; align-items: center; justify-content: center; width: 100%; min-width: 0; height: 40px; margin: 0; padding: 0 8px; font-family: inherit; font-size: 13px; font-weight: 500; line-height: 20px; white-space: nowrap; text-decoration: none; border: 1px solid transparent; border-radius: 8px; }
.w77-delivery-actions #browserDlBtn { grid-area: 1 / 1; }
.w77-delivery-actions #browserCopyBtn { grid-area: 1 / 2; }
.w77-delivery-actions #dlBtn { grid-area: 2 / 1; }
.w77-delivery-actions #cloudCopyBtn { grid-area: 2 / 2; }
@media (max-width: 360px) {
  .w77-delivery-actions #browserDlBtn, .w77-delivery-actions #dlBtn { white-space: normal; line-height: 16px; padding: 0 4px; }
}
.error-box { margin-top: 16px; padding: 14px; background: #7f1d1d; border-radius: 10px; color: #fca5a5; font-size: 14px; display: none; }
.error-box.show { display: block; }
.error-box.info { background: #1e3a5f; color: #93c5fd; }
.loading { text-align: center; padding: 20px; display: none; }
.loading.show { display: block; }
.spinner { width: 40px; height: 40px; border: 3px solid #334155; border-top-color: #3b82f6; border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto 12px; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes copyPulse { 0% { box-shadow: 0 0 0 0 rgba(99,102,241,.5); } 70% { box-shadow: 0 0 0 10px rgba(99,102,241,0); } 100% { box-shadow: 0 0 0 0 rgba(99,102,241,0); } }
.result-box .copy-btn.copied { background: #6366f1; animation: copyPulse .5s ease-out; }
.footer { text-align: center; margin-top: 24px; color: #475569; font-size: 13px; }
.footer a { color: #64748b; text-decoration: none; }
.footer a:hover { color: #94a3b8; }
.ann-toast { position: fixed; top: 16px; right: 16px; max-width: 340px; width: calc(100% - 32px); z-index: 999; background: #0f172a; border: 1px solid #334155; border-left: 4px solid #3b82f6; border-radius: 10px; padding: 14px 16px; box-shadow: 0 12px 32px rgba(0,0,0,.5); opacity: 0; transform: translateX(24px); pointer-events: none; transition: opacity .3s, transform .3s; }
.ann-toast.show { opacity: 1; transform: translateX(0); pointer-events: auto; }
.ann-toast-title { display: flex; align-items: center; justify-content: space-between; font-size: 14px; font-weight: 600; color: #e2e8f0; margin-bottom: 6px; }
.ann-toast-close { border: none; background: transparent; color: #94a3b8; font-size: 15px; cursor: pointer; padding: 0 2px; line-height: 1; }
.ann-toast-close:hover { color: #e2e8f0; }
.ann-content { font-size: 13px; line-height: 1.6; color: #cbd5e1; white-space: pre-wrap; word-break: break-word; max-height: 45vh; overflow-y: auto; }
.link-wavy { text-decoration: underline wavy #f87171 1.5px; text-underline-offset: 5px; }

.yi-cloud-panel > b { display: block; font-size: 15px; }
.yi-cloud-hint { color: #94a3b8; font-size: 12px; line-height: 1.6; margin: 5px 0 12px; }
.yi-cloud-row { padding: 12px 0; border-top: 1px solid #334155; min-width: 0; }
.yi-cloud-row:last-child { padding-bottom: 0; }
.yi-cloud-meta { display: flex; align-items: center; gap: 8px; }
.yi-cloud-name { flex: 1; min-width: 0; font-size: 15px; line-height: 1.5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.yi-cloud-info { margin-top: 4px; color: #94a3b8; font-size: 12px; line-height: 1.6; }
.yi-cloud-state { flex-shrink: 0; color: #60a5fa; font-size: 12px; white-space: nowrap; }
.yi-cloud-state.is-ready { color: #22c55e; }
.yi-cloud-state.is-failed { color: #f87171; }
.yi-cloud-actions { display: flex; align-items: center; flex-shrink: 0; gap: 8px; }
.yi-cloud-actions .copy-btn { display: inline-flex; align-items: center; justify-content: center; height: 32px; padding: 0 14px; margin: 0; font-size: 13px; text-decoration: none; white-space: nowrap; }
.yi-cloud-actions button:disabled { opacity: .65; cursor: wait; }
.yi-cloud-ttl { margin-top: 5px; color: #64748b; font-size: 12px; line-height: 1.6; }
.yi-cloud-progress { margin-top: 9px; height: 16px; background: #1e293b; border: 1px solid #334155; border-radius: 999px; overflow: hidden; }
.yi-cloud-progress-fill { height: 100%; background: linear-gradient(90deg,#3b82f6,#60a5fa); border-radius: 999px; transition: width .4s ease; }
.yi-cloud-status { margin-top: 6px; color: #94a3b8; font-size: 12px; line-height: 1.6; }
#lineButtons .yi-cloud-line { grid-column: 1 / -1; width: 100%; height: 32px; padding: 0 12px; background: #7c3aed; text-align: left; font-size: 13px; font-weight: 600; }
#lineButtons .yi-cloud-line[aria-disabled="true"] { background: #475569; color: #94a3b8; opacity: 1; cursor: wait; }
#lineButtons .yi-cloud-line[data-cloud-enabled="false"][aria-disabled="true"] { cursor: not-allowed; }

.yi-cloud-pending-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.yi-cloud-pending-actions .yi-cloud-cancel { padding: 2px 6px; background: none; border: none; color: #94a3b8; font-size: 12px; font-weight: 400; }
.yi-cloud-pending-actions .yi-cloud-cancel:hover { background: none; color: #e2e8f0; }
.yi-cloud-pending-actions .yi-cloud-cancel:disabled { opacity: .5; cursor: wait; }

.yi-cloud-panel { position: relative; }
.yi-cloud-capacity { position: absolute; right: 18px; top: 18px; font-size: 12px; color: #94a3b8; }

/* YIFile pending progress and native ready downloads. */
#lineButtons .yi-cloud-line { display:flex; align-items:center; justify-content:space-between; gap:12px; height:44px; text-decoration:none; }
#lineButtons .yi-cloud-line[data-cloud-state="pending"] { background:#475569; color:#f1f5f9; cursor:pointer; }
#lineButtons .yi-cloud-line[data-cloud-state="pending"]:hover { background:#526175; }
.yi-cloud-line-state { display:inline-flex; align-items:center; gap:7px; flex-shrink:0; font-size:12px; font-weight:500; color:#fde68a; background:rgba(251,191,36,.12); padding:4px 8px; border-radius:999px; white-space:nowrap; }
.yi-cloud-status-dot { width:7px; height:7px; border-radius:50%; background:#fbbf24; box-shadow:0 0 0 3px rgba(251,191,36,.14); animation:yiCachePulse 1.6s ease-in-out infinite; }
.yi-cloud-line-state.is-ready { color:#bbf7d0; background:rgba(15,23,42,.24); }
.yi-cloud-line-state.is-ready .yi-cloud-status-dot { background:#86efac; box-shadow:none; animation:none; }
.yi-cloud-line-hint { grid-column:1 / -1; font-size:12px; line-height:1.7; margin-top:3px; color:#fcd34d; }
.yi-cloud-line-hint.is-ready { color:#94a3b8; }
.yi-cloud-line-hint[hidden] { display:none; }
#lineButtons .yi-cloud-line:focus-visible { outline:2px solid #93c5fd; outline-offset:3px; }
@keyframes yiCachePulse { 50% { opacity:.5; } }
@media(prefers-reduced-motion:reduce) { .yi-cloud-status-dot { animation:none; } }
