* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; font: 12px Tahoma, "Segoe UI", Verdana, sans-serif; color: #000; -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; }
.hidden { display: none !important; }

/* ---------- Desktop im Bliss-Stil ---------- */
#desktop {
  position: fixed; inset: 0 0 30px 0; overflow: hidden;
  background:
    radial-gradient(ellipse 85% 42% at 22% 104%, #6dbf3f 0%, #4f9f2b 55%, #3f8a22 69%, transparent 70%),
    radial-gradient(ellipse 110% 48% at 88% 112%, #79c64a 0%, #56a72f 52%, #418d24 66%, transparent 67%),
    linear-gradient(#1f62d3 0%, #3f86e6 35%, #79b0ef 62%, #b9d8f7 80%, #d8eafb 100%);
}
.cloud { position: absolute; border-radius: 50%; background: radial-gradient(closest-side, rgba(255,255,255,.85), rgba(255,255,255,0)); pointer-events: none; }
.c1 { width: 520px; height: 140px; left: 6%; top: 14%; }
.c2 { width: 420px; height: 110px; right: 8%; top: 8%; opacity: .8; }
.c3 { width: 300px; height: 90px; left: 48%; top: 30%; opacity: .6; }
#windows { position: absolute; inset: 0; }

/* ---------- XP-Fenster ---------- */
.win {
  position: absolute; display: flex; flex-direction: column;
  min-width: 260px; min-height: 220px;
  background: #0b5ee0; border: 1px solid #002ea8; border-radius: 8px 8px 0 0;
  padding: 0 3px 3px; box-shadow: 2px 4px 16px rgba(0,0,0,.45);
  resize: both; overflow: hidden;
}
.win:not(.active) { background: #7c98e0; border-color: #5a74c4; }
.win.minimized { display: none; }
.win.maximized { left: 0 !important; top: 0 !important; width: 100% !important; height: 100% !important; border-radius: 0; resize: none; }
.titlebar {
  height: 28px; flex: none; display: flex; align-items: center; gap: 5px;
  margin: 0 -3px; padding: 0 4px 0 7px; border-radius: 7px 7px 0 0;
  color: #fff; font-weight: bold; font-size: 13px; text-shadow: 1px 1px #0f1089;
  background: linear-gradient(#0997ff 0%, #0053ee 8%, #0050ee 40%, #0066ff 88%, #0066ff 93%, #005bff 95%, #003dd7 96%, #003dd7);
  user-select: none; touch-action: none; cursor: default;
}
.win:not(.active) .titlebar { background: linear-gradient(#a6bcf2, #7c98e0 12%, #7493e4 60%, #7b9ced); text-shadow: none; color: #dfe7fb; }
.ticon { display: flex; align-items: center; }
.ttext { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tbtns { display: flex; gap: 2px; }
.tb {
  position: relative; width: 21px; height: 21px; padding: 0; cursor: pointer;
  border: 1px solid #fff; border-radius: 3px;
  background: radial-gradient(circle at 70% 75%, #2b62d8, #4d8af5 60%, #8fb6ff);
  box-shadow: inset -1px -1px 1px rgba(0,0,0,.25);
}
.tb:hover { filter: brightness(1.15); }
.tb-close { background: radial-gradient(circle at 70% 75%, #b8320e, #e15a2f 60%, #f39d7f); }
.tb-min::after { content: ''; position: absolute; left: 5px; bottom: 4px; width: 7px; height: 3px; background: #fff; }
.tb-max::after { content: ''; position: absolute; left: 4px; top: 4px; width: 11px; height: 11px; border: 1px solid #fff; border-top-width: 3px; }
.tb-close::before, .tb-close::after { content: ''; position: absolute; left: 9px; top: 3px; width: 2px; height: 13px; background: #fff; transform: rotate(45deg); }
.tb-close::after { transform: rotate(-45deg); }
.wbody { flex: 1; min-height: 0; display: flex; flex-direction: column; background: #ece9d8; overflow: hidden; }

/* ---------- Bedienelemente ---------- */
.xp-btn {
  min-width: 75px; padding: 4px 14px; cursor: pointer;
  border: 1px solid #003c74; border-radius: 3px;
  background: linear-gradient(#fff, #ecebe6 85%, #d6d0c5);
}
.xp-btn:hover { box-shadow: inset 0 -2px #f8b636, inset 0 2px #fde9b7; }
.xp-btn:disabled { color: #a0a0a0; cursor: default; }
input[type=text], input[type=password], select, textarea { border: 1px solid #7f9db9; padding: 3px 4px; background: #fff; outline: none; }
input:focus, textarea:focus { border-color: #3a6ea5; }

/* ---------- Avatare und Symbole ---------- */
.avatar {
  width: 56px; height: 56px; flex: none; display: grid; place-items: center;
  font-size: 32px; line-height: 1; border-radius: 6px; border: 2px solid #fff;
  box-shadow: 0 0 0 1px #8aa6d6, 1px 2px 4px rgba(0,0,0,.2);
  background: linear-gradient(135deg, var(--a1), var(--a2));
}
.buddy { flex: none; display: block; }
.emo { font-size: 1.15em; line-height: 1; }

/* ---------- Login ---------- */
.login {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 20px 26px; background: linear-gradient(#fff 0%, #eaf1fc 55%, #cfdff6 100%); overflow: auto;
}
.login-logo { margin: 6px 0 2px; }
.brand { font-size: 24px; color: #1d4a9c; margin-bottom: 14px; letter-spacing: -.5px; }
.brand b { color: #7a7a7a; font-family: Verdana, sans-serif; font-weight: bold; letter-spacing: -1.5px; margin-right: 4px; }
.login label { align-self: stretch; margin-top: 8px; color: #1b3f8b; }
.login input, .login select { align-self: stretch; }
.login .xp-btn { margin-top: 18px; }
.login .err { min-height: 16px; margin-top: 8px; color: #b00; text-align: center; }
.login .hint { margin-top: auto; padding-top: 14px; font-size: 11px; color: #5a6f99; text-align: center; }

/* ---------- Kontaktliste ---------- */
.me-bar { position: relative; flex: none; display: flex; gap: 9px; padding: 10px; background: linear-gradient(#c3d8f6, #eef4fd); border-bottom: 1px solid #a7c0e6; }
.me-bar .avatar { cursor: pointer; }
.me-info { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 3px; }
.me-name { display: flex; align-items: center; gap: 4px; font-weight: bold; font-size: 13px; white-space: nowrap; overflow: hidden; }
.me-name .nm { overflow: hidden; text-overflow: ellipsis; }
#m-status { border: none; background: transparent; color: #0a3d8f; font-size: 11px; cursor: pointer; padding: 0; max-width: 140px; }
#m-psm { width: 100%; border: 1px solid transparent; background: transparent; color: #555; font-style: italic; padding: 2px 3px; }
#m-psm:hover, #m-psm:focus { border-color: #7f9db9; background: #fff; }
.avpick {
  position: absolute; left: 8px; top: 74px; z-index: 5; display: grid; grid-template-columns: repeat(4, 50px); gap: 6px;
  padding: 8px; background: #fff; border: 1px solid #7f9db9; box-shadow: 2px 3px 10px rgba(0,0,0,.3);
}
.avpick .avatar { width: 50px; height: 50px; font-size: 28px; cursor: pointer; }
.avpick .avatar:hover { box-shadow: 0 0 0 2px #f8b636; }
.search { flex: none; padding: 6px 8px; background: #f4f7fc; border-bottom: 1px solid #d5e0f2; }
.search input { width: 100%; }
.clist { flex: 1; overflow-y: auto; background: #fff; padding: 4px 0 10px; }
.group { padding: 5px 8px 3px; font-weight: bold; color: #1b3f8b; cursor: pointer; user-select: none; }
.group .arrow { display: inline-block; width: 12px; font-size: 9px; color: #5b78b4; }
.contact { display: flex; align-items: center; gap: 5px; padding: 3px 8px 3px 22px; cursor: default; white-space: nowrap; overflow: hidden; user-select: none; }
.contact:hover { background: #e3ecfb; }
.contact .cname { flex: none; max-width: 60%; overflow: hidden; text-overflow: ellipsis; }
.contact .cstat { flex: none; color: #555; }
.contact .cpsm { color: #808080; font-style: italic; overflow: hidden; text-overflow: ellipsis; }
.contact.off .cname { color: #808080; }
.empty { padding: 4px 22px; color: #888; font-style: italic; }
.mfoot { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px; background: #ece9d8; border-top: 1px solid #cfcab8; font-size: 11px; }
.mfoot a { color: #0a3d8f; }
.conn { color: #b00; }

/* ---------- Chatfenster ---------- */
.ctool { flex: none; display: flex; gap: 2px; padding: 3px 6px; background: linear-gradient(#f6f9fe, #d6e3f7); border-bottom: 1px solid #a9c0e4; }
.tool { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 2px 9px; font-size: 18px; line-height: 1; background: none; border: 1px solid transparent; border-radius: 3px; cursor: pointer; }
.tool span { font-size: 11px; color: #1b3f8b; }
.tool:hover { border-color: #9db9e2; background: #fff; }
.cmain { flex: 1; min-height: 0; display: flex; gap: 8px; padding: 8px; background: linear-gradient(#e7effb, #cddcf3); }
.cleft { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.cto { flex: none; padding: 5px 7px; background: #fff; border: 1px solid #9db3d9; border-radius: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cto-psm { color: #808080; font-style: italic; }
.cmsgs { flex: 1; overflow-y: auto; padding: 4px 8px 8px; background: #fff; border: 1px solid #9db3d9; border-radius: 3px; overflow-wrap: anywhere; }
.mhead { margin-top: 7px; color: #6b6b6b; }
.mline { padding-left: 12px; font-size: 13px; line-height: 1.35; }
.mnudge { margin: 8px 0 4px; font-weight: bold; color: #333; }
.mnudge::before { content: '— '; } .mnudge::after { content: ' —'; }
.minfo { margin: 8px 0 4px; color: #808080; font-style: italic; }
.cinput { position: relative; flex: none; display: flex; gap: 6px; height: 74px; }
.cinput textarea { flex: 1; resize: none; border-color: #9db3d9; border-radius: 3px; font-size: 13px; }
.cinput .send { min-width: 66px; }
.cright { flex: none; width: 104px; display: flex; flex-direction: column; justify-content: space-between; }
.cright .avatar { width: 100px; height: 100px; font-size: 58px; }
.cstatus { flex: none; min-height: 21px; padding: 3px 8px; font-size: 11px; color: #444; background: #ece9d8; border-top: 1px solid #cfcab8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.emopick {
  position: absolute; left: 0; bottom: 80px; z-index: 5; display: grid; grid-template-columns: repeat(8, 30px); gap: 2px;
  padding: 5px; background: #fff; border: 1px solid #7f9db9; box-shadow: 2px 3px 10px rgba(0,0,0,.3);
}
.emopick button { height: 30px; font-size: 19px; background: none; border: 1px solid transparent; border-radius: 3px; cursor: pointer; padding: 0; }
.emopick button:hover { border-color: #9db9e2; background: #eef4fd; }

.shake { animation: shake .6s; }
@keyframes shake {
  0%,100% { transform: translate(0,0); } 10% { transform: translate(-9px,3px); } 20% { transform: translate(8px,-4px); }
  30% { transform: translate(-7px,-3px); } 40% { transform: translate(9px,4px); } 50% { transform: translate(-8px,2px); }
  60% { transform: translate(7px,-3px); } 70% { transform: translate(-6px,4px); } 80% { transform: translate(5px,-2px); } 90% { transform: translate(-3px,1px); }
}

/* ---------- Taskleiste ---------- */
#taskbar {
  position: fixed; left: 0; right: 0; bottom: 0; height: 30px; z-index: 100000; display: flex; align-items: center;
  background: linear-gradient(#1f2f86 0, #3165c4 3%, #3682e5 6%, #4490e6 10%, #3883e5 12%, #2b71e0 15%, #2663da 18%, #235bd6 20%, #2258d5 23%, #2157d6 38%, #245ddb 54%, #2562df 86%, #245fdc 89%, #2158d4 92%, #1d4ec0 95%, #1941a5 98%);
}
.start-btn {
  height: 100%; flex: none; display: flex; align-items: center; gap: 6px; padding: 0 22px 0 10px;
  color: #fff; font: italic bold 18px "Trebuchet MS", sans-serif; text-shadow: 1px 1px 2px rgba(0,0,0,.6);
  background: linear-gradient(#3c9f3a, #46b843 12%, #37a134 50%, #2f8f2c 85%, #28722a); border-radius: 0 12px 12px 0;
  box-shadow: inset -2px 0 4px rgba(0,0,0,.3); user-select: none;
}
.flag { width: 17px; height: 15px; border-radius: 2px; background: conic-gradient(#7fba00 0 90deg, #ffb900 90deg 180deg, #00a4ef 180deg 270deg, #f25022 270deg); transform: skewY(-6deg); }
#tasks { flex: 1; min-width: 0; display: flex; gap: 3px; padding: 0 6px; overflow: hidden; }
.task {
  flex: 0 1 160px; min-width: 40px; height: 24px; display: flex; align-items: center; gap: 4px; padding: 0 8px;
  color: #fff; font-size: 11px; background: #3c81f3; border-radius: 3px; cursor: pointer; user-select: none;
  box-shadow: inset 1px 1px rgba(255,255,255,.3), inset -1px -1px rgba(0,0,0,.3); white-space: nowrap; overflow: hidden;
}
.task span { overflow: hidden; text-overflow: ellipsis; }
.task.active { background: #1e52b7; box-shadow: inset 1px 1px 3px rgba(0,0,0,.5); }
.task.flash { animation: taskflash 1s steps(1) infinite; }
@keyframes taskflash { 50% { background: #f2a33a; } }
#tray {
  height: 100%; flex: none; display: flex; align-items: center; gap: 8px; padding: 0 12px; color: #fff; font-size: 11px;
  background: linear-gradient(#0c59b9, #139ee9 5%, #18b9ff 10%, #0c8eea 20%, #0f8eea 80%, #1179d6 95%); border-left: 1px solid #092f7d;
}

/* ---------- Toasts ---------- */
#toasts { position: fixed; right: 8px; bottom: 38px; z-index: 100001; display: flex; flex-direction: column; gap: 6px; }
.toast {
  width: 210px; overflow: hidden; cursor: pointer; background: linear-gradient(#fff, #d7e5fa);
  border: 1px solid #6d8fcf; border-radius: 4px; box-shadow: 2px 3px 10px rgba(0,0,0,.35); animation: toastIn .35s ease-out;
}
.toast.out { animation: toastOut .35s ease-in forwards; }
.toast-bar { display: flex; align-items: center; gap: 5px; padding: 3px 6px; color: #fff; font-size: 11px; background: linear-gradient(#6b98ec, #2c5fcf); }
.toast-bar .x { margin-left: auto; font-size: 13px; }
.toast-body { padding: 10px 10px 14px; text-align: center; color: #1b3f8b; overflow-wrap: anywhere; }
.toast-body b { display: block; margin-bottom: 3px; }
@keyframes toastIn { from { transform: translateY(50px); opacity: 0; } }
@keyframes toastOut { to { transform: translateY(50px); opacity: 0; } }

/* ---------- Handy ---------- */
@media (max-width: 700px) {
  .win { left: 0 !important; top: 0 !important; width: 100% !important; height: 100% !important; border-radius: 0; resize: none; min-width: 0; }
  .titlebar { border-radius: 0; height: 34px; }
  .tb { width: 26px; height: 26px; } .tb-max { display: none; }
  .tb-min::after { left: 7px; bottom: 6px; } .tb-close::before, .tb-close::after { left: 11px; top: 5px; height: 15px; }
  .cright { display: none; }
  .contact { padding-top: 7px; padding-bottom: 7px; font-size: 14px; }
  .cmsgs .mline { font-size: 15px; }
  .cinput textarea { font-size: 16px; }
  .start-btn { padding-right: 14px; font-size: 16px; }
  #tray #clock { display: none; }
  #toasts { left: 8px; right: 8px; align-items: flex-end; }
  .emopick { grid-template-columns: repeat(7, 34px); }
  .emopick button { height: 34px; }
}
