#sheet-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 30px; /* KaiOS: above softkey bar */
  background: rgba(0, 0, 0, 0.4);
  z-index: 14;
}

#sheet-overlay[active="true"] {
  display: block;
}

#sheet {
  display: none;
  position: fixed;
  bottom: 30px; /* KaiOS: above softkey bar */
  left: 0;
  right: 0;
  background: #fff;
  border-top: 2px solid #6a0080;
  z-index: 15;
}

#sheet[active="true"] {
  display: block;
}

#sheet-header {
  display: none;
  padding: 10px 12px 8px;
  border-bottom: 1px solid #eee;
}

#sheet-header[active="true"] {
  display: block;
}

@media (min-width: 241px) {
  #sheet-header {
    padding: 14px 16px 10px;
  }
}

#sheet-title {
  font-size: 15px;
  font-weight: 600;
  color: #111;
  margin-bottom: 6px;
  line-height: 1.4;
}

#sheet-note {
  font-size: 12px;
  color: #666;
  line-height: 1.5;
}

#sheet-ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* At 241px+ the softkey bar is gone — sheet becomes a centered modal */
@media (min-width: 241px) {
  #sheet-overlay {
    bottom: 0;
  }

  #sheet {
    bottom: auto;
    top: 50%;
    left: 50%;
    right: auto;
    width: 90%;
    max-width: 400px;
    transform: translate(-50%, -50%);
    border-top: none;
    border: 2px solid #6a0080;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  }

  body.dark #sheet {
    border-color: #9b27af;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  }
}

/* Dark mode */
body.dark #sheet {
  background: #1c1c1e;
  border-top-color: #9b27af;
}

body.dark #sheet-header {
  border-bottom-color: #2e2e30;
}

body.dark #sheet-title {
  color: #e5e7eb;
}

body.dark #sheet-note {
  color: #8b8b93;
}
