/* ═══════════════ Yume OS ═══════════════ */
:root {
  --accent: #ff6b3d;
  --accent-soft: color-mix(in srgb, var(--accent) 25%, white);
  --glass: rgba(255, 255, 255, 0.62);
  --glass-strong: rgba(255, 255, 255, 0.8);
  --ink: #4a3b56;
  --ink-soft: #8a7a98;
  --radius: 18px;
  --shadow: 0 18px 50px rgba(90, 50, 110, 0.25);
  font-size: 15px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; overflow: hidden; }

body {
  font-family: 'M PLUS Rounded 1c', 'Zen Maru Gothic', system-ui, sans-serif;
  color: var(--ink);
  background: #ffd9e8;
  transition: background 1s ease;
  user-select: none;
}

/* ─── wallpapers ─── */
body.wp-sakura {
  background: linear-gradient(170deg, #ffe3ef 0%, #ffd1e3 30%, #e8d3ff 65%, #cfe5ff 100%);
}
body.wp-twilight {
  background: linear-gradient(165deg, #2b2350 0%, #5b3a8c 35%, #b85a9e 70%, #ff9b85 100%);
  --glass: rgba(40, 30, 70, 0.55);
  --glass-strong: rgba(48, 36, 84, 0.82);
  --ink: #f3ecff;
  --ink-soft: #bdaede;
  --shadow: 0 18px 50px rgba(10, 5, 30, 0.5);
}
body.wp-midnight {
  background: linear-gradient(180deg, #0d1026 0%, #1a1840 45%, #2d1b54 100%);
  --glass: rgba(22, 20, 52, 0.6);
  --glass-strong: rgba(28, 25, 64, 0.85);
  --ink: #e8e6ff;
  --ink-soft: #9a93c9;
  --shadow: 0 18px 50px rgba(0, 0, 10, 0.6);
}
body.wp-mint {
  background: linear-gradient(165deg, #d8fff1 0%, #bdf5e6 35%, #c4e8ff 70%, #e2d9ff 100%);
}
body.wp-dragonfire {
  background: linear-gradient(180deg, #1a0708 0%, #4a0e12 45%, #8a2415 75%, #d9572a 100%);
  --glass: rgba(46, 14, 16, 0.55);
  --glass-strong: rgba(56, 18, 20, 0.86);
  --ink: #ffe9d9;
  --ink-soft: #d9a58e;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
}

#petals { position: fixed; inset: 0; pointer-events: none; z-index: 5; }

/* ─── screens ─── */
.screen { position: fixed; inset: 0; z-index: 10; }
.hidden { display: none !important; }

/* ─── boot ─── */
#boot {
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, #1a1333, #2d1b54);
  z-index: 100;
}
.boot-inner { text-align: center; color: #f3ecff; }
.boot-logo { font-size: 64px; animation: bootPulse 1.6s ease-in-out infinite; }
@keyframes bootPulse {
  0%, 100% { transform: scale(1) rotate(-4deg); filter: drop-shadow(0 0 12px #ff7eb6); }
  50% { transform: scale(1.12) rotate(4deg); filter: drop-shadow(0 0 28px #ff7eb6); }
}
.boot-title { font-size: 34px; font-weight: 800; letter-spacing: 4px; margin-top: 10px; }
.boot-sub { color: #bdaede; margin-top: 4px; font-size: 13px; letter-spacing: 1px; }
.boot-bar {
  width: 240px; height: 8px; border-radius: 99px; margin: 26px auto 10px;
  background: rgba(255,255,255,0.15); overflow: hidden;
}
.boot-fill {
  height: 100%; width: 0%; border-radius: 99px;
  background: linear-gradient(90deg, #ff7eb6, #c9a6ff);
  transition: width 0.35s ease;
}
.boot-msg { font-size: 12px; color: #9a93c9; min-height: 16px; }

/* ─── login ─── */
#login { display: flex; align-items: center; justify-content: center; }
.login-stage { display: flex; align-items: center; gap: clamp(30px, 7vw, 90px); }
.mascot-side { position: relative; flex: none; }
.login-card {
  width: min(380px, 92vw);
  background: var(--glass-strong);
  backdrop-filter: blur(24px);
  border: 1px solid rgba(255,255,255,0.55);
  border-radius: 26px;
  box-shadow: var(--shadow);
  padding: 26px 30px 22px;
  text-align: center;
  animation: cardIn 0.6s cubic-bezier(0.2, 1.4, 0.4, 1);
}
@keyframes cardIn { from { opacity: 0; transform: translateY(28px) scale(0.94); } }
.mascot { height: min(62vh, 520px); width: auto; display: block; filter: drop-shadow(0 16px 34px rgba(0, 0, 0, 0.45)); animation: mascotBob 4.2s ease-in-out infinite; }
@keyframes mascotBob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
.mascot-lids { opacity: 0; }
.mascot.blink .mascot-eyes { opacity: 0; }
.mascot.blink .mascot-lids { opacity: 1; }
.mascot-bubble {
  position: absolute; top: -4%; right: 65%;
  background: white; color: #8a4a3a; font-size: 12px; font-weight: 700;
  padding: 7px 12px; border-radius: 14px 14px 3px 14px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  white-space: nowrap; animation: bubblePop 0.5s 0.4s cubic-bezier(0.2,1.6,0.4,1) backwards;
  z-index: 2;
}
@keyframes bubblePop { from { opacity: 0; transform: scale(0); } }
@media (max-width: 820px) { .mascot-side { display: none; } }
.login-title { font-size: 26px; font-weight: 800; letter-spacing: 3px; margin: 4px 0 14px; }
.login-tabs {
  display: flex; gap: 6px; background: rgba(150,120,180,0.13);
  border-radius: 99px; padding: 4px; margin-bottom: 16px;
}
.tab {
  flex: 1; border: 0; background: transparent; cursor: pointer;
  font: inherit; font-weight: 700; color: var(--ink-soft);
  padding: 8px 0; border-radius: 99px; transition: all 0.25s;
}
.tab.active { background: var(--accent); color: white; box-shadow: 0 4px 12px color-mix(in srgb, var(--accent) 50%, transparent); }
#auth-form { display: flex; flex-direction: column; gap: 10px; }
#auth-form input {
  font: inherit; color: var(--ink);
  background: rgba(255,255,255,0.65); border: 2px solid transparent;
  border-radius: 14px; padding: 11px 16px; outline: 0; transition: border 0.2s;
}
body.wp-twilight #auth-form input, body.wp-midnight #auth-form input, body.wp-dragonfire #auth-form input { background: rgba(255,255,255,0.1); }
#auth-form input:focus { border-color: var(--accent); }
.auth-error {
  background: #ffe3e8; color: #c5485f; border-radius: 10px;
  font-size: 12.5px; font-weight: 700; padding: 7px 10px;
}
.btn-primary {
  font: inherit; font-weight: 800; letter-spacing: 1px;
  background: linear-gradient(120deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #8a6aff));
  color: white; border: 0; border-radius: 14px; padding: 12px;
  cursor: pointer; transition: transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 8px 20px color-mix(in srgb, var(--accent) 45%, transparent);
}
.btn-primary:hover { transform: translateY(-2px); }
.btn-primary:active { transform: translateY(0) scale(0.98); }
.login-foot { margin-top: 16px; font-size: 11px; color: var(--ink-soft); }

/* ─── desktop chrome ─── */
#topbar {
  position: absolute; top: 0; left: 0; right: 0; height: 38px; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 12px;
  background: var(--glass);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(255,255,255,0.3);
  font-size: 13px;
}
.tb-logo {
  font: inherit; font-weight: 800; color: var(--ink);
  background: transparent; border: 0; cursor: pointer;
  padding: 4px 10px; border-radius: 9px; transition: background 0.2s;
}
.tb-logo:hover { background: rgba(255,255,255,0.35); }
.tb-right { display: flex; align-items: center; gap: 12px; font-weight: 700; }
#tb-clock { font-variant-numeric: tabular-nums; }
.tb-user { color: var(--accent); filter: saturate(1.4); }
.tb-btn {
  font: inherit; border: 0; cursor: pointer; color: var(--ink);
  background: transparent; font-size: 15px; padding: 3px 8px; border-radius: 8px;
}
.tb-btn:hover { background: rgba(255, 120, 150, 0.25); }

#desktop-area { position: absolute; inset: 38px 0 76px; z-index: 11; }

/* ─── dock ─── */
#dock {
  position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%);
  z-index: 60; display: flex; gap: 8px; align-items: flex-end;
  background: var(--glass);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.45);
  border-radius: 22px; padding: 8px 12px;
  box-shadow: var(--shadow);
}
.dock-item {
  position: relative; border: 0; cursor: pointer; background: transparent;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.dock-icon {
  width: 46px; height: 46px; border-radius: 14px;
  display: grid; place-items: center; font-size: 24px;
  transition: transform 0.18s cubic-bezier(0.2, 1.6, 0.4, 1);
  box-shadow: 0 5px 14px rgba(90, 50, 110, 0.22);
}
.dock-item:hover .dock-icon { transform: translateY(-8px) scale(1.12); }
.dock-item:active .dock-icon { transform: translateY(-4px) scale(1.02); }
.dock-dot {
  width: 5px; height: 5px; border-radius: 99px; background: var(--accent);
  opacity: 0; transition: opacity 0.2s;
}
.dock-item.running .dock-dot { opacity: 1; }
.dock-label {
  position: absolute; bottom: 62px; left: 50%; transform: translateX(-50%) scale(0);
  background: var(--glass-strong); color: var(--ink); font-size: 11px; font-weight: 700;
  padding: 4px 10px; border-radius: 9px; white-space: nowrap; pointer-events: none;
  transition: transform 0.18s; box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.dock-item:hover .dock-label { transform: translateX(-50%) scale(1); }

/* ─── windows ─── */
#windows { position: absolute; inset: 0; z-index: 20; pointer-events: none; }
.win {
  position: absolute; pointer-events: auto;
  min-width: 320px; min-height: 200px;
  background: var(--glass-strong);
  backdrop-filter: blur(26px);
  border: 1.5px solid rgba(255,255,255,0.5);
  border-radius: var(--radius);
  box-shadow: 0 14px 40px rgba(70, 35, 95, 0.3);
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: winIn 0.32s cubic-bezier(0.2, 1.4, 0.4, 1);
  transition: opacity 0.18s, transform 0.18s;
}
@keyframes winIn { from { opacity: 0; transform: translateY(22px) scale(0.92); } }
.win.closing { opacity: 0; transform: translateY(16px) scale(0.94); }
.win.focused { border-color: color-mix(in srgb, var(--accent) 65%, white); box-shadow: 0 18px 54px rgba(70, 35, 95, 0.42); }
.win.maxed { border-radius: 0; }
.win-title {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; cursor: grab; flex: none;
  font-weight: 800; font-size: 13.5px;
  background: rgba(255,255,255,0.22);
  border-bottom: 1px solid rgba(255,255,255,0.25);
}
.win-title:active { cursor: grabbing; }
.win-title .w-ico { font-size: 16px; }
.win-title .w-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-btns { display: flex; gap: 7px; }
.w-btn {
  width: 15px; height: 15px; border-radius: 99px; border: 0; cursor: pointer;
  transition: transform 0.15s, filter 0.15s; font-size: 0;
}
.w-btn:hover { transform: scale(1.25); filter: brightness(1.1); }
.w-min { background: #ffd166; }
.w-max { background: #7fdbca; }
.w-close { background: #ff8fa3; }
.win-body { flex: 1; overflow: auto; position: relative; }
.win-resize {
  position: absolute; right: 0; bottom: 0; width: 18px; height: 18px;
  cursor: nwse-resize; z-index: 5;
}
.win-resize::after {
  content: ''; position: absolute; right: 4px; bottom: 4px;
  width: 8px; height: 8px;
  border-right: 2.5px solid var(--ink-soft); border-bottom: 2.5px solid var(--ink-soft);
  border-radius: 2px; opacity: 0.6;
}

/* ─── generic app UI ─── */
.app-toolbar {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 10px; flex-wrap: wrap;
  border-bottom: 1px solid rgba(150,120,180,0.18);
  position: sticky; top: 0; background: inherit; z-index: 2;
}
.icon-btn {
  font: inherit; font-size: 13px; font-weight: 700; color: var(--ink);
  background: rgba(150,120,180,0.13); border: 0; border-radius: 10px;
  padding: 6px 11px; cursor: pointer; transition: background 0.18s, transform 0.12s;
}
.icon-btn:hover { background: color-mix(in srgb, var(--accent) 28%, transparent); }
.icon-btn:active { transform: scale(0.95); }
.icon-btn.accent { background: var(--accent); color: white; }
.spacer { flex: 1; }
.muted { color: var(--ink-soft); font-size: 12px; }

/* ─── files app ─── */
.crumbs { display: flex; align-items: center; gap: 2px; font-size: 12.5px; font-weight: 700; flex-wrap: wrap; }
.crumb { border: 0; background: transparent; font: inherit; color: var(--accent); cursor: pointer; padding: 3px 6px; border-radius: 7px; }
.crumb:hover { background: rgba(150,120,180,0.15); }
.crumb-sep { color: var(--ink-soft); }
.file-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 4px; padding: 12px;
}
.file-item {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 10px 4px 8px; border-radius: 14px; cursor: pointer;
  border: 2px solid transparent; text-align: center;
}
.file-item:hover { background: rgba(150,120,180,0.12); }
.file-item.selected { background: color-mix(in srgb, var(--accent) 18%, transparent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.file-emoji { font-size: 34px; line-height: 1; filter: drop-shadow(0 3px 6px rgba(90,50,110,0.2)); }
.file-name {
  font-size: 11.5px; font-weight: 700; word-break: break-word;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.empty-hint { text-align: center; color: var(--ink-soft); padding: 40px 16px; font-size: 13px; }
.empty-hint .big { font-size: 40px; display: block; margin-bottom: 8px; }

/* ─── notepad ─── */
.notepad-area {
  width: 100%; height: 100%; border: 0; outline: 0; resize: none;
  background: transparent; color: var(--ink);
  font-family: 'JetBrains Mono', monospace; font-size: 13.5px; line-height: 1.65;
  padding: 14px 16px; user-select: text;
}
.notepad-wrap { display: flex; flex-direction: column; height: 100%; }
.notepad-wrap .grow { flex: 1; min-height: 0; }
.dirty-dot { color: var(--accent); font-size: 18px; line-height: 0; }

/* ─── notes app ─── */
.notes-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px; padding: 14px;
}
.note-card {
  border-radius: 16px; padding: 12px 13px; min-height: 120px;
  display: flex; flex-direction: column; gap: 6px;
  box-shadow: 0 6px 16px rgba(90, 50, 110, 0.16);
  transform: rotate(var(--tilt, 0deg)); transition: transform 0.18s;
  color: #5a4660;
}
.note-card:hover { transform: rotate(0) scale(1.03); }
.note-pink { background: linear-gradient(160deg, #ffd9e8, #ffc4dd); }
.note-lavender { background: linear-gradient(160deg, #e8dcff, #d7c4ff); }
.note-mint { background: linear-gradient(160deg, #d4f7e7, #b8eed6); }
.note-sky { background: linear-gradient(160deg, #d8edff, #bfdfff); }
.note-lemon { background: linear-gradient(160deg, #fff4c9, #ffeaa3); }
.note-title {
  font: inherit; font-weight: 800; font-size: 14px; border: 0; background: transparent;
  outline: 0; color: inherit; width: 100%; user-select: text;
}
.note-body {
  font: inherit; font-size: 12.5px; line-height: 1.5; border: 0; background: transparent;
  outline: 0; color: inherit; flex: 1; resize: none; min-height: 60px; user-select: text;
}
.note-foot { display: flex; align-items: center; gap: 5px; }
.note-colors { display: flex; gap: 4px; flex: 1; }
.color-dot { width: 14px; height: 14px; border-radius: 99px; border: 2px solid rgba(255,255,255,0.7); cursor: pointer; padding: 0; }
.dot-pink { background: #ff9ec4; } .dot-lavender { background: #b694ff; }
.dot-mint { background: #5fd6a5; } .dot-sky { background: #6cb2ff; } .dot-lemon { background: #ffd84d; }
.note-del {
  border: 0; background: rgba(255,255,255,0.5); border-radius: 8px;
  cursor: pointer; font-size: 12px; padding: 3px 8px;
}
.note-del:hover { background: #ff8fa3; }

/* ─── terminal ─── */
.term {
  height: 100%; padding: 12px 14px; overflow-y: auto;
  background: rgba(20, 12, 36, 0.92); color: #e8d9ff;
  font-family: 'JetBrains Mono', monospace; font-size: 12.5px; line-height: 1.6;
  user-select: text;
}
.term-line { white-space: pre-wrap; word-break: break-word; }
.term-line .p { color: #ff9ec4; font-weight: 700; }
.term-line.err { color: #ff8fa3; }
.term-line.accent { color: #9be0ff; }
.term-input-row { display: flex; }
.term-input {
  flex: 1; background: transparent; border: 0; outline: 0; color: #e8d9ff;
  font: inherit; caret-color: #ff9ec4;
}

/* ─── settings ─── */
.settings-body { padding: 16px 18px; display: flex; flex-direction: column; gap: 22px; }
.set-section h3 { font-size: 13px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 10px; }
.wp-row { display: flex; gap: 10px; flex-wrap: wrap; }
.wp-swatch {
  width: 86px; height: 56px; border-radius: 12px; cursor: pointer;
  border: 3px solid transparent; position: relative; overflow: hidden;
  transition: transform 0.15s;
}
.wp-swatch:hover { transform: scale(1.06); }
.wp-swatch.active { border-color: var(--accent); }
.wp-swatch span {
  position: absolute; bottom: 3px; left: 0; right: 0; text-align: center;
  font-size: 10px; font-weight: 800; color: white; text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}
.sw-sakura { background: linear-gradient(170deg, #ffe3ef, #e8d3ff, #cfe5ff); }
.sw-twilight { background: linear-gradient(165deg, #2b2350, #b85a9e, #ff9b85); }
.sw-midnight { background: linear-gradient(180deg, #0d1026, #2d1b54); }
.sw-mint { background: linear-gradient(165deg, #d8fff1, #c4e8ff, #e2d9ff); }
.sw-dragonfire { background: linear-gradient(180deg, #1a0708, #8a2415, #d9572a); }
.accent-row { display: flex; gap: 9px; flex-wrap: wrap; }
.accent-dot { width: 30px; height: 30px; border-radius: 99px; cursor: pointer; border: 3px solid rgba(255,255,255,0.8); transition: transform 0.15s; padding: 0; }
.accent-dot:hover { transform: scale(1.15); }
.accent-dot.active { border-color: var(--ink); }
.set-form { display: flex; flex-direction: column; gap: 8px; max-width: 280px; }
.set-form input {
  font: inherit; color: var(--ink); background: rgba(150,120,180,0.12);
  border: 2px solid transparent; border-radius: 11px; padding: 9px 13px; outline: 0;
}
.set-form input:focus { border-color: var(--accent); }
.danger-zone { border: 2px dashed #ff8fa3; border-radius: 14px; padding: 12px 14px; }
.btn-danger {
  font: inherit; font-weight: 800; background: #ff5d7e; color: white;
  border: 0; border-radius: 11px; padding: 9px 14px; cursor: pointer;
}
.btn-danger:hover { background: #e8466a; }

/* ─── about ─── */
.about-body { padding: 24px; text-align: center; display: flex; flex-direction: column; gap: 8px; }
.about-body .logo { font-size: 52px; animation: bootPulse 2.4s ease-in-out infinite; }
.about-body h2 { font-size: 22px; letter-spacing: 3px; }
.about-body .ver { color: var(--ink-soft); font-size: 12px; }
.about-kv { font-size: 12.5px; color: var(--ink-soft); line-height: 1.9; }
.about-kv b { color: var(--ink); }

/* ─── context menu ─── */
#ctx-menu {
  position: fixed; z-index: 300; min-width: 160px;
  background: var(--glass-strong); backdrop-filter: blur(22px);
  border: 1px solid rgba(255,255,255,0.5); border-radius: 14px;
  box-shadow: var(--shadow); padding: 5px;
  animation: ctxIn 0.14s ease-out;
}
@keyframes ctxIn { from { opacity: 0; transform: scale(0.92); } }
.ctx-item {
  display: block; width: 100%; text-align: left; border: 0; background: transparent;
  font: inherit; font-size: 13px; font-weight: 700; color: var(--ink);
  padding: 8px 12px; border-radius: 9px; cursor: pointer;
}
.ctx-item:hover { background: color-mix(in srgb, var(--accent) 25%, transparent); }
.ctx-item.danger:hover { background: #ff8fa3; color: white; }

/* ─── modal ─── */
#overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(60, 30, 80, 0.35); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
}
.modal {
  width: min(340px, 90vw); background: var(--glass-strong);
  backdrop-filter: blur(26px); border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.5);
  box-shadow: var(--shadow); padding: 20px 22px;
  animation: cardIn 0.3s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.modal h3 { font-size: 16px; margin-bottom: 12px; }
.modal input {
  width: 100%; font: inherit; color: var(--ink);
  background: rgba(150,120,180,0.12); border: 2px solid transparent;
  border-radius: 11px; padding: 9px 13px; outline: 0; margin-bottom: 12px;
}
.modal input:focus { border-color: var(--accent); }
.modal-btns { display: flex; gap: 8px; justify-content: flex-end; }

/* ─── toasts ─── */
#toasts {
  position: fixed; top: 48px; right: 14px; z-index: 400;
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.toast {
  background: var(--glass-strong); backdrop-filter: blur(20px);
  color: var(--ink); font-size: 13px; font-weight: 700;
  border: 1px solid rgba(255,255,255,0.5); border-left: 4px solid var(--accent);
  border-radius: 13px; padding: 10px 15px;
  box-shadow: var(--shadow);
  animation: toastIn 0.32s cubic-bezier(0.2, 1.5, 0.4, 1);
}
.toast.err { border-left-color: #ff5d7e; }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px); } }
.toast.bye { opacity: 0; transform: translateX(40px); transition: all 0.3s; }

/* scrollbars */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--accent) 45%, transparent); border-radius: 99px; }

@media (max-width: 600px) {
  .win { min-width: 260px; }
  .dock-icon { width: 40px; height: 40px; font-size: 21px; }
}
