/* 应用大厅 · 明亮彩色 */
:root {
  --bg: #f6f7fa;
  --ink: #16181d;
  --ink-2: #5f6674;
  --ink-3: #9aa1ad;
  --line: #e7e9ef;
  --violet: #7c5cff;
  --pink: #ff5470;
  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --sans: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "Helvetica Neue", Arial, sans-serif;
  --mono: "SFMono-Regular", "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
[hidden] { display: none !important; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(124, 92, 255, 0.18); }

/* ── 背景光晕 ───────────────────────── */
.bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(640px 420px at 10% -6%, rgba(124, 92, 255, 0.14), transparent 62%),
    radial-gradient(720px 480px at 96% -2%, rgba(255, 84, 112, 0.1), transparent 58%),
    radial-gradient(900px 600px at 50% 112%, rgba(58, 141, 255, 0.09), transparent 62%);
}
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.6'/%3E%3C/svg%3E");
}

/* ── 顶栏 ───────────────────────────── */
.topbar {
  position: relative;
  z-index: 2;
  max-width: 1140px;
  margin: 0 auto;
  height: 68px;
  padding: 0 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.wordmark {
  font-family: var(--serif);
  font-size: 15.5px;
  letter-spacing: 0.38em;
  color: var(--ink);
  text-decoration: none;
}
a.wordmark:hover { opacity: 0.75; }

.topbar-right { display: flex; align-items: center; gap: 16px; }

.clock { text-align: right; }
.clock-time {
  display: block;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-2);
  letter-spacing: 0.06em;
}
.clock-date {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  color: var(--ink-3);
}

.manage-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, #7c5cff, #c04cff);
  color: #fff;
  font-size: 11.5px;
  font-family: var(--sans);
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow: 0 6px 16px -8px rgba(124, 92, 255, 0.7);
  transition: filter 0.2s, transform 0.2s;
}
.manage-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }

.logout-btn {
  padding: 5px 11px;
  border: 1px solid #e0e3ea;
  border-radius: 999px;
  background: #fff;
  color: var(--ink-3);
  font-size: 11px;
  font-family: var(--sans);
  letter-spacing: 0.04em;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.2s, border-color 0.2s;
}
.logout-btn:hover { color: var(--ink); border-color: #c6cad3; }

.user-chip { display: inline-flex; align-items: center; margin-left: 2px; text-decoration: none; }
.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  overflow: hidden;
  position: relative;
  background: linear-gradient(135deg, #7c5cff, #c04cff);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  box-shadow: 0 0 0 2px #fff, 0 0 0 3px #e7e9ef, 0 8px 18px -8px rgba(124, 92, 255, 0.65);
}
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar:hover { filter: brightness(1.06); }

/* ── 主体 ───────────────────────────── */
.stage { max-width: 1140px; margin: 0 auto; padding: 0 40px; }

.hero { padding: 84px 0 46px; }

.greeting {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(34px, 4.6vw, 54px);
  line-height: 1.2;
  letter-spacing: 0.01em;
  color: var(--ink);
}

.hero-sub {
  margin: 16px 0 0;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--ink-2);
}
.dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c5cff, #ff5470);
}

/* ── 应用格 ─────────────────────────── */
.apps {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
  padding-bottom: 90px;
}

