/* ═══════════════════════════════════════════════════════════
   Desk —— 深夜桌面：上海的天际线、颗粒、以及打工人的考勤卡
   ═══════════════════════════════════════════════════════════ */

.desk {
  position: relative;
  height: 100%;
  width: 100%;
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  /* 必须显式给行高：否则隐式行是 auto，手机壳的 height:100% 会变成循环依赖，
     解析成 auto，内容一多就把底部（插话面板/输入栏）顶出屏幕。 */
  grid-template-rows: minmax(0, 1fr);
  align-items: stretch;
  overflow: hidden;
}

/* ─────────────── 背景 ─────────────── */

.desk-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(120% 80% at 78% 108%, rgba(255, 77, 61, 0.11), transparent 58%),
    radial-gradient(90% 70% at 18% 6%, rgba(47, 211, 168, 0.075), transparent 62%),
    radial-gradient(70% 50% at 50% 40%, rgba(139, 127, 212, 0.06), transparent 70%),
    linear-gradient(178deg, #060810 0%, #080b14 42%, #0b0f1a 100%);
}

/* 上海天际线剪影 */
.skyline {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 42%;
  z-index: 0;
  opacity: 0.85;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 300' preserveAspectRatio='none'%3E%3Cg fill='%230d1220'%3E%3Crect x='0' y='150' width='44' height='150'/%3E%3Crect x='44' y='90' width='48' height='210'/%3E%3Crect x='92' y='180' width='36' height='120'/%3E%3Crect x='128' y='55' width='48' height='245'/%3E%3Crect x='176' y='130' width='38' height='170'/%3E%3Crect x='214' y='200' width='54' height='100'/%3E%3Crect x='268' y='105' width='32' height='195'/%3E%3Crect x='300' y='160' width='50' height='140'/%3E%3Crect x='350' y='70' width='52' height='230'/%3E%3Crect x='402' y='185' width='38' height='115'/%3E%3Crect x='440' y='120' width='54' height='180'/%3E%3Crect x='494' y='45' width='36' height='255'/%3E%3Crect x='530' y='150' width='58' height='150'/%3E%3Crect x='588' y='100' width='32' height='200'/%3E%3Crect x='620' y='175' width='56' height='125'/%3E%3Crect x='676' y='80' width='40' height='220'/%3E%3Crect x='716' y='135' width='44' height='165'/%3E%3Crect x='760' y='195' width='52' height='105'/%3E%3Crect x='812' y='60' width='38' height='240'/%3E%3Crect x='850' y='125' width='56' height='175'/%3E%3Crect x='906' y='170' width='34' height='130'/%3E%3Crect x='940' y='95' width='56' height='205'/%3E%3Crect x='996' y='150' width='34' height='150'/%3E%3Crect x='1030' y='190' width='58' height='110'/%3E%3Crect x='1088' y='65' width='36' height='235'/%3E%3Crect x='1124' y='140' width='56' height='160'/%3E%3Crect x='1180' y='105' width='34' height='195'/%3E%3Crect x='1214' y='180' width='54' height='120'/%3E%3Crect x='1268' y='85' width='32' height='215'/%3E%3Crect x='1300' y='155' width='56' height='145'/%3E%3Crect x='1356' y='115' width='36' height='185'/%3E%3Crect x='1392' y='50' width='48' height='250'/%3E%3Crect x='598' y='22' width='7' height='278'/%3E%3Ccircle cx='601.5' cy='86' r='15'/%3E%3Ccircle cx='601.5' cy='146' r='10'/%3E%3Crect x='592' y='196' width='19' height='104'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 100% 100%;
  background-repeat: no-repeat;
  filter: drop-shadow(0 -18px 40px rgba(255, 120, 80, 0.07));
}

/* 夜空颗粒，让大片纯色不发死 */
.desk-grain {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.4;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.42'/%3E%3C/svg%3E");
  animation: grainShift 7s steps(6) infinite;
}

@keyframes grainShift {
  0% { transform: translate(0, 0); }
  20% { transform: translate(-3%, 2%); }
  40% { transform: translate(2%, -3%); }
  60% { transform: translate(-2%, -2%); }
  80% { transform: translate(3%, 1%); }
  100% { transform: translate(0, 0); }
}

/* ═══════════════ 考勤卡 / 工资条 ═══════════════ */

