/* Alpha² "update from the fans" toast + taskbar tray icon */

/* ── Tray ─────────────────────────────────────── */
#aa-tray {
  margin-left: auto; display: flex; align-items: center; gap: 2px;
  padding: 2px 4px; height: 28px;
  border: 1px solid #808080; border-right-color: #fff; border-bottom-color: #fff;  /* sunken well */
}
#clock { margin-left: 8px !important; }

.aa-tray-btn {
  position: relative; width: 24px; height: 22px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: #202020; border: 1px solid transparent; cursor: pointer;
}
.aa-tray-btn:hover { border-color: #fff #808080 #808080 #fff; background: #d4d0c8; }
.aa-tray-btn:active { border-color: #808080 #fff #fff #808080; }
.aa-tray-btn:focus-visible { outline: 1px dotted #000; outline-offset: -3px; }
.aa-tray-btn.aa-off { color: #808080; }

.aa-badge {
  position: absolute; top: -5px; right: -5px; min-width: 15px; height: 15px; padding: 0 3px;
  border-radius: 8px; box-sizing: border-box;
  font: 700 10px/15px Arial, sans-serif; text-align: center; color: #fff;
  background: #ff2a2a; border: 1px solid #fff;
  transform: scale(0); transition: transform .18s cubic-bezier(.3,1.6,.5,1);
  pointer-events: none;
}
.aa-alert .aa-badge {
  transform: scale(1);
  box-shadow: 0 0 6px 2px rgba(255,40,40,.9), 0 0 14px 4px rgba(255,40,40,.5);
  animation: aa-glow 1.6s ease-in-out infinite;
}
.aa-alert { color: #c40000; }
.aa-alert svg { animation: aa-ring 2.4s ease-in-out infinite; transform-origin: 50% 10%; }
@keyframes aa-glow {
  0%, 100% { box-shadow: 0 0 4px 1px rgba(255,40,40,.8), 0 0 8px 2px rgba(255,40,40,.35); }
  50%      { box-shadow: 0 0 8px 3px rgba(255,60,60,1),  0 0 18px 6px rgba(255,40,40,.6); }
}
@keyframes aa-ring {
  0%, 60%, 100% { transform: rotate(0); }
  66% { transform: rotate(14deg); } 72% { transform: rotate(-12deg); }
  78% { transform: rotate(8deg); }  84% { transform: rotate(-5deg); } 90% { transform: rotate(0); }
}

/* ── Toast ────────────────────────────────────── */
.aa-toast {
  position: fixed; right: 12px; bottom: 52px; z-index: 9998;
  width: 360px; max-width: calc(100vw - 24px);
  background: #c0c0c0; color: #000;
  border: 2px solid; border-color: #fff #404040 #404040 #fff;
  box-shadow: 1px 1px 0 #000, 6px 8px 22px rgba(0,0,0,.45);
  font-family: Arial, sans-serif;
  animation: aa-in .32s cubic-bezier(.2,.9,.3,1.15) both;
}
.aa-toast.aa-out { animation: aa-away .28s ease-in both; }
.aa-toast.aa-to-tray { animation: aa-shrink .3s ease-in both; transform-origin: calc(100% - 60px) 100%; }
@keyframes aa-in    { from { opacity: 0; transform: translateY(24px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes aa-away  { to   { opacity: 0; transform: translateY(14px); } }
@keyframes aa-shrink { to  { opacity: 0; transform: scale(.08) translateY(30px); } }

.aa-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 3px 4px 3px 8px; color: #fff; font-weight: 700; font-size: 12px;
  background: linear-gradient(90deg, #000080 0%, #1084d0 100%);
}
.aa-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.aa-ctl { display: flex; gap: 2px; flex-shrink: 0; }
.aa-ctl-btn {
  width: 18px; height: 16px; padding: 0; display: inline-flex; align-items: center; justify-content: center;
  background: #c0c0c0; color: #000; cursor: pointer;
  border: 2px solid; border-color: #fff #404040 #404040 #fff;
}
.aa-ctl-btn svg { width: 10px; height: 10px; }
.aa-ctl-btn:active { border-color: #404040 #fff #fff #404040; }
.aa-ctl-btn:focus-visible { outline: 1px dotted #000; outline-offset: -3px; }

.aa-body { display: flex; gap: 12px; align-items: flex-start; padding: 14px 14px 10px; }
.aa-avatar {
  width: 36px; height: 36px; flex-shrink: 0; border-radius: 50%; object-fit: cover;
  border: 2px solid; border-color: #808080 #fff #fff #808080;
}
.aa-avatar-initial { display: flex; align-items: center; justify-content: center; background: #1a1a1a; color: #c8b89a; font-size: 16px; }
.aa-text { min-width: 0; }
.aa-author { font-size: 12px; font-weight: 700; margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aa-msg { font: 12px/1.5 "Courier New", monospace; overflow-wrap: anywhere; }

.aa-foot { display: flex; align-items: center; gap: 10px; padding: 0 14px 12px; }
.aa-bar { flex: 1; height: 8px; background: #808080; border: 1px solid; border-color: #404040 #fff #fff #404040; overflow: hidden; }
.aa-bar-fill { height: 100%; width: 100%; background: #000080; }
.aa-visit {
  padding: 3px 12px; font-size: 12px; color: #000; text-decoration: none; background: #c0c0c0;
  border: 2px solid; border-color: #fff #404040 #404040 #fff;
}
.aa-visit:active { border-color: #404040 #fff #fff #404040; }

@media (prefers-reduced-motion: reduce) {
  .aa-toast, .aa-toast.aa-out, .aa-toast.aa-to-tray { animation-duration: .01s; }
  .aa-alert svg, .aa-alert .aa-badge { animation: none; }
}
@media (max-width: 600px) { .aa-toast { right: 6px; bottom: 48px; } }

/* ── Phones / touch: bigger tap targets, toast spans the screen ── */
@media (max-width: 600px), (pointer: coarse) {
  #aa-tray { height: 34px; gap: 4px; padding: 0 4px; }
  .aa-tray-btn { width: 36px; height: 30px; }
  .aa-tray-btn svg { width: 18px; height: 18px; }
  .aa-badge { top: -4px; right: -2px; min-width: 18px; height: 18px; font-size: 11px; line-height: 18px; border-radius: 9px; }
  .aa-ctl { gap: 4px; }
  .aa-ctl-btn { width: 32px; height: 28px; }
  .aa-ctl-btn svg { width: 14px; height: 14px; }
  .aa-head { padding: 4px 4px 4px 10px; font-size: 13px; }
  .aa-msg { font-size: 14px; }
  .aa-author { font-size: 13px; }
  .aa-visit { padding: 8px 14px; font-size: 13px; }
  .aa-foot { padding-bottom: 14px; }
}
@media (max-width: 600px) {
  .aa-toast { left: 8px; right: 8px; width: auto; max-width: none; bottom: calc(48px + env(safe-area-inset-bottom, 0px)); }
}
