body.bit-app .shell-header,
body.bit-app .shell-sidebar,
body.bit-app .shell-footer,
body.bit-app .shell-skip {
  display: none !important;
}

body.bit-app .shell-body {
  padding-top: 0;
  min-height: 100dvh;
}

.shell-main.bit-page {
  margin: 0;
  padding: 0;
  border: none;
  box-shadow: none;
  border-radius: 0;
  background: #f2f3f5;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

body[data-shell-active] .shell-main.bit-page {
  padding: 0;
}

.shell-main.bit-page .tool-page-header,
.shell-main.bit-page .tool-lead {
  display: none;
}

.bit-explorer {
  width: 100%;
  max-width: 430px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: 10px 10px calc(14px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-sizing: border-box;
}

.appbar {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.back,
.help-btn {
  flex: 0 0 44px;
  display: grid;
  place-items: center;
  background: #e4e6ea;
  color: #1c2330;
  border: 0;
  border-radius: 12px;
  font: inherit;
  font-size: 1.6rem;
  line-height: 1;
  text-decoration: none;
  font-weight: 500;
  cursor: pointer;
}

.help-btn {
  font-size: 1.15rem;
  font-weight: 800;
}

.modebar {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: #e4e6ea;
  border-radius: 12px;
  padding: 3px;
}

.modebar button {
  font: inherit;
  font-weight: 700;
  border: 0;
  background: transparent;
  color: #5a5a5a;
  border-radius: 10px;
  padding: 0.7rem 0;
  cursor: pointer;
}

.modebar button.active {
  background: #fff;
  color: #1c2330;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.bit-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bit-row-cap {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0 2px;
  font-size: 0.72rem;
  font-weight: 650;
  color: #6b7280;
}

.bit-row-hex {
  font-family: var(--shell-mono);
  color: #1c2330;
  border: 0;
  background: transparent;
  padding: 0;
  font-size: inherit;
  font-weight: 700;
  cursor: pointer;
}

.bit-row-bits {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 5px;
  width: 100%;
}

.bit {
  aspect-ratio: 1;
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  background: #d5d8de;
  color: #4b5563;
  cursor: pointer;
  padding: 0;
  font: inherit;
  font-size: clamp(0.7rem, 3.4vw, 0.95rem);
  font-weight: 700;
}

.bit.on {
  background: #009a46;
  color: #fff;
}

.bit:focus-visible {
  outline: 2px solid var(--shell-accent);
  outline-offset: 2px;
}

.slots {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 2px;
}

.slot {
  display: grid;
  grid-template-columns: 6.4rem minmax(0, 1fr);
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.slot.active {
  box-shadow: 0 0 0 2px #306b97;
}

.slot-kind {
  border: 0;
  background: #eef1f4;
  color: #306b97;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  cursor: pointer;
  padding: 0 0.35rem 0 0.55rem;
}

.slot-kind::after {
  content: "▾";
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  opacity: 0.7;
  letter-spacing: 0;
}

.slot-kind:hover,
.slot.active .slot-kind {
  background: #dce8f2;
}

.slot-value {
  width: 100%;
  border: 0;
  background: transparent;
  font-family: var(--shell-mono);
  font-size: 1.05rem;
  font-weight: 650;
  color: #1c2330;
  padding: 0.85rem 0.75rem;
  min-width: 0;
}

.slot-value:focus {
  outline: none;
  background: #f7fbff;
}

.parse-error {
  margin: 0;
  color: #9b2c2c;
  font-size: 0.82rem;
  padding: 0 2px;
}

.actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: auto;
}

.actions button {
  font: inherit;
  font-weight: 700;
  font-size: 0.82rem;
  border: 0;
  border-radius: 12px;
  background: #fff;
  color: #1c2330;
  padding: 0.85rem 0.2rem;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.sheet {
  position: fixed;
  inset: 0;
  z-index: 50;
}

.sheet.hidden,
.sheet[hidden] {
  display: none;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(20, 24, 28, 0.45);
  cursor: pointer;
}

.sheet-card {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: #fff;
  border-radius: 18px 18px 0 0;
  padding: 8px 12px calc(16px + env(safe-area-inset-bottom));
  max-width: 430px;
  margin: 0 auto;
}

.sheet-handle {
  width: 36px;
  height: 4px;
  border-radius: 99px;
  background: #d5d8de;
  margin: 6px auto 12px;
}

.sheet-card h2 {
  margin: 0 8px 6px;
  font-size: 0.95rem;
}

.sheet-lead {
  margin: 0 8px 10px;
  color: #5b6472;
  font-size: 0.82rem;
  line-height: 1.35;
}

.sheet-list {
  display: flex;
  flex-direction: column;
  max-height: min(62dvh, 28rem);
  overflow: auto;
}

.sheet-list button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  border: 0;
  background: transparent;
  font: inherit;
  font-weight: 650;
  text-align: left;
  padding: 0.75rem 0.7rem;
  border-radius: 10px;
  cursor: pointer;
}

.sheet-list button.opt {
  align-items: flex-start;
}

.sheet-list button:hover,
.sheet-list button[aria-checked="true"] {
  background: #eef6ea;
}

.sheet-list button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.opt-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
}

.opt-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.opt-name {
  font-weight: 750;
}

.opt-hint {
  color: #5b6472;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.3;
}

.sheet-list .used {
  color: #6b7280;
  font-size: 0.75rem;
  font-weight: 600;
  flex: 0 0 auto;
}

.help-item {
  padding: 0.7rem 0.7rem;
  border-bottom: 1px solid #eef0f3;
}

.help-item:last-child {
  border-bottom: 0;
}

.help-item strong {
  display: block;
  font-size: 0.88rem;
}

.help-item p {
  margin: 0.2rem 0 0;
  color: #5b6472;
  font-size: 0.78rem;
  line-height: 1.35;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 60;
  background: #292929;
  color: #fff;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  font-size: 0.85rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.toast.show {
  opacity: 1;
}

@media (min-width: 721px) {
  .bit {
    font-size: 0.95rem;
  }
}
