/* 班级小喇叭 · 手机 App */
:root {
  --nav-h: 62px;
}
body.app {
  min-height: 100dvh;
  background:
    radial-gradient(760px 380px at 12% -6%, #fff3dd 0%, rgba(255, 243, 221, 0) 62%),
    var(--cream);
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
}

/* ---------- 顶栏 ---------- */
.app-head {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 16px 10px;
  background: linear-gradient(to bottom, rgba(255, 248, 238, .96) 65%, rgba(255, 248, 238, 0));
  backdrop-filter: blur(8px);
}
.hd-brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.hd-logo {
  width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; flex: 0 0 auto;
  background: linear-gradient(140deg, #ffb457, #f4761a);
  box-shadow: 0 6px 14px rgba(244, 118, 26, .3);
}
.hd-logo svg { width: 19px; height: 19px; }
.hd-title { font-size: 16px; font-weight: 800; letter-spacing: .3px; line-height: 1.15; }
.hd-sub { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--muted); margin-top: 2px; }
.hd-sub .dot { width: 6px; height: 6px; }

.code-chip {
  display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto;
  background: #fff; border: 1px solid var(--line); border-radius: 999px;
  padding: 7px 12px; font-size: 12px; font-weight: 700; color: var(--muted);
  box-shadow: var(--shadow-sm);
}
.code-chip b { color: var(--orange); letter-spacing: 1.5px; font-size: 12.5px; }

/* ---------- 内容区 ---------- */
.app-main { padding: 4px 16px 20px; }
.view { animation: fadeIn .22s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.card {
  background: #fff; border-radius: 20px; border: 1px solid #f2e7d8;
  box-shadow: var(--shadow); padding: 15px;
}
.sec-title {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12.5px; font-weight: 700; color: var(--muted); letter-spacing: .6px;
  margin: 18px 4px 9px;
}
.sec-title .act { color: var(--orange); font-weight: 600; letter-spacing: 0; cursor: pointer; }

/* 发送 */
.compose { position: relative; }
.compose textarea {
  width: 100%; min-height: 96px; max-height: 38vh; resize: none; border: 0; outline: none;
  font-size: 18px; line-height: 1.55; color: var(--ink); background: transparent; padding: 0 40px 0 0;
}
.compose textarea::placeholder { color: #bbae9c; }
.compose-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.counter { font-size: 12px; color: #b6a894; font-variant-numeric: tabular-nums; }
.mic-btn {
  position: absolute; right: 10px; top: 10px; width: 38px; height: 38px; border-radius: 12px;
  display: grid; place-items: center; background: var(--orange-soft); color: var(--orange);
  border: 1px solid #ffe0bd;
}
.mic-btn svg { width: 19px; height: 19px; }
.mic-btn.rec { background: #ffe4e8; color: var(--red); border-color: #ffc9d2; animation: micPulse 1.2s ease-in-out infinite; }
@keyframes micPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(225, 29, 72, .25); } 50% { box-shadow: 0 0 0 8px rgba(225, 29, 72, 0); } }

.opts-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.seg-pill { display: flex; background: #f7f1e8; border-radius: 11px; padding: 3px; flex: 1; }
.seg-pill button { flex: 1; padding: 7px 0; border-radius: 8px; font-size: 13px; font-weight: 700; color: var(--muted); }
.seg-pill button.on { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }
.urgent-btn {
  display: flex; align-items: center; gap: 6px; padding: 9px 13px; border-radius: 11px;
  border: 1.5px solid #f1e6d6; background: #fff; font-size: 13px; font-weight: 700; color: var(--muted);
}
.urgent-btn.on { background: #ffe9ee; border-color: #ffbccb; color: var(--red); }

.send-btn {
  width: 100%; height: 54px; margin-top: 14px; border-radius: 16px;
  font-size: 17px; font-weight: 800; letter-spacing: 2px; color: #fff;
  background: linear-gradient(135deg, #fb8c2e, #ef6a10);
  box-shadow: 0 12px 24px rgba(242, 102, 12, .28);
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.send-btn:active { transform: scale(.985); }
.send-btn.danger { background: linear-gradient(135deg, #f43f5e, #d1123f); box-shadow: 0 12px 24px rgba(209, 18, 63, .26); }
.send-btn:disabled { filter: grayscale(.4) brightness(1.03); box-shadow: none; }
.spinner { width: 17px; height: 17px; border-radius: 50%; border: 2.5px solid rgba(255, 255, 255, .45); border-top-color: #fff; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 快捷消息 */
.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quick-card {
  position: relative; text-align: left; padding: 11px 12px 10px; border-radius: 16px;
  background: #fff; border: 1px solid #f1e6d6; box-shadow: var(--shadow-sm);
  transition: transform .12s ease, border-color .16s ease;
}
.quick-card:active { transform: scale(.97); border-color: #ffd9b0; }
.quick-card .qc-ico { font-size: 16px; line-height: 1; margin-bottom: 5px; }
.quick-card .qc-text {
  font-size: 13.5px; font-weight: 600; color: #3b4654; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.quick-card .qc-del {
  position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%;
  background: #ffe4e8; color: var(--red); font-size: 13px; font-weight: 700; display: none;
  place-items: center;
}
body.editing .quick-card .qc-del { display: grid; }
.quick-add {
  display: grid; place-items: center; min-height: 82px; border-radius: 16px;
  border: 1.5px dashed #e2d3be; color: #b09b80; font-size: 13px; font-weight: 600; background: #fffdfa;
}

/* 定时任务 */
.task-card {
  display: flex; align-items: flex-start; gap: 12px; padding: 13px 14px; border-radius: 16px;
  background: #fff; border: 1px solid #f1e6d6; box-shadow: var(--shadow-sm); margin-bottom: 10px;
}
.task-card.off { opacity: .55; }
.tc-time { font-size: 20px; font-weight: 800; color: var(--orange); font-variant-numeric: tabular-nums; line-height: 1.1; flex: 0 0 auto; }
.tc-body { flex: 1; min-width: 0; }
.tc-days { font-size: 11.5px; color: #a3947f; margin-bottom: 3px; }
.tc-text { font-size: 13.5px; color: #3b4654; line-height: 1.4; }
.tc-switch { width: 40px; height: 23px; border-radius: 999px; background: #e3d9cb; position: relative; flex: 0 0 auto; transition: background .2s; }
.tc-switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }
.task-card.on .tc-switch { background: var(--green); }
.task-card.on .tc-switch::after { transform: translateX(17px); }

.empty-tip { text-align: center; color: #a99a86; font-size: 13px; line-height: 1.9; padding: 26px 10px; }
.empty-tip b { display: block; font-size: 15px; color: #6b7684; margin-bottom: 4px; }

.add-task {
  width: 100%; height: 48px; border-radius: 14px; border: 1.5px dashed #e2d3be;
  color: var(--orange); font-size: 14.5px; font-weight: 700; background: #fffdfa;
}

/* ---------- 底部导航 ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: rgba(255, 252, 246, .95); border-top: 1px solid #f0e5d5;
  backdrop-filter: blur(12px);
}
.tabbar button {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 0; font-size: 11px; font-weight: 700; color: #b3a48f; border-radius: 12px;
}
.tabbar button svg { width: 21px; height: 21px; }
.tabbar button.on { color: var(--orange); }
.tabbar button.on svg { stroke: var(--orange); }

/* ---------- 底部弹层 ---------- */
.sheet-mask {
  position: fixed; inset: 0; background: rgba(30, 20, 10, .38); z-index: 50;
  display: grid; place-items: end center; opacity: 0; pointer-events: none; transition: opacity .22s ease;
}
.sheet-mask.on { opacity: 1; pointer-events: auto; }
.sheet {
  width: 100%; max-width: 560px; max-height: 88dvh; overflow-y: auto;
  background: #fff; border-radius: 24px 24px 0 0;
  padding: 20px 18px calc(22px + env(safe-area-inset-bottom));
  transform: translateY(24px); transition: transform .26s cubic-bezier(.3, .9, .3, 1);
}
.sheet-mask.on .sheet { transform: none; }
.sheet h3 { margin: 0 0 4px; font-size: 17px; }
.sheet .sheet-sub { margin: 0 0 16px; font-size: 12.5px; color: var(--muted); line-height: 1.6; }
.fld { margin-bottom: 14px; }
.fld > label { display: block; font-size: 12.5px; color: var(--muted); font-weight: 600; margin-bottom: 7px; }
.inp {
  width: 100%; padding: 13px 14px; border-radius: 13px; border: 1.5px solid var(--line);
  background: #fffdfa; outline: none; font-size: 16px; color: var(--ink);
}
.inp:focus { border-color: var(--amber); background: #fff; }
.inp.code { letter-spacing: 6px; text-align: center; font-weight: 800; text-transform: uppercase; font-size: 20px; }
textarea.inp { min-height: 92px; resize: none; line-height: 1.55; font-size: 15px; }

.day-row { display: flex; gap: 7px; }
.day-row button {
  flex: 1; padding: 11px 0; border-radius: 12px; background: #f7f1e8; color: var(--muted);
  font-size: 13.5px; font-weight: 700; border: 1.5px solid transparent;
}
.day-row button.on { background: var(--orange-soft); color: var(--orange); border-color: #ffd9b0; }

.tpl-row { display: flex; flex-wrap: wrap; gap: 8px; }
.tpl {
  padding: 8px 12px; border-radius: 999px; background: #f7f1e8; color: #6b5c48;
  font-size: 12.5px; font-weight: 600;
}
.tpl:active { background: var(--orange-soft); color: var(--orange); }

.sheet-actions { display: flex; gap: 10px; margin-top: 18px; }
.sheet-actions .btn { flex: 1; height: 48px; border-radius: 14px; font-size: 15px; font-weight: 700; }

.sync-note { font-size: 12px; color: var(--muted); margin-top: 10px; line-height: 1.6; }
.sync-note b { color: var(--green); }
.sync-note.bad b { color: var(--red); }
