html:has(.bwe-shell),
body:has(.bwe-shell) {
  margin: 0;
  background: #0d0a09;
}

body:has(.bwe-shell) > .noise-layer,
body:has(.bwe-shell) > .bg-image-layer {
  display: none;
}

.bwe-shell {
  --bw-surface-deep: #0d0a09;
  --bw-surface-reading: rgba(13, 10, 9, 0.92);
  --bw-surface-reading-soft: rgba(20, 15, 13, 0.78);
  --bw-text-primary: #eee7db;
  --bw-text-secondary: #b9ad9e;
  --bw-accent-brass: #ad8a58;
  --bw-rule-subtle: rgba(213, 194, 165, 0.2);
  --bw-document-surface: #d9c9ad;
  --bw-document-ink: #31251b;
  --bw-selected-surface: rgba(173, 138, 88, 0.13);
  --bw-reading-width: 800px;
  position: relative;
  z-index: 4;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100svh;
  height: 100dvh;
  height: var(--bwe-visual-viewport-height, 100dvh);
  min-height: 0;
  margin: 0;
  overflow: hidden;
  color: var(--bw-text-primary);
  background: var(--bw-surface-deep);
}

.bwe-header,
.bwe-overlay-header,
.bwe-tabs {
  flex: 0 0 auto;
}

.bwe-header,
.bwe-overlay-header {
  display: flex;
  min-height: 50px;
  align-items: center;
  gap: 12px;
  padding: max(10px, env(safe-area-inset-top)) clamp(14px, 3vw, 24px) 9px;
  border-bottom: 1px solid rgba(222, 202, 164, 0.24);
  background: rgba(13, 10, 12, 0.98);
  font-family: ui-serif, Georgia, serif;
  letter-spacing: 0.035em;
}

.bwe-header {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  z-index: 12;
  border-bottom-color: rgba(222, 202, 164, 0.18);
  background: linear-gradient(180deg, rgba(9, 7, 8, 0.9), rgba(9, 7, 8, 0.36) 72%, transparent);
}

.bwe-overlay-header h1 {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  font-size: 1rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bwe-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  background: #100d0f;
}

.bwe-interaction-deck {
  display: contents;
}

.bwe-scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #171214;
}

.bwe-scene img,
.bwe-neutral-visual {
  display: block;
  width: 100%;
  height: 100%;
}

.bwe-character-plate {
  position: absolute;
  bottom: 208px;
  left: max(28px, env(safe-area-inset-left));
  z-index: 11;
  display: flex;
  max-width: min(360px, calc(100vw - 56px));
  align-items: center;
  gap: 12px;
  padding: 10px 16px 9px;
  border-left: 2px solid rgba(205, 166, 101, 0.75);
  background: linear-gradient(90deg, rgba(18, 13, 14, 0.94), rgba(18, 13, 14, 0.68));
  color: #eee4d3;
}

.bwe-character-plate-copy {
  display: grid;
  gap: 2px;
}

.bwe-character-plate-copy strong {
  font-family: ui-serif, Georgia, serif;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.025em;
}

.bwe-character-plate-copy span {
  color: #cdbd9f;
  font-size: 0.78rem;
}

.bwe-character-plate img {
  order: -1;
  width: 42px;
  height: 42px;
  object-fit: cover;
}

.bwe-scene img {
  object-fit: cover;
  object-position: center;
}

