:root {
  color-scheme: light;
  --ink: #15151b;
  --muted: #6d6d78;
  --line: #e6e5eb;
  --paper: #fff;
  --soft: #f5f4fa;
  --purple: #6747ef;
  --teal: #087e78;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: #fff; }
button, a { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }

.entry-shell {
  width: min(100%, 720px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 20px max(40px, env(safe-area-inset-bottom));
}

.entry-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  padding: 10px 0 22px;
  border-bottom: 2px solid var(--ink);
}
.entry-head span, .entry-section header span { color: var(--purple); font-size: 12px; font-weight: 900; }
.entry-head h1 { margin: 6px 0 4px; font-size: 38px; line-height: 1.08; letter-spacing: 0; }
.entry-head p { margin: 0; color: var(--muted); line-height: 1.55; }
.entry-head > a {
  display: grid; place-items: center; flex: 0 0 46px; height: 46px;
  border: 1px solid var(--line); border-radius: 50%; color: var(--ink); text-decoration: none; font-size: 25px;
}

.identity-strip {
  display: flex; align-items: center; gap: 12px; margin: 18px 0 4px; padding: 12px 0;
}
.identity-strip img { width: 44px; height: 44px; object-fit: cover; border-radius: 50%; }
.identity-strip div { display: grid; gap: 3px; flex: 1; min-width: 0; }
.identity-strip strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.identity-strip span { color: var(--teal); font-size: 12px; font-weight: 800; }
.identity-strip button { width: 42px; height: 42px; border: 0; border-radius: 50%; background: var(--soft); font-size: 23px; }
.identity-strip button:disabled { cursor: wait; opacity: .65; }
.identity-strip button.is-loading { animation: spin .8s linear infinite; }

.entry-loading, .entry-message { min-height: 55vh; display: grid; place-items: center; align-content: center; text-align: center; gap: 10px; }
.entry-loading i { width: 36px; height: 36px; border: 3px solid #ded9fb; border-top-color: var(--purple); border-radius: 50%; animation: spin .8s linear infinite; }
.entry-loading span, .entry-message p { color: var(--muted); }
.entry-message h2, .entry-message p { margin: 0; }
@keyframes spin { to { transform: rotate(360deg); } }

.entry-section { padding-top: 28px; }
.entry-section > header { display: flex; align-items: end; justify-content: space-between; margin-bottom: 12px; }
.entry-section h2 { margin: 4px 0 0; font-size: 21px; }
.entry-section header b { color: var(--purple); font-size: 28px; }
.entry-list { display: grid; gap: 10px; }

.entry-item { border: 1px solid var(--line); border-radius: 8px; padding: 16px; background: var(--paper); }
.entry-item-head { display: flex; gap: 12px; align-items: flex-start; }
.entry-mark { display: grid; place-items: center; width: 42px; height: 42px; flex: 0 0 42px; border-radius: 6px; background: var(--ink); color: #fff; font-weight: 900; }
.entry-item-head div { min-width: 0; flex: 1; }
.entry-item h3 { margin: 0; font-size: 17px; overflow-wrap: anywhere; }
.entry-item p { margin: 5px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.progress-line { height: 6px; margin-top: 14px; overflow: hidden; background: #eceaf4; border-radius: 4px; }
.progress-line i { display: block; height: 100%; background: var(--teal); }
.entry-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.entry-actions a, .primary-action, .save-guide button {
  min-height: 44px; display: grid; place-items: center; border: 0; border-radius: 6px;
  padding: 0 12px; text-align: center; text-decoration: none; font-weight: 900;
}
.entry-actions a:first-child, .primary-action, .save-guide button { background: var(--purple); color: #fff; }
.entry-actions a:last-child { background: var(--soft); color: var(--ink); }
.entry-actions.single { grid-template-columns: 1fr; }
.entry-actions a.is-expired { background: #efeff2; color: #777; }

.empty-entry { padding: 20px 0; color: var(--muted); line-height: 1.6; }
.empty-entry a { color: var(--purple); font-weight: 800; }
.save-guide { margin-top: 30px; padding: 20px 0; border-top: 2px solid var(--ink); }
.save-guide p { color: var(--muted); line-height: 1.6; }
.save-guide button { width: 100%; background: var(--ink); }
.entry-toast { position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translate(-50%, 12px); opacity: 0; pointer-events: none; padding: 10px 16px; border-radius: 6px; background: #15151b; color: #fff; transition: .2s; }
.entry-toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 430px) {
  .entry-shell { padding-left: 16px; padding-right: 16px; }
  .entry-head h1 { font-size: 30px; }
  .entry-actions { grid-template-columns: 1fr; }
}