.tile {
  position: relative;
  grid-column: span 6;
  min-height: 296px;
  padding: 20px 22px 22px;
  display: flex;
  flex-direction: column;
  border-radius: 20px;
  overflow: hidden;
  color: #fff;
  background: linear-gradient(135deg, #7c5cff, #c04cff 55%, #ff5fa2);
  box-shadow: 0 18px 40px -18px rgba(124, 92, 255, 0.55);
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.28s, filter 0.28s;
  animation: rise 0.55s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.tile:nth-of-type(2) {
  background: linear-gradient(135deg, #ff9a3d, #ff5470);
  box-shadow: 0 18px 40px -18px rgba(255, 84, 112, 0.5);
}
.tile:nth-of-type(3) { background: linear-gradient(135deg, #12c2b0, #3a8dff); box-shadow: 0 18px 40px -18px rgba(58, 141, 255, 0.5); }
.tile:nth-of-type(4) { background: linear-gradient(135deg, #f7b731, #ff7a59); box-shadow: 0 18px 40px -18px rgba(247, 183, 49, 0.5); }
.tile:nth-of-type(5) { background: linear-gradient(135deg, #3a8dff, #7c5cff); box-shadow: 0 18px 40px -18px rgba(58, 141, 255, 0.5); }
.tile:nth-of-type(2) { animation-delay: 0.05s; }
.tile:nth-of-type(3) { animation-delay: 0.1s; }
.tile:nth-of-type(4) { animation-delay: 0.15s; }

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

.tile::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 30%), rgba(255, 255, 255, 0.16), transparent 65%);
  opacity: 0;
  transition: opacity 0.3s;
}
.tile::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(15, 10, 25, 0) 40%, rgba(15, 10, 25, 0.26) 100%);
}

.tile:hover {
  transform: translateY(-3px);
  filter: brightness(1.04) saturate(1.04);
}
.tile:hover::before { opacity: 1; }

.tile-feature { grid-column: span 7; min-height: 318px; }
.tile-feature + .tile { grid-column: span 5; }
/* 奇数个应用时，最后一张拉通整行，避免落单 */
.tile:last-of-type:nth-of-type(odd) { grid-column: span 12; }

.tile-link { position: absolute; inset: 0; z-index: 2; }

.tile-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 3;
  pointer-events: none;
}

.tag {
  font-size: 10.5px;
  line-height: 1;
  color: #fff;
  letter-spacing: 0.1em;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  padding: 4px 9px;
}

.tag-lock { border-style: dashed; }

.empty-board {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  gap: 14px;
  padding: 70px 20px;
  border: 1.5px dashed #cfd4de;
  border-radius: 20px;
  color: var(--ink-3);
  font-size: 13.5px;
}
.empty-board p { margin: 0; }
.empty-board .manage-btn { text-decoration: none; }

/* ---------------------------------------------------------- 留言板 */
.comments {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 40px 70px;
  position: relative;
  z-index: 1;
}
.comments-inner { border-top: 1px solid var(--line); padding-top: 26px; }
.comments-title {
  margin: 0 0 18px;
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 600;
}
.comments-count {
  margin-left: 8px;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 400;
  color: var(--ink-3);
}

.comment-form { display: flex; gap: 12px; margin-bottom: 22px; }
.comment-form-main { flex: 1; min-width: 0; }
#comment-input {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 10px 12px;
  font: 13.5px/1.65 var(--sans);
  color: var(--ink);
  outline: none;
  resize: vertical;
  min-height: 58px;
}
#comment-input:focus { border-color: rgba(124, 92, 255, 0.55); box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.08); }
.comment-form-foot {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}
.comment-send { padding: 7px 16px; font-size: 12.5px; }
.form-error { color: #e2455e; font-size: 12px; }

.comment-guest { color: var(--ink-2); font-size: 13px; margin: 0 0 20px; }
.comment-guest a { color: var(--violet); }

.comment-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.comment { display: flex; gap: 12px; }
.comment-avatar {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #7c5cff, #c04cff);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
}
.comment-avatar img { width: 100%; height: 100%; object-fit: cover; }
.comment-body {
  flex: 1;
  min-width: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 14px 12px;
}
.comment-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.comment-name { font-size: 13px; }
.comment-meta {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.02em;
  color: var(--ink-3);
}
.comment-text {
  margin: 6px 0 0;
  font-size: 13.5px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}
.comment-del {
  margin-left: auto;
  border: 0;
  background: none;
  color: #e2455e;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
}
.comment-empty { color: var(--ink-3); font-size: 13px; text-align: center; padding: 22px 0 0; margin: 0; }

@media (max-width: 560px) {
  .comments { padding: 0 18px 50px; }
  .comment-form { gap: 10px; }
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  font-size: 10.5px;
  color: #fff;
}
.status i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.7);
}
.status em { font-style: normal; letter-spacing: 0.05em; }
.status.on i { background: #a6ffcb; box-shadow: 0 0 7px rgba(166, 255, 203, 0.9); }
.status.off i { background: #ffc2b8; box-shadow: 0 0 7px rgba(255, 194, 184, 0.9); }

.glyph {
  position: absolute;
  right: 16px;
  top: 32px;
  z-index: 0;
  font-family: var(--serif);
  font-size: 72px;
  line-height: 1;
  color: rgba(255, 255, 255, 0.16);
  user-select: none;
  pointer-events: none;
  transition: color 0.3s;
}
.tile-feature .glyph { font-size: 86px; }
.tile:hover .glyph { color: rgba(255, 255, 255, 0.22); }

.tile-body {
  margin-top: auto;
  position: relative;
  z-index: 3;
  pointer-events: none;
}
.tile-name {
  margin: 0 0 7px;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 25px;
  letter-spacing: 0.02em;
}
.tile-desc {
  margin: 0;
  max-width: 36ch;
  font-size: 12.5px;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.88);
}

.go {
  position: absolute;
  right: 18px;
  bottom: 18px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 50%;
  color: #fff;
  z-index: 3;
  pointer-events: none;
  transition: background 0.22s, color 0.22s, transform 0.22s;
}
.tile:hover .go { background: #fff; color: #333; transform: translate(1px, -1px); }

/* 编辑态 */
body.editing .tile:hover { transform: none; }
body.editing .go { display: none; }

.tile-remove {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 4;
  width: 26px;
  height: 26px;
  display: none;
  place-items: center;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: #ff5470;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(22, 24, 29, 0.18);
  transition: transform 0.15s;
}
.tile-remove:hover { transform: scale(1.08); }
body.editing .tile-remove { display: grid; }

.tile-add {
  grid-column: span 6;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1.5px dashed #cfd4de;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.55);
  color: var(--ink-3);
  font-family: var(--sans);
  cursor: pointer;
  box-shadow: none;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
  animation: none;
}
.tile-add:hover {
  border-color: var(--violet);
  color: var(--violet);
  background: rgba(124, 92, 255, 0.05);
  transform: none;
  filter: none;
}
.tile-add::before { display: none; }
.add-plus { font-size: 24px; font-weight: 300; line-height: 1; }
.add-text { font-size: 12px; letter-spacing: 0.06em; }

/* ── 弹层 ───────────────────────────── */
dialog.sheet {
  width: min(440px, calc(100vw - 40px));
  padding: 26px 26px 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  color: var(--ink);
  font-family: var(--sans);
  box-shadow: 0 30px 80px -30px rgba(22, 24, 29, 0.45);
}
dialog.sheet::backdrop {
  background: rgba(22, 24, 29, 0.32);
  backdrop-filter: blur(6px);
}

.sheet-title {
  margin: 0 0 6px;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
}
.sheet-sub { margin: 0 0 18px; font-size: 12px; color: var(--ink-2); }

.field { display: block; margin-bottom: 12px; }
.field span {
  display: block;
  margin-bottom: 6px;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--ink-3);
}
.field input {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid #dfe2e9;
  border-radius: 9px;
  background: #fafbfd;
  color: var(--ink);
  font-size: 13px;
  font-family: var(--sans);
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}
.field input:focus { border-color: rgba(124, 92, 255, 0.6); background: #fff; }
.field input::placeholder { color: #b3b8c2; }

.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.vh {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px 0 4px;
  font-size: 12px;
  color: var(--ink-2);
  cursor: pointer;
}
.check input { width: 14px; height: 14px; accent-color: #7c5cff; }

.form-error { margin: 2px 0 8px; font-size: 11.5px; color: #e2455e; }

.sheet-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.btn {
  padding: 6px 14px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 12px;
  font-family: var(--sans);
  cursor: pointer;
  transition: filter 0.2s, border-color 0.2s, color 0.2s, background 0.2s;
}
.btn.primary {
  background: linear-gradient(135deg, #7c5cff, #c04cff);
  color: #fff;
  box-shadow: 0 6px 14px -8px rgba(124, 92, 255, 0.7);
}
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { background: #fff; border-color: #dfe2e9; color: var(--ink-2); }
.btn.ghost:hover { color: var(--ink); border-color: #c6cad3; }
.btn.danger { background: #fff0f2; border-color: #ffd3da; color: #e2455e; }
.btn.danger:hover { background: #ffe4e8; }

:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }

/* ── 响应式 ─────────────────────────── */
@media (max-width: 860px) {
  .tile, .tile-feature, .tile-feature + .tile, .tile:last-of-type:nth-of-type(odd) { grid-column: span 12; }
  .tile { min-height: 220px; }
  .glyph { font-size: 56px; }
  .tile-feature .glyph { font-size: 64px; }
  .hero { padding: 44px 0 30px; }
}

@media (max-width: 560px) {
  .topbar, .stage { padding-left: 18px; padding-right: 18px; }
  .topbar { height: 58px; }
  .clock { display: none; }
  .greeting { font-size: 30px; }
  .hero-sub { flex-wrap: wrap; gap: 6px; }
  .tile { padding: 18px; min-height: 196px; }
  .tile-name { font-size: 21px; }
  .field-grid { grid-template-columns: 1fr; gap: 0; }
  .apps { padding-bottom: 48px; }
}

@media (prefers-reduced-motion: reduce) {
  .tile { animation: none; transition: none; }
  .tile:hover { transform: none; }
  .tile::before, .go, .glyph { transition: none; }
}