.bwe-neutral-visual {
  background:
    linear-gradient(115deg, rgba(203, 171, 119, 0.12), transparent 45%),
    radial-gradient(circle at 62% 34%, rgba(142, 112, 75, 0.18), transparent 30%),
    linear-gradient(180deg, #21191a, #100d0f);
}

.bwe-content-panel {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 10;
  display: flex;
  width: 100%;
  height: clamp(184px, 24dvh, 232px);
  min-height: 184px;
  max-height: 232px;
  flex-direction: column;
  overflow: hidden;
  border-top: 1px solid rgba(222, 202, 164, 0.3);
  border-top-color: var(--bw-rule-subtle);
  background: linear-gradient(180deg, rgba(13, 10, 9, 0), var(--bw-surface-reading-soft) 24%, var(--bw-surface-reading) 62%);
  box-shadow: none;
  backdrop-filter: blur(4px);
}

.bwe-panel-body {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
}

.bwe-copy,
.bwe-panel-scroll {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px clamp(18px, 4vw, 34px) 10px;
}

.bwe-copy {
  font-family: ui-serif, Georgia, serif;
  font-size: clamp(0.96rem, 2vw, 1.08rem);
  line-height: 1.58;
}

.bwe-copy p {
  margin: 0 0 0.72em;
}

.bwe-copy p:last-child {
  margin-bottom: 0;
}

.is-narrative .bwe-content-panel,
.is-action-result .bwe-content-panel,
.is-arrival .bwe-content-panel,
.is-observation .bwe-content-panel {
  height: 192px;
  min-height: 192px;
  max-height: 192px;
}

.is-letter .bwe-content-panel {
  height: clamp(250px, 32dvh, 300px);
  min-height: 250px;
  max-height: 300px;
  background:
    linear-gradient(180deg, rgba(13, 10, 9, 0.08), rgba(20, 15, 13, 0.72) 18%, rgba(13, 10, 9, 0.94) 70%);
}

.is-letter .bwe-neutral-visual {
  background:
    radial-gradient(circle at 62% 34%, rgba(188, 145, 90, 0.3), transparent 34%),
    linear-gradient(115deg, rgba(203, 171, 119, 0.2), transparent 48%),
    linear-gradient(180deg, #2a2020, #171112);
}

.bwe-narrative-body {
  justify-content: flex-start;
}

.bwe-narrative-content {
  display: grid;
  flex: 1 1 auto;
  width: min(var(--bw-reading-width), calc(100% - 64px));
  height: 100%;
  min-height: 0;
  margin: 0 auto;
  grid-template-rows: minmax(0, 1fr) auto;
  align-content: start;
  gap: 6px;
  padding: 18px 0 max(12px, env(safe-area-inset-bottom));
}

.bwe-narrative-copy {
  width: 100%;
  padding: 0;
  font-size: clamp(1.125rem, 1.5vw, 1.25rem);
  line-height: 1.7;
  letter-spacing: 0.005em;
  text-align: left;
}

.bwe-typewriter-blocks {
  display: grid;
  align-content: start;
  gap: 14px;
}

.bwe-typewriter-blocks .bwe-typewriter-visual {
  min-height: 0;
  margin: 0;
}

.bwe-semantic-block {
  display: grid;
  gap: 6px;
}

.bwe-semantic-block[hidden],
.bwe-speaker-label[hidden] {
  display: none;
}

.bwe-semantic-block .bwe-speaker-label {
  margin-bottom: 0;
}

.bwe-presentation-copy {
  min-height: 0;
  overflow: hidden;
}

.bwe-speaker-label {
  width: fit-content;
  margin: 0 0 9px;
  padding-left: 13px;
  border-left: 2px solid var(--bw-accent-brass);
  color: var(--bw-accent-brass);
  font-size: 0.875rem;
  font-weight: 650;
  letter-spacing: 0.025em;
}

.bwe-type-cue {
  display: inline-block;
  color: var(--bw-accent-brass);
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.1em;
}

.bwe-presentation-thought .bwe-presentation-copy {
  padding-left: 18px;
  border-left: 1px solid rgba(173, 138, 88, 0.58);
}

.bwe-presentation-thought .bwe-narrative-copy {
  margin-top: 7px;
  color: #e0d8cc;
}

.bwe-inline-next {
  display: flex;
  justify-content: flex-end;
  flex: 0 0 auto;
}

.bwe-shell .bwe-next-control {
  width: 104px;
  min-width: 84px;
  min-height: 44px;
  border-color: rgba(205, 166, 101, 0.55);
  border-radius: 4px;
  background: rgba(91, 66, 46, 0.18);
  color: #e8dcc8;
}

.bwe-letter-layout {
  display: grid;
  width: min(var(--bw-reading-width), calc(100% - 64px));
  min-height: 0;
  margin: 0 auto;
  align-content: center;
  padding: 14px 0 max(12px, env(safe-area-inset-bottom));
}

.bwe-document {
  padding: 18px 22px 15px;
  border-radius: 1px;
  color: var(--bw-document-ink);
  background-color: var(--bw-document-surface);
  background-image:
    linear-gradient(rgba(74, 51, 31, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(74, 51, 31, 0.012) 1px, transparent 1px);
  background-size: 9px 9px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.25);
}

.bwe-document-header,
.bwe-evidence-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid currentColor;
}

.bwe-document-header h1,
.bwe-evidence-header h1 {
  margin: 3px 0 0;
  font-size: 1rem;
  line-height: 1.35;
}

.bwe-document-header > p {
  margin: 0;
  opacity: 0.67;
  font-size: 0.75rem;
  white-space: nowrap;
}

.bwe-document .bwe-type-cue { color: #75562f; }

.bwe-document-body {
  display: block;
  min-height: 60px;
  margin: 0;
  padding: 14px 2px 4px;
  overflow: auto;
  font-size: clamp(1rem, 1.35vw, 1.125rem);
  line-height: 1.72;
}

.bwe-document-body p {
  margin: 0;
}

.bwe-document-body p + p {
  margin-top: 14px;
}

.bwe-document-signature {
  min-height: 29px;
  margin-top: 8px;
  padding-top: 9px;
  text-align: right;
  border-top: 1px solid rgba(63, 44, 28, 0.26);
  color: #654b31;
  font-size: 0.75rem;
}

.bwe-reading-controls {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.bwe-letter-object-stage {
  box-sizing: border-box;
  display: grid;
  width: 100%;
  height: var(--bwe-visual-viewport-height, 100dvh);
  min-height: 0;
  place-items: center;
  overflow: hidden;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right))
    max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  background:
    radial-gradient(circle at 50% 38%, rgba(136, 94, 57, 0.2), transparent 48%),
    linear-gradient(160deg, #1b1412, #0d0909 72%);
}

.bwe-letter-object {
  box-sizing: border-box;
  display: grid;
  width: min(88vw, 1040px);
  max-height: 76dvh;
  min-height: 0;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 12px;
}

.bwe-letter-object .bwe-document {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: min(68dvh, 650px);
  padding: clamp(28px, 4vw, 54px) clamp(30px, 6vw, 76px) clamp(24px, 3vw, 44px);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.52), 0 2px 0 rgba(255, 244, 220, 0.16) inset;
}

.bwe-letter-object .bwe-document-body {
  flex: 1 1 auto;
  min-height: 0;
  padding-top: clamp(22px, 4vh, 42px);
  font-size: clamp(1.05rem, 1.7vw, 1.35rem);
  line-height: 1.85;
}

.bwe-letter-object .bwe-reading-controls {
  min-height: 44px;
  margin: 0;
}

.bwe-time-location-card {
  box-sizing: border-box;
  display: grid;
  width: 100%;
  height: 100%;
  min-height: 0;
  place-items: center;
  grid-template-rows: minmax(0, 1fr) auto;
  padding: max(64px, env(safe-area-inset-top)) clamp(20px, 6vw, 80px)
    max(18px, env(safe-area-inset-bottom));
  background: rgba(10, 8, 9, 0.78);
  backdrop-filter: blur(5px);
}

.is-time-location-card .bwe-content-panel {
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: none;
  border: 0;
  background: transparent;
  backdrop-filter: none;
}

.is-time-location-card .bwe-header {
  display: none;
}

.bwe-time-location-copy {
  display: grid;
  gap: 12px;
  align-items: center;
  text-align: center;
  font-family: ui-serif, Georgia, serif;
}

.bwe-time-location-copy .bwe-typewriter-visual {
  min-height: 0;
  white-space: pre-line;
  color: #eee7db;
  font-size: clamp(1.16rem, 3vw, 1.8rem);
  line-height: 1.75;
  letter-spacing: 0.045em;
}

.bwe-time-location-line:first-child {
  color: #eee7db;
  font-size: clamp(1.25rem, 3.2vw, 2rem);
  letter-spacing: 0.05em;
}

.bwe-time-location-line + .bwe-time-location-line {
  color: #b9ad9e;
  font-size: clamp(0.92rem, 2vw, 1.14rem);
  letter-spacing: 0.04em;
}

.bwe-typewriter-input {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  align-items: flex-start;
  overflow-y: auto;
  cursor: pointer;
  outline: none;
  overscroll-behavior: contain;
}

.bwe-typewriter-input:focus-visible {
  box-shadow: inset 0 0 0 2px rgba(226, 200, 146, 0.58);
}

.bwe-typewriter-visual {
  width: 100%;
  min-height: calc(1.7em * 2);
  margin: 0;
}

.bwe-typewriter-visual:not(.typing-done)::after {
  content: "";
  display: inline-block;
  width: 0.08em;
  height: 1em;
  margin-left: 0.12em;
  vertical-align: -0.08em;
  background: currentColor;
  animation: bwe-typewriter-cursor 0.72s steps(1, end) infinite;
}

.bwe-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

@keyframes bwe-typewriter-cursor {
  0%, 48% { opacity: 1; }
  49%, 100% { opacity: 0; }
}

.bwe-panel-actions,
.bwe-recorded-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  flex: 0 0 auto;
  padding: 10px 16px max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid rgba(222, 202, 164, 0.18);
  background: rgba(11, 9, 10, 0.99);
}

