/* Menu chrome, sheets, toast. */

.chrome {
  position: fixed;
  left: 0; right: 0;
  z-index: 20;
  background: var(--panel);
  color: var(--ink);
}
.chrome-top {
  top: 0;
  display: flex;
  align-items: center;
  gap: 2px;
  min-height: calc(var(--bar) + var(--safe-top));
  padding: var(--safe-top) calc(4px + var(--safe-right)) 0 calc(4px + var(--safe-left));
  border-bottom: 1px solid var(--rule);
}
.chrome-title {
  flex: 1;
  min-width: 0;
  padding: 0 6px;
  font-family: var(--font-ui-zh);
  font-size: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chrome-aa { font-size: 17px; font-weight: 600; letter-spacing: -0.02em; }

.chrome-bottom {
  bottom: 0;
  padding-bottom: var(--safe-bottom);
  border-top: 1px solid var(--rule);
}
.chrome-progress { height: 2px; background: var(--wash); }
.chrome-progress-fill { height: 100%; background: var(--seal); }
.chrome-status {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 9px calc(16px + var(--safe-right)) 10px calc(16px + var(--safe-left));
  font-size: 13px;
  color: var(--ink-2);
}
.chrome-chapter { font-family: var(--font-ui-zh); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chrome-percent { font-variant-numeric: tabular-nums; flex: none; }

/* ---- sheets ---- */

.sheet-layer { position: fixed; inset: 0; z-index: 40; }
.sheet-scrim { position: absolute; inset: 0; background: var(--scrim); }
.sheet {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  max-height: min(86vh, 86dvh);
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-top: 1px solid var(--ink);
  padding-bottom: var(--safe-bottom);
  outline: none;
  animation: sheet-up 140ms ease-out;
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px calc(4px + var(--safe-right)) 4px calc(16px + var(--safe-left));
  border-bottom: 1px solid var(--rule);
  flex: none;
}
.sheet-title { margin: 0; font-size: 16px; font-weight: 600; }
.sheet-body { overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 0 calc(16px + var(--safe-right)) 16px calc(16px + var(--safe-left)); }
html.sheet-open { overflow: hidden; }

@keyframes sheet-up { from { transform: translateY(24px); opacity: 0; } }
@keyframes sheet-in { from { transform: translateX(24px); opacity: 0; } }

@media (min-width: 720px) {
  .sheet {
    left: auto; top: 0;
    width: 400px;
    max-height: none;
    border-top: 0;
    border-left: 1px solid var(--ink);
    padding-top: var(--safe-top);
    animation-name: sheet-in;
  }
}

/* ---- contents ---- */

.contents { list-style: none; margin: 0; padding: 6px 0; }
.contents-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 11px 0;
  border-bottom: 1px solid var(--rule);
  font-family: var(--font-ui-zh);
  font-size: 18px;
  line-height: 1.3;
}
.contents-item[data-level="1"] { font-weight: 600; }
.contents-item[data-level="3"] { padding-left: 1.2em; font-size: 16px; color: var(--ink-2); }
.contents-item[data-level="4"], .contents-item[data-level="5"], .contents-item[data-level="6"] { padding-left: 2.4em; font-size: 15px; color: var(--ink-2); }
.contents-item[aria-current="true"] { color: var(--seal); }
.contents-item:active { background: var(--wash); }

/* ---- toast ---- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + var(--safe-bottom));
  transform: translateX(-50%);
  z-index: 60;
  width: max-content;
  max-width: min(420px, calc(100vw - 32px));
  padding: 11px 16px;
  background: var(--ink);
  color: var(--paper);
  font-size: 14px;
  line-height: 1.35;
  text-align: center;
}