.rail {
  position: relative;
  z-index: 3;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 22px 10px 60px 22px;
  scrollbar-width: thin;
}

.rail-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 262px;
}

/* 抽屉头部（含关闭按钮）只在窄屏出现 */
.rail-head {
  display: none;
}

.card {
  position: relative;
  background: linear-gradient(168deg, #f7f4ec, #e6e1d3);
  color: #1b1d24;
  border-radius: 3px;
  padding: 14px 15px 15px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  /* 撕纸边缘 */
  --notch: 6px;
  -webkit-mask-image: radial-gradient(circle at 0 50%, transparent var(--notch), #000 calc(var(--notch) + 0.5px)),
    radial-gradient(circle at 100% 50%, transparent var(--notch), #000 calc(var(--notch) + 0.5px));
  -webkit-mask-composite: source-in;
  mask-image: radial-gradient(circle at 0 50%, transparent var(--notch), #000 calc(var(--notch) + 0.5px)),
    radial-gradient(circle at 100% 50%, transparent var(--notch), #000 calc(var(--notch) + 0.5px));
  mask-composite: intersect;
}

.card::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.028) 0 1px,
    transparent 1px 3px
  );
  border-radius: inherit;
}

.card-kicker {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #6f6a5e;
  margin-bottom: 6px;
}

.card-time .card-date {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #14161c;
  line-height: 1.2;
}

.card-time .card-range {
  font-size: 11px;
  color: #7a7466;
  margin-top: 2px;
}

.card-cny {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px dashed rgba(0, 0, 0, 0.22);
  font-size: 11.5px;
  color: #5d584d;
}
.card-cny b {
  font-size: 15px;
  color: #c0392b;
}
.card-cny b.hot {
  animation: cnyPulse 1.8s ease-in-out infinite;
}
@keyframes cnyPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

.dow {
  display: flex;
  gap: 3px;
  margin-top: 9px;
}
.dow span {
  flex: 1;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 9px;
  padding: 3px 0;
  color: #7d776a;
  background: rgba(0, 0, 0, 0.045);
  border-radius: 2px;
}
.dow span.weekend {
  color: #c0392b;
  background: rgba(192, 57, 43, 0.09);
}

/* 工资条 */
.card-pay .pay-money {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.045em;
  color: #14161c;
  line-height: 1;
  margin-top: 2px;
}
.card-pay .pay-money .cur {
  font-size: 15px;
  font-weight: 500;
  color: #8a8477;
  margin-right: 2px;
}
.card-pay .pay-money.low {
  color: #c0392b;
}
.card-pay .pay-sub {
  font-size: 10px;
  color: #8a8477;
  margin-top: 4px;
  letter-spacing: 0.04em;
}

.meters {
  margin-top: 11px;
  padding-top: 10px;
  border-top: 1px dashed rgba(0, 0, 0, 0.22);
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.meter {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 7px;
}
.m-label {
  font-size: 10.5px;
  color: #6f6a5e;
  letter-spacing: 0.02em;
}
.m-num {
  font-size: 11px;
  color: #3c3a34;
  font-weight: 600;
  min-width: 24px;
  text-align: right;
}
.meter .bar {
  background: rgba(0, 0, 0, 0.13);
}
.meter .pips i {
  background: rgba(0, 0, 0, 0.14);
}
.meter .pips i.on {
  background: #1f9c78;
  box-shadow: 0 0 6px rgba(31, 156, 120, 0.6);
}

/* 催婚压力 */
.card-press {
  background: linear-gradient(168deg, #fbf1ec, #eed9d0);
}
.card-press .bar {
  background: rgba(0, 0, 0, 0.12);
  margin: 4px 0 7px;
}
.card-press .bar i {
  background: linear-gradient(90deg, #d9534f, #c0392b);
}
.press-desc {
  font-size: 11px;
  color: #6a5a52;
  line-height: 1.5;
}
.press-family {
  margin-top: 6px;
  font-size: 9.5px;
  color: #8d7d74;
  letter-spacing: 0.05em;
}

/* 话题清单 */
.card-topics .topic {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 6px 5px;
  border-radius: 3px;
  text-align: left;
  transition: background var(--t-fast);
  border-bottom: 1px solid rgba(0, 0, 0, 0.07);
}
.card-topics .topic:last-child {
  border-bottom: none;
}
.card-topics .topic:hover {
  background: rgba(0, 0, 0, 0.055);
}
.topic-mark {
  font-size: 9px;
  font-family: var(--font-mono);
  padding: 2px 0;
  text-align: center;
  border-radius: 2px;
  background: rgba(192, 57, 43, 0.14);
  color: #c0392b;
  font-weight: 600;
}
.topic.done .topic-mark {
  background: rgba(31, 156, 120, 0.16);
  color: #1f7a5f;
}
.topic.closed .topic-mark {
  background: rgba(0, 0, 0, 0.08);
  color: #8a8477;
}
.topic-title {
  font-size: 12px;
  color: #23252c;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topic-prog {
  font-size: 9px;
  color: #9a948a;
}

/* 待办 */
.todo-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 7px 8px;
  margin-bottom: 4px;
  border-radius: 3px;
  background: rgba(192, 57, 43, 0.075);
  border-left: 3px solid #c0392b;
  text-align: left;
  transition: all var(--t-fast);
}
.todo-item:hover {
  background: rgba(192, 57, 43, 0.14);
  transform: translateX(2px);
}
.todo-label {
  font-size: 11.5px;
  color: #2b2d35;
}
.todo-hint {
  font-size: 9.5px;
  font-family: var(--font-mono);
  color: #c0392b;
  flex: none;
}

.rail-foot {
  font-size: 9px;
  letter-spacing: 0.24em;
  color: var(--text-faint);
  text-align: center;
  padding: 10px 0 30px;
  text-transform: uppercase;
}

/* 红色骑缝章 */
.card-time::before {
  content: '考勤';
  position: absolute;
  right: 12px;
  top: 12px;
  font-family: var(--font-serif);
  font-size: 10px;
  letter-spacing: 0.2em;
  color: rgba(192, 57, 43, 0.55);
  border: 1.5px solid rgba(192, 57, 43, 0.4);
  border-radius: 2px;
  padding: 2px 5px 2px 7px;
  transform: rotate(6deg);
  pointer-events: none;
}

/* ─────────────── 手机所在的中栏 ─────────────── */

.phone-wrap {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-width: 0;
  min-height: 0;
  padding: 22px 24px;
}

.desk-hint {
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--text-faint);
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 窄屏抽屉的遮罩：宽屏下必须完全不参与布局，
   否则它会占掉 .desk 网格的第 2 列，把手机挤到视口外面去。 */
.rail-scrim {
  display: none;
}

/* ─────────────── 响应式 ─────────────── */

@media (max-width: 1180px) {
  .desk {
    grid-template-columns: 236px minmax(0, 1fr);
  }
  .rail-stack { max-width: 218px; }
  .rail { padding-left: 16px; padding-right: 8px; }
}

@media (max-width: 900px) {
  .desk {
    grid-template-columns: minmax(0, 1fr);
  }
  /* 抽屉开关必须和抽屉本身在同一个断点里，否则会出现
     "考勤卡变成了抽屉、却没有按钮打开"的死角（769~900px 就中过这个招） */
  .rail-toggle {
    display: grid;
  }
  .rail {
    position: fixed;
    inset: 0 auto 0 0;
    width: 288px;
    background: rgba(6, 8, 16, 0.97);
    backdrop-filter: blur(18px);
    border-right: 1px solid var(--line);
    z-index: 40;
    transform: translateX(-102%);
    transition: transform var(--t-mid) var(--ease-out);
    padding: 20px 12px 40px 18px;
  }
  .desk.rail-open .rail {
    transform: none;
    box-shadow: 40px 0 90px rgba(0, 0, 0, 0.6);
  }
  .rail-scrim {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 39;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--t-mid);
  }
  .desk.rail-open .rail-scrim {
    opacity: 1;
    pointer-events: auto;
  }
  .desk-hint { display: none; }
  .phone-wrap { padding: 10px; }
}

/* 抽屉开关：只在窄屏出现，宽屏时完全退出布局 */
.rail-toggle {
  display: none;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-right: 2px;
  border-radius: 8px;
  font-size: 15px;
  color: var(--text-dim);
  flex: none;
  transition: background var(--t-fast);
}
.rail-toggle:active {
  background: rgba(255, 255, 255, 0.09);
}