.bwe-hub-actions {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.bwe-hub-actions-two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.bwe-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 8px clamp(12px, 3vw, 20px);
  border-top: 1px solid rgba(222, 202, 164, 0.18);
  background: rgba(11, 9, 10, 0.99);
}

.bwe-tool-rail {
  position: fixed;
  top: 50dvh;
  left: max(18px, env(safe-area-inset-left));
  z-index: 15;
  display: grid;
  gap: 8px;
  transform: translateY(-50%);
}

.bwe-tool-rail button {
  min-width: 78px;
  min-height: 48px;
  padding-inline: 12px;
  border-radius: 999px;
  background: rgba(25, 18, 18, 0.82);
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}

.bwe-tool-icon {
  display: none;
}

.bwe-tool-label {
  white-space: nowrap;
}

.bwe-shell button {
  min-height: 44px;
  border: 1px solid rgba(224, 203, 164, 0.46);
  border-radius: 10px;
  padding: 9px 13px;
  color: inherit;
  background: rgba(91, 66, 46, 0.52);
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

.bwe-shell .bwe-tool-rail button {
  min-height: 48px;
  border-width: 0 0 1px 1px;
  border-color: var(--bw-rule-subtle);
  border-radius: 2px;
  background: rgba(13, 10, 9, 0.34);
  box-shadow: none;
  backdrop-filter: blur(6px);
}

.bwe-shell .bwe-tool-rail button:hover,
.bwe-shell .bwe-tool-rail button:focus-visible {
  border-left-color: var(--bw-accent-brass);
  border-bottom-color: rgba(173, 138, 88, 0.62);
  color: var(--bw-text-primary);
  background: var(--bw-selected-surface);
}

.bwe-shell .bwe-tool-rail button:active {
  border-left-color: var(--bw-accent-brass);
  color: var(--bw-accent-brass);
  background: rgba(173, 138, 88, 0.18);
}

.bwe-hub-actions button {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 14px;
  align-items: center;
  gap: 7px;
  border-width: 0 0 1px;
  border-radius: 0;
  background: transparent;
  text-align: left;
}

.bwe-hub-actions button > span,
.bwe-hub-actions button > i {
  color: var(--bw-accent-brass);
  font-size: 0.68rem;
  font-style: normal;
}

.bwe-hub-actions button > i {
  font-size: 1.15rem;
}

.bwe-hub-actions button > strong {
  font-size: 0.86rem;
  font-weight: 550;
}

.is-time-fracture-hub .bwe-hub-actions button {
  grid-template-columns: minmax(0, 1fr);
}

.bwe-evidence-presentation {
  margin: 14px clamp(18px, 4vw, 34px) 6px;
  padding-left: 18px;
  border-left: 2px solid var(--bw-accent-brass);
}

.bwe-evidence-header {
  display: grid;
  justify-content: start;
  gap: 2px;
  color: var(--bw-text-primary);
  border-color: var(--bw-rule-subtle);
}

.bwe-evidence-presentation blockquote {
  margin: 0;
  padding: 15px 0 4px;
  color: #f1e7d8;
  font-size: clamp(1.18rem, 1.8vw, 1.44rem);
  line-height: 1.55;
}

.bwe-shell button:hover,
.bwe-shell button:focus-visible {
  border-color: #e2c892;
  outline: 2px solid rgba(226, 200, 146, 0.45);
  outline-offset: 2px;
}

.bwe-shell button:disabled,
.bwe-shell button[aria-disabled="true"] {
  cursor: default;
  opacity: 0.44;
}

.bwe-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.bwe-list,
.bwe-notebook {
  padding: 14px clamp(14px, 4vw, 34px);
}

.bwe-panel-heading {
  display: flex;
  flex: 0 0 auto;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 16px;
  border-bottom: 1px solid rgba(222, 202, 164, 0.18);
}

.bwe-panel-heading h1 {
  margin: 0;
  font-size: 1rem;
}

.bwe-list {
  display: grid;
  align-content: start;
  gap: 10px;
}

.bwe-list button {
  width: 100%;
  text-align: left;
}

.bwe-time-fracture-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.bwe-time-fracture-row > strong {
  min-width: 0;
  font-weight: 550;
}

.bwe-time-fracture-row > span {
  color: var(--bw-accent-brass);
  font-size: 0.75rem;
  white-space: nowrap;
}

.bwe-decision-list {
  display: grid;
  align-content: start;
  border-top: 1px solid rgba(222, 202, 164, 0.18);
}

.bwe-shell .bwe-decision-row {
  display: grid;
  width: 100%;
  min-height: 58px;
  grid-template-columns: 34px minmax(0, 1fr) 22px;
  align-items: center;
  gap: 12px;
  padding: 9px 8px;
  border: 0;
  border-bottom: 1px solid rgba(222, 202, 164, 0.18);
  border-radius: 0;
  background: transparent;
  text-align: left;
  box-shadow: none;
}

.bwe-shell .bwe-decision-row:hover,
.bwe-shell .bwe-decision-row:focus-visible {
  border-bottom-color: rgba(226, 200, 146, 0.55);
  background: rgba(226, 200, 146, 0.055);
  outline: 0;
  box-shadow: inset 0 0 0 1px rgba(226, 200, 146, 0.44);
}

.bwe-shell .bwe-decision-row[aria-checked="true"] {
  border-bottom-color: rgba(222, 202, 164, 0.18);
  outline: 0;
  box-shadow: inset 3px 0 0 rgba(205, 166, 101, 0.82), inset 0 0 0 1px rgba(205, 166, 101, 0.5);
  background: linear-gradient(90deg, rgba(130, 92, 54, 0.2), transparent 70%);
}

.bwe-decision-index,
.bwe-decision-marker {
  color: #bca57d;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
}

.bwe-decision-marker {
  text-align: center;
}

.bwe-decision-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.bwe-decision-copy strong {
  color: #f2eadb;
  font-family: ui-serif, Georgia, serif;
  font-size: 0.96rem;
  font-weight: 600;
  line-height: 1.35;
}

.bwe-decision-copy > span,
.bwe-warning {
  color: #d7c9b2;
  font-size: 0.88rem;
  line-height: 1.48;
}

.bwe-warning {
  margin: 0 0 12px;
}

.bwe-decision-heading {
  min-height: 34px;
  justify-content: flex-start;
  padding-block: 3px;
}

.bwe-decision-heading .bwe-warning {
  margin: 0;
  margin-left: auto;
  text-align: right;
}

.bwe-decision-heading [data-bwe="close-decision"] {
  min-height: 28px;
  padding-block: 2px;
}

.is-mandatory-decision .bwe-panel-scroll,
.is-optional-decision .bwe-panel-scroll {
  padding: 0 18px;
}

.is-mandatory-decision .bwe-content-panel,
.is-optional-decision .bwe-content-panel {
  height: min(430px, 56dvh);
  min-height: 330px;
  max-height: 430px;
}

.bwe-decision-confirm-row {
  display: flex;
  justify-content: flex-end;
  flex: 0 0 auto;
  padding: 8px 18px max(10px, env(safe-area-inset-bottom));
  border-top: 1px solid rgba(222, 202, 164, 0.18);
  background: rgba(11, 9, 10, 0.99);
}

.bwe-shell .bwe-decision-confirm-row button {
  width: 116px;
  min-height: 44px;
  border-radius: 4px;
  background: rgba(91, 66, 46, 0.28);
}

.bwe-tabs {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 0;
  border-bottom: 1px solid rgba(222, 202, 164, 0.18);
}

.is-vessel-route-notebook .bwe-tabs {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.bwe-notebook-overlay {
  display: flex;
  height: 100%;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
}

.bwe-notebook-overlay .bwe-overlay-header,
.bwe-notebook-overlay .bwe-tabs {
  position: sticky;
  z-index: 4;
}

.bwe-notebook-overlay .bwe-overlay-header { top: 0; }
.bwe-notebook-overlay .bwe-tabs { top: 0; }

.bwe-notebook-list {
  display: grid;
  align-content: start;
  gap: 0;
  padding-bottom: max(24px, calc(env(safe-area-inset-bottom) + 16px));
  -webkit-overflow-scrolling: touch;
}

.bwe-shell .bwe-notebook-row {
  display: grid;
  width: min(760px, 100%);
  min-height: 62px;
  grid-template-columns: minmax(0, 1fr) auto 18px;
  align-items: center;
  gap: 10px;
  margin: 0 auto;
  border-width: 0 0 1px;
  border-radius: 0;
  background: transparent;
  text-align: left;
}

.bwe-notebook-row-copy {
  display: grid;
  gap: 4px;
}

.bwe-notebook-row-copy strong { font-size: 0.98rem; }
.bwe-notebook-row-copy span { color: var(--bw-text-secondary); font-size: 0.78rem; }
.bwe-notebook-new { color: var(--bw-accent-brass); font-size: 0.72rem; }
.bwe-notebook-chevron { color: var(--bw-accent-brass); font-size: 1.3rem; }

.bwe-notebook-detail {
  padding: 14px clamp(16px, 4vw, 34px) max(24px, calc(env(safe-area-inset-bottom) + 16px));
  -webkit-overflow-scrolling: touch;
}

.bwe-notebook-back { margin-bottom: 12px; }

.bwe-notebook-detail article {
  width: min(760px, 100%);
  margin: 0 auto;
}

.bwe-notebook-detail header span,
.bwe-notebook-detail dt {
  color: var(--bw-accent-brass);
  font-size: 0.78rem;
  font-weight: 700;
}

.bwe-notebook-detail h2 { margin: 4px 0 16px; }
.bwe-notebook-detail dt { margin-top: 14px; }
.bwe-notebook-detail dd { margin: 5px 0 0; line-height: 1.55; }
.bwe-notebook-detail p { margin: 0; }
.bwe-notebook-fact-list { margin: 0; padding-left: 1.25em; }
.bwe-notebook-fact-list li + li { margin-top: 7px; }

.bwe-recorded,
.bwe-complete {
  display: grid;
  flex: 1 1 auto;
  min-height: 0;
  place-content: center;
  gap: 12px;
  padding: 24px;
  text-align: center;
}

.bwe-recorded h1,
.bwe-recorded p,
.bwe-complete h1 {
  margin: 0;
}

.bwe-recorded-mark {
  font-size: 2rem;
  color: #e2c892;
}

.bwe-complete > div {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.bwe-notice,
.bwe-loading {
  position: absolute;
  left: 50%;
  bottom: calc(110px + env(safe-area-inset-bottom));
  z-index: 20;
  width: min(88%, 440px);
  transform: translateX(-50%);
  border-radius: 10px;
  padding: 10px 14px;
  text-align: center;
  color: #fff7e7;
  background: rgba(31, 23, 20, 0.97);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}

.bwe-map-overlay,
.bwe-map-overlay .bem-shell {
  width: 100%;
  height: 100%;
  min-height: 0;
}

.bwe-map-overlay {
  flex: 1 1 auto;
  overflow: hidden;
}

@media (max-width: 700px) {
  html:has(.bwe-shell),
  body:has(.bwe-shell) {
    width: 100%;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    background-color: #0d0a09;
    background-image:
      radial-gradient(circle at 24% 68%, rgba(104, 72, 45, 0.09), transparent 42%),
      radial-gradient(circle at 82% 88%, rgba(83, 53, 35, 0.07), transparent 36%),
      linear-gradient(180deg, #100c0b 0%, #15100d 58%, #0d0a09 100%);
    background-repeat: no-repeat;
    background-size: 100% var(--bwe-visual-viewport-height, 100dvh);
  }

  .bwe-shell {
    width: 100%;
    height: 100svh;
    height: 100dvh;
    height: var(--bwe-visual-viewport-height, 100dvh);
    min-height: 0;
    overflow: hidden;
  }

  .bwe-header,
  .bwe-overlay-header {
    position: relative;
    z-index: 12;
    min-height: 44px;
    padding-inline: 14px;
    font-size: 0.9rem;
    background: rgba(13, 10, 12, 0.98);
  }

  .bwe-stage {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    flex-direction: column;
    overflow: hidden;
  }

  .bwe-scene {
    position: relative;
    inset: auto;
    width: 100%;
    height: auto;
    min-height: 0;
    aspect-ratio: 16 / 9;
    flex: 0 0 auto;
  }

  .bwe-scene img {
    object-fit: contain;
  }

  .bwe-character-plate {
    position: relative;
    bottom: auto;
    left: auto;
    z-index: 11;
    width: 100%;
    max-width: none;
    min-height: 46px;
    padding: 7px 20px;
    border-top: 1px solid rgba(222, 202, 164, 0.16);
    border-bottom: 1px solid rgba(222, 202, 164, 0.16);
    border-left: 0;
    background: #151012;
  }

  .bwe-character-plate-copy {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: baseline;
    gap: 8px;
  }

  .bwe-character-plate img {
    display: none;
  }

  .bwe-interaction-deck {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    flex-direction: column;
    overflow: hidden;
    background: #100d0f;
  }

  .bwe-tool-rail {
    box-sizing: border-box;
    position: relative;
    top: auto;
    left: auto;
    z-index: 14;
    display: flex;
    flex: 0 0 44px;
    align-self: flex-end;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    width: auto;
    height: 44px;
    min-height: 44px;
    margin: 8px max(12px, env(safe-area-inset-right)) 9px auto;
    padding: 0;
    transform: none;
    border: 0;
    background: transparent;
  }

  .bwe-shell .bwe-tool-rail button {
    box-sizing: border-box;
    display: inline-flex;
    width: auto;
    height: 44px;
    min-width: 0;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid rgba(222, 202, 164, 0.28);
    border-radius: 3px;
    padding: 0 6px;
    background: rgba(28, 21, 18, 0.62);
    font-size: 13px;
    line-height: 1;
    box-shadow: none;
    backdrop-filter: none;
    white-space: nowrap;
  }

  .bwe-tool-rail [data-bwe-tool="notebook"] {
    width: 89px;
  }

  .bwe-tool-rail [data-bwe-tool="map"] {
    width: 63px;
  }

  .bwe-tool-icon {
    position: relative;
    display: block;
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    border: 1px solid rgba(222, 202, 164, 0.38);
    border-radius: 2px;
    background-color: rgba(173, 138, 88, 0.08);
    object-fit: contain;
  }

  .bwe-tool-icon-placeholder::before,
  .bwe-tool-icon-placeholder::after {
    content: "";
    position: absolute;
    pointer-events: none;
  }

  .bwe-tool-icon-placeholder[data-tool-icon="notebook"]::before {
    inset: 4px 3px 3px 5px;
    border: 1px solid rgba(238, 231, 219, 0.7);
    border-left-width: 2px;
  }

  .bwe-tool-icon-placeholder[data-tool-icon="notebook"]::after {
    top: 7px;
    right: 5px;
    width: 6px;
    border-top: 1px solid rgba(238, 231, 219, 0.6);
    box-shadow: 0 3px 0 rgba(238, 231, 219, 0.45);
  }

  .bwe-tool-icon-placeholder[data-tool-icon="map"]::before {
    inset: 4px 3px;
    border: 1px solid rgba(238, 231, 219, 0.68);
    transform: skewY(-12deg);
  }

  .bwe-tool-icon-placeholder[data-tool-icon="map"]::after {
    top: 4px;
    bottom: 4px;
    left: 50%;
    border-left: 1px solid rgba(238, 231, 219, 0.48);
  }

  .bwe-tool-rail [data-bwe="notebook"] {
    order: 1;
  }

  .bwe-tool-rail [data-bwe="map"] {
    order: 2;
  }

  .bwe-content-panel,
  .is-observation .bwe-content-panel {
    position: relative;
    right: auto;
    bottom: auto;
    left: auto;
    width: 100%;
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
    max-height: none;
    background:
      radial-gradient(circle at 74% 12%, rgba(100, 68, 43, 0.08), transparent 42%),
      linear-gradient(160deg, #15110f 0%, #100d0c 54%, #17120f 100%);
    box-shadow: none;
    backdrop-filter: none;
  }

  .is-narrative .bwe-content-panel,
  .is-action-result .bwe-content-panel,
  .is-arrival .bwe-content-panel {
    position: relative;
    right: auto;
    bottom: auto;
    left: auto;
    width: 100%;
    flex: 0 1 auto;
    height: auto;
    min-height: 0;
    max-height: 34dvh;
    background:
      radial-gradient(circle at 74% 12%, rgba(100, 68, 43, 0.08), transparent 42%),
      linear-gradient(160deg, #15110f 0%, #100d0c 54%, #17120f 100%);
    box-shadow: none;
  }

  .bwe-narrative-content {
    width: calc(100% - 40px);
    height: auto;
    min-height: 0;
    max-height: 34dvh;
    flex: 0 1 auto;
    grid-template-rows: minmax(0, auto) auto;
    align-content: start;
    gap: 8px;
    padding: 14px 0 max(12px, env(safe-area-inset-bottom));
  }

  .bwe-letter-layout {
    width: calc(100% - 24px);
    padding: 14px 0 max(12px, env(safe-area-inset-bottom));
  }

  .bwe-document {
    padding: 16px 17px 12px;
  }

  .bwe-document-body {
    min-height: 68px;
    font-size: 1rem;
    line-height: 1.7;
  }

  .bwe-letter-object-stage {
    width: 100%;
    height: var(--bwe-visual-viewport-height, 100dvh);
    padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
  }

  .bwe-letter-object {
    width: 100%;
    max-height: calc(var(--bwe-visual-viewport-height, 100dvh) - max(24px, env(safe-area-inset-top)) - max(24px, env(safe-area-inset-bottom)));
    gap: 8px;
  }

  .bwe-letter-object .bwe-document {
    min-height: min(70dvh, 640px);
    padding: 22px 20px 17px;
  }

  .bwe-letter-object .bwe-document-body {
    min-height: 0;
    padding-top: 18px;
    font-size: 1rem;
    line-height: 1.72;
  }

  .bwe-typewriter-blocks {
    gap: 12px;
  }

  .bwe-document-body p + p {
    margin-top: 12px;
  }

  .is-time-location-card .bwe-stage {
    height: var(--bwe-visual-viewport-height, 100dvh);
  }

  .is-time-location-card .bwe-content-panel {
    position: absolute;
    inset: 0;
    height: 100%;
  }

  .bwe-copy.bwe-narrative-copy {
    min-height: calc(1.7em * 2);
    padding: 0;
    font-size: clamp(1.0625rem, 4.6vw, 1.125rem);
    line-height: 1.7;
  }

  .bwe-shell .bwe-next-control {
    width: 96px;
    max-width: 112px;
  }

  .is-hub .bwe-content-panel {
    height: auto;
    min-height: 0;
    max-height: none;
  }

  .is-optional-decision .bwe-content-panel,
  .is-investigation .bwe-content-panel {
    height: auto;
    min-height: 0;
    max-height: none;
  }

  .is-mandatory-decision .bwe-content-panel {
    height: auto;
    min-height: 0;
    max-height: none;
  }

  .bwe-copy {
    padding: 13px 16px 8px;
    font-size: 0.95rem;
    word-break: keep-all;
    overflow-wrap: break-word;
    line-break: strict;
    text-wrap: pretty;
  }

  .bwe-reading-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    align-content: start;
    word-break: keep-all;
    overflow-wrap: break-word;
    line-break: strict;
    text-wrap: pretty;
  }

  .is-narrative .bwe-interaction-deck,
  .is-action-result .bwe-interaction-deck,
  .is-arrival .bwe-interaction-deck {
    justify-content: flex-end;
  }

  .is-narrative .bwe-presentation-copy,
  .is-action-result .bwe-presentation-copy,
  .is-arrival .bwe-presentation-copy {
    flex: 0 1 auto;
    max-height: calc(34dvh - 68px - env(safe-area-inset-bottom));
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .bwe-typewriter-visual {
    max-height: calc(1.7em * 4);
  }

  .bwe-hub-actions {
    grid-template-columns: 1fr;
    gap: 6px;
    padding-inline: 10px;
  }

  .bwe-hub-actions button {
    min-height: 52px;
    padding-inline: 7px;
    font-size: 0.86rem;
  }

  .bwe-hub-actions-two {
    grid-template-columns: 1fr;
  }

  .bwe-evidence-presentation {
    margin: 10px 16px 4px;
    padding-left: 14px;
  }

  .bwe-tabs {
    gap: 4px;
    padding-inline: 8px;
  }

  .bwe-tabs button {
    min-width: 0;
    padding-inline: 5px;
    font-size: 0.78rem;
  }

  .is-mandatory-decision .bwe-panel-scroll {
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 0 12px max(64px, calc(52px + env(safe-area-inset-bottom)));
    overscroll-behavior: contain;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
  }

  .bwe-shell .bwe-decision-row {
    grid-template-columns: 28px minmax(0, 1fr) 20px;
    gap: 9px;
    padding-block: 8px;
  }

  .bwe-decision-copy strong {
    font-size: 0.94rem;
  }

  .bwe-decision-copy > span {
    font-size: 0.84rem;
    line-height: 1.42;
  }
}

@media (max-width: 700px) and (min-height: 421px) {
  .is-hub .bwe-content-panel {
    flex: 0 1 auto;
    max-height: calc(100% - 61px);
  }

  .is-hub .bwe-copy.bwe-reading-body {
    padding-bottom: 24px;
  }
}

@media (max-width: 700px) and (max-height: 420px) {
  .bwe-header,
  .bwe-overlay-header {
    box-sizing: border-box;
    position: relative;
    height: 34px;
    min-height: 34px;
    padding: 4px 10px;
    background: rgba(13, 10, 12, 0.98);
  }

  .bwe-stage {
    display: grid;
    height: calc(var(--bwe-visual-viewport-height, 100dvh) - 34px);
    min-height: 0;
    grid-template: minmax(0, 1fr) / minmax(0, 48%) minmax(0, 52%);
  }

  .bwe-letter-object-stage {
    height: var(--bwe-visual-viewport-height, 100dvh);
    padding: 6px 10px;
  }

  .bwe-letter-object {
    width: min(92vw, 720px);
    max-height: calc(var(--bwe-visual-viewport-height, 100dvh) - 12px);
    grid-template-columns: minmax(0, 1fr) 88px;
    grid-template-rows: minmax(0, 1fr);
    gap: 8px;
  }

  .bwe-letter-object .bwe-document {
    min-height: 0;
    height: 100%;
    padding: 12px 16px 10px;
  }

  .bwe-letter-object .bwe-document-header {
    padding-bottom: 5px;
  }

  .bwe-letter-object .bwe-document-body {
    padding: 8px 2px 2px;
    font-size: 14px;
    line-height: 1.45;
  }

  .bwe-document-body p + p {
    margin-top: 10px;
  }

  .bwe-letter-object .bwe-reading-controls {
    align-self: end;
  }

  .bwe-letter-object .bwe-next-control {
    width: 88px;
    min-height: 44px;
  }

  .is-time-location-card .bwe-stage {
    display: block;
    height: var(--bwe-visual-viewport-height, 100dvh);
  }

  .is-time-location-card .bwe-content-panel {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
  }

  .bwe-time-location-card {
    padding: 18px 12px 6px;
  }

  .bwe-interaction-deck {
    grid-column: 2;
    width: 100%;
    height: 100%;
    min-height: 0;
  }

  .bwe-scene {
    position: relative;
    inset: auto;
    grid-column: 1;
    width: 100%;
    height: auto;
    margin: 0;
    min-height: 0;
    aspect-ratio: 16 / 9;
    align-self: center;
  }

  .bwe-character-plate {
    position: absolute;
    right: auto;
    bottom: 0;
    left: 0;
    width: 52%;
    min-height: 40px;
    padding: 5px 10px;
    background: rgba(18, 13, 14, 0.9);
  }

  .bwe-character-plate-copy {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
  }

  .bwe-content-panel {
    position: relative;
    right: auto;
    bottom: auto;
    left: auto;
    width: 100%;
    height: auto;
    min-height: 0;
    max-height: none;
    flex: 1 1 auto;
    border-top: 0;
    border-left: 1px solid rgba(222, 202, 164, 0.3);
    background: #120e10;
    box-shadow: none;
  }

  .is-narrative .bwe-content-panel,
  .is-action-result .bwe-content-panel,
  .is-arrival .bwe-content-panel,
  .is-observation .bwe-content-panel {
    width: 100%;
    height: 100%;
    min-height: 0;
    max-height: none;
  }

  .is-mandatory-decision .bwe-content-panel,
  .is-optional-decision .bwe-content-panel {
    width: 100%;
    height: 100%;
    min-height: 0;
    max-height: none;
  }

  .bwe-narrative-content {
    width: calc(100% - 20px);
    height: 100%;
    align-content: start;
    gap: 3px;
    padding: 6px 0 max(4px, env(safe-area-inset-bottom));
  }

  .bwe-narrative-copy {
    min-height: 0;
    padding: 0;
    font-size: 0.86rem;
    line-height: 1.4;
  }

  .bwe-shell .bwe-next-control {
    width: 88px;
  }

  .bwe-tool-rail {
    box-sizing: border-box;
    position: relative;
    top: auto;
    left: auto;
    z-index: 14;
    display: flex;
    flex: 0 0 44px;
    align-self: flex-end;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    width: auto;
    height: 44px;
    min-height: 44px;
    margin: 4px 6px 4px auto;
    padding: 0;
    transform: none;
    border: 0;
    background: transparent;
  }

  .bwe-tool-rail button {
    width: auto;
    height: 44px;
    min-width: 0;
    min-height: 44px;
    border-radius: 3px;
    padding: 0 6px;
    font-size: 0.72rem;
    line-height: 1;
    box-shadow: none;
  }

  .bwe-tool-rail [data-bwe-tool="notebook"] {
    width: 89px;
  }

  .bwe-tool-rail [data-bwe-tool="map"] {
    width: 63px;
  }

  .bwe-copy {
    padding: 8px 12px 4px;
    font-size: 0.82rem;
    line-height: 1.36;
  }

  .bwe-typewriter-visual {
    min-height: calc(1.36em * 2);
    max-height: calc(1.36em * 3);
  }

  .bwe-panel-actions,
  .bwe-recorded-actions {
    gap: 5px;
    padding: 4px 8px max(4px, env(safe-area-inset-bottom));
  }

  .bwe-decision-heading {
    min-height: 34px;
  }

  .is-mandatory-decision .bwe-decision-heading {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: 6px;
    padding-inline: 8px;
  }

  .is-mandatory-decision .bwe-decision-heading h1 {
    min-width: max-content;
    white-space: nowrap;
    font-size: 0.8rem;
    line-height: 1.2;
  }

  .is-mandatory-decision .bwe-decision-heading .bwe-warning {
    min-width: 0;
    overflow: visible;
    white-space: nowrap;
    font-size: 0;
    line-height: 1;
  }

  .is-mandatory-decision .bwe-decision-heading .bwe-warning::after {
    content: "되돌릴 수 없는 선택";
    font-size: 0.75rem;
    line-height: 1.2;
    letter-spacing: -0.02em;
  }

  .is-mandatory-decision .bwe-panel-scroll,
  .is-optional-decision .bwe-panel-scroll {
    overflow-y: auto;
    padding: 2px 8px;
  }

  .bwe-shell .bwe-decision-row {
    min-height: 44px;
    grid-template-columns: 22px minmax(0, 1fr) 18px;
    gap: 5px;
    padding: 4px;
  }

  .bwe-decision-copy strong {
    font-size: 0.78rem;
  }

  .bwe-decision-copy > span {
    font-size: 0.72rem;
    line-height: 1.25;
  }

  .bwe-decision-confirm-row {
    padding: 3px 8px max(3px, env(safe-area-inset-bottom));
  }

  .bwe-shell button {
    min-height: 44px;
    padding: 5px 8px;
    font-size: 0.82rem;
  }

  .bwe-list,
  .bwe-notebook {
    padding: 8px 12px;
  }
}

@media (max-width: 700px) and (orientation: landscape) and (max-height: 420px) {
  .bwe-shell.is-final-ending {
    height: 100svh;
    height: 100dvh;
    max-height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }

  .is-final-ending .bwe-final-ending {
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    max-height: 100%;
    min-height: 0;
    grid-template-rows: auto auto minmax(0, 1fr) auto auto;
    align-content: stretch;
    place-content: normal;
    gap: 6px;
    padding: 8px 16px max(8px, env(safe-area-inset-bottom));
    overflow: hidden;
  }

  .is-final-ending .bwe-final-ending > p,
  .is-final-ending .bwe-ending-copy p {
    margin: 0;
  }

  .is-final-ending .bwe-ending-copy {
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .is-final-ending .bwe-ending-copy p + p {
    margin-top: 6px;
  }

  .is-final-ending .bwe-final-ending > div:last-child {
    min-height: 44px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    flex: 0 0 auto;
  }

  .is-final-ending .bwe-final-ending > div:last-child button {
    min-height: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bwe-typewriter-visual::after {
    animation: none;
  }
}
