:root {
  color-scheme: light;
  --bg: #f4f2ed;
  --panel: #ffffff;
  --ink: #1d2529;
  --muted: #607078;
  --line: #d7d2c8;
  --accent: #0d6b76;
  --accent-strong: #0a4f58;
  --shadow: 0 18px 60px rgba(29, 37, 41, 0.14);
}

@font-face {
  font-family: "Devnotes Helvetica Neue Regular";
  src: url("./fonts/HelveticaNeue-Regular.ttf") format("truetype");
  font-display: swap;
}

@font-face {
  font-family: "Devnotes Helvetica Neue Bold";
  src: url("./fonts/HelveticaNeue-Bold.ttf") format("truetype");
  font-display: swap;
}

@font-face {
  font-family: "Devnotes Helvetica Neue Italic";
  src: url("./fonts/HelveticaNeue-Italic.ttf") format("truetype");
  font-display: swap;
}

@font-face {
  font-family: "Devnotes Helvetica Neue Bold Italic";
  src: url("./fonts/HelveticaNeue-BoldItalic.ttf") format("truetype");
  font-display: swap;
}

@font-face {
  font-family: "Devnotes Helvetica Neue Condensed Bold";
  src: url("./fonts/HelveticaNeue-CondensedBold.ttf") format("truetype");
  font-display: swap;
}

@font-face {
  font-family: "Devnotes Helvetica Neue UltraLight";
  src: url("./fonts/HelveticaNeue-UltraLight.ttf") format("truetype");
  font-display: swap;
}

@font-face {
  font-family: "Devnotes Helvetica Neue UltraLight Italic";
  src: url("./fonts/HelveticaNeue-UltraLightItalic.ttf") format("truetype");
  font-display: swap;
}

@font-face {
  font-family: "Devnotes Helvetica Neue Light";
  src: url("./fonts/HelveticaNeue-Light.ttf") format("truetype");
  font-display: swap;
}

@font-face {
  font-family: "Devnotes Helvetica Neue Light Italic";
  src: url("./fonts/HelveticaNeue-LightItalic.ttf") format("truetype");
  font-display: swap;
}

@font-face {
  font-family: "Devnotes Helvetica Neue Condensed Black";
  src: url("./fonts/HelveticaNeue-CondensedBlack.ttf") format("truetype");
  font-display: swap;
}

@font-face {
  font-family: "Devnotes Helvetica Neue Medium";
  src: url("./fonts/HelveticaNeue-Medium.ttf") format("truetype");
  font-display: swap;
}

@font-face {
  font-family: "Devnotes Helvetica Neue Medium Italic";
  src: url("./fonts/HelveticaNeue-MediumItalic.ttf") format("truetype");
  font-display: swap;
}

@font-face {
  font-family: "Devnotes Helvetica Neue Thin";
  src: url("./fonts/HelveticaNeue-Thin.ttf") format("truetype");
  font-display: swap;
}

@font-face {
  font-family: "Devnotes Helvetica Neue Thin Italic";
  src: url("./fonts/HelveticaNeue-ThinItalic.ttf") format("truetype");
  font-display: swap;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  color: inherit;
  font: inherit;
}

.settings-panel {
  position: fixed;
  z-index: 20;
  top: max(8px, env(safe-area-inset-top));
  left: max(8px, env(safe-area-inset-left));
  width: max-content;
  max-width: calc(100dvw - 16px);
}

.fullscreen-toggle {
  position: fixed;
  z-index: 21;
  top: max(8px, env(safe-area-inset-top));
  right: max(8px, env(safe-area-inset-right));
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(29, 37, 41, 0.72);
  cursor: pointer;
  padding: 0;
}

.fullscreen-toggle:hover {
  color: var(--accent-strong);
}

.fullscreen-icon {
  display: grid;
  grid-template-columns: repeat(2, 12px);
  grid-template-rows: repeat(2, 12px);
  width: 24px;
  height: 24px;
  line-height: 1;
}

.fullscreen-icon span {
  display: grid;
  place-items: center;
  font-size: 18px;
  line-height: 1;
}

.settings-toggle {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(13, 107, 118, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 4px 18px rgba(29, 37, 41, 0.14);
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.settings-toggle::-webkit-details-marker {
  display: none;
}

.settings-toggle span {
  font-size: 20px;
  line-height: 1;
}

.settings-menu {
  min-width: 210px;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  padding: 10px;
}

.setting-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 34px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
}

.setting-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.settings-action {
  display: block;
  width: 100%;
  min-height: 34px;
  margin-top: 6px;
  border: 1px solid rgba(13, 107, 118, 0.22);
  border-radius: 8px;
  background: rgba(240, 246, 247, 0.92);
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.settings-action-danger {
  border-color: rgba(158, 44, 44, 0.22);
  background: rgba(250, 238, 238, 0.94);
  color: #8e2222;
}

.help-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(18, 26, 30, 0.16);
  place-items: center;
  padding: 20px;
}

.help-overlay.is-visible {
  display: grid;
}

.help-dialog {
  width: min(420px, 100%);
  border: 1px solid rgba(13, 107, 118, 0.18);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 18px 46px rgba(29, 37, 41, 0.18);
  padding: 18px 18px 16px;
}

.help-title {
  margin: 0 0 12px;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.2;
}

.confirm-copy {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
}

.confirm-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.single-column-actions {
  grid-template-columns: minmax(0, 1fr);
}

.help-list {
  display: grid;
  gap: 8px;
}

.help-row {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.35;
}

.help-row kbd {
  display: inline-grid;
  min-width: 74px;
  min-height: 28px;
  place-items: center;
  border: 1px solid rgba(13, 107, 118, 0.18);
  border-radius: 8px;
  background: rgba(240, 246, 247, 0.92);
  color: var(--ink);
  font: 700 13px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.text-styles-dialog {
  width: min(460px, 100%);
}

.text-style-sections {
  display: grid;
  gap: 14px;
}

.text-style-section {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(13, 107, 118, 0.12);
  border-radius: 10px;
  background: rgba(244, 248, 249, 0.72);
  padding: 12px;
}

.text-style-heading {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.2;
}

.text-style-field {
  display: grid;
  gap: 6px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.text-style-select,
.text-style-number,
.text-style-range {
  width: 100%;
}

.text-style-select,
.text-style-number {
  min-height: 34px;
  border: 1px solid rgba(13, 107, 118, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font: 500 14px/1.2 ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  padding: 6px 10px;
}

.text-style-size-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 78px;
  align-items: center;
  gap: 10px;
}

.text-style-range {
  accent-color: var(--accent);
}

body.hide-viewer-arrows .nav-button {
  display: none;
}

body.hide-bottom-scroller .thumb-strip {
  display: none;
}

body.hide-bottom-scroller .viewer {
  grid-template-rows: auto minmax(0, 1fr);
}

body.hide-debug-panel .debug-panel {
  display: none;
}

body.study-mode .study-actions.is-visible {
  display: block;
}

body.hide-study-actions .study-actions.is-visible {
  display: none;
}

body.study-mode .study-progress.is-visible {
  display: flex;
}

body.flicker-stars-mode.study-mode .study-progress.is-visible {
  opacity: 0;
}

body.flicker-stars-mode.study-mode .study-progress.is-visible.is-flash-visible {
  opacity: 1;
}

.memo-indicator.is-visible {
  display: grid;
}

body.fullscreen-view {
  background: #000;
}

body.fullscreen-view .settings-panel,
body.fullscreen-view .folder-panel,
body.fullscreen-view .viewer-bar,
body.fullscreen-view .thumb-strip {
  display: none;
}

body.fullscreen-view .fullscreen-toggle {
  color: rgba(255, 255, 255, 0.72);
}

body.fullscreen-view .fullscreen-toggle:hover {
  color: #fff;
}

body.fullscreen-view .app-shell {
  display: block;
  background: #000;
}

body.fullscreen-view .viewer {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  height: 100dvh;
  padding: 0;
  gap: 0;
  background: #000;
}

body.fullscreen-view .stage {
  width: 100%;
  max-width: none;
  height: 100%;
  border: 0;
  border-radius: 0;
  background: #000;
  box-shadow: none;
}

body.fullscreen-view .slide {
  padding: 0;
}

body.fullscreen-view .image-frame {
  background-color: #000;
}

body.fullscreen-view .debug-panel {
  background: rgba(0, 0, 0, 0.58);
  border-color: rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.82);
}

body.fullscreen-view .debug-line strong {
  color: rgba(255, 213, 74, 0.9);
}

.app-shell {
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr);
  width: 100%;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

.folder-panel {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  padding: 54px 12px 18px;
}

.folder-group {
  min-width: 0;
}

.book-list {
  display: grid;
  gap: 12px;
}

.book-tab-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.book-tab-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  padding: 7px 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
  cursor: pointer;
}

.book-tab-button.is-active {
  border-color: rgba(13, 107, 118, 0.24);
  background: #d8eff1;
  color: var(--accent-strong);
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.panel-title::-webkit-details-marker {
  display: none;
}

.panel-title::before {
  content: "▾";
  display: inline-grid;
  width: 13px;
  height: 13px;
  place-items: center;
  color: var(--accent);
  font-size: 12px;
  transition: transform 160ms ease;
}

.folder-group:not([open]) .panel-title::before {
  transform: rotate(-90deg);
}

.folder-group:not([open]) .panel-title {
  margin-bottom: 0;
}

.folder-list {
  display: grid;
  gap: 6px;
}

.folder-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 36px;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  padding: 7px 9px;
  cursor: pointer;
  text-align: left;
}

.folder-button:hover {
  border-color: var(--line);
  background: #fff;
}

.folder-button:disabled {
  cursor: default;
  opacity: 0.58;
}

.folder-button:disabled:hover {
  border-color: transparent;
  background: transparent;
}

.folder-button.is-active {
  border-color: rgba(13, 107, 118, 0.24);
  background: #d8eff1;
  color: var(--accent-strong);
  font-weight: 800;
}

.folder-count {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.viewer {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: 100%;
  min-width: 0;
  min-height: 0;
  height: 100dvh;
  padding: 18px;
  gap: 14px;
  overflow: hidden;
}

.debug-panel {
  position: fixed;
  z-index: 18;
  right: max(8px, env(safe-area-inset-right));
  bottom: max(8px, env(safe-area-inset-bottom));
  display: grid;
  gap: 4px;
  max-width: min(420px, calc(100dvw - 16px));
  padding: 10px 12px;
  border: 1px solid rgba(13, 107, 118, 0.2);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 8px 28px rgba(29, 37, 41, 0.14);
  color: rgba(29, 37, 41, 0.84);
  font-size: 11px;
  line-height: 1.35;
  backdrop-filter: blur(8px);
}

.debug-line {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 8px;
}

.debug-line strong {
  color: var(--accent-strong);
  font-weight: 800;
}

.viewer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 54px;
}

h1 {
  margin: 0;
  font-size: clamp(22px, 3vw, 34px);
  line-height: 1.05;
}

#imageTitle {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.counter {
  flex: 0 0 auto;
  margin-right: 52px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 8px 11px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.stage {
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #e9e5dc;
  box-shadow: var(--shadow);
  touch-action: none;
  outline: none;
}

.stage:focus-visible {
  box-shadow: 0 0 0 3px rgba(13, 107, 118, 0.28), var(--shadow);
}

.slide-track {
  display: flex;
  width: 300%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  will-change: transform;
}

.slide-track.is-animating {
  transition: transform 260ms ease;
}

.slide {
  display: grid;
  flex: 0 0 33.333333%;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 12px;
  overflow: hidden;
}

.image-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  cursor: grab;
}

.image-frame.is-zoomed {
  cursor: move;
}

.image-frame img {
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  flex: 0 1 100%;
  object-fit: contain;
  object-position: center;
  transform-origin: center;
  user-select: none;
  will-change: transform;
  -webkit-user-drag: none;
}

.nav-button {
  position: absolute;
  z-index: 2;
  top: 50%;
  display: grid;
  width: 44px;
  height: 54px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 6px;
  background: rgba(29, 37, 41, 0.46);
  color: #fff;
  cursor: pointer;
  transform: translateY(-50%);
}

.nav-button:hover {
  background: rgba(13, 79, 88, 0.82);
}

.nav-button span {
  font-size: 42px;
  line-height: 0.6;
}

.nav-button.prev {
  left: 14px;
}

.nav-button.next {
  right: 14px;
}

.study-actions {
  display: none;
  position: absolute;
  z-index: 4;
  left: 0;
  right: 0;
  bottom: clamp(10px, 2.4vh, 22px);
  height: 0;
  pointer-events: none;
}

.study-progress {
  display: none;
  position: absolute;
  z-index: 4;
  left: clamp(12px, 2vw, 20px);
  top: clamp(12px, 2.6vh, 22px);
  align-items: center;
  gap: 3px;
  padding: 6px 9px;
  border-radius: 999px;
  background: rgba(16, 24, 28, 0.12);
  backdrop-filter: blur(3px);
  opacity: 1;
  pointer-events: none;
  transition: opacity 140ms ease;
}

.study-progress-star {
  color: rgba(255, 255, 255, 0.9);
  font-size: 24px;
  line-height: 1;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.18);
  opacity: 0.92;
}

.study-progress-star.is-filled {
  color: #ffd54a;
  opacity: 1;
}

.study-bulk-toast {
  display: none;
  position: absolute;
  z-index: 30;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  max-width: min(82vw, 420px);
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(16, 24, 28, 0.18);
  backdrop-filter: blur(3px);
  color: rgba(255, 255, 255, 0.96);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.28);
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease;
}

.study-bulk-toast.is-visible {
  display: block;
  opacity: 1;
}

.memo-indicator {
  display: none;
  position: absolute;
  z-index: 4;
  right: clamp(12px, 2vw, 20px);
  bottom: calc(clamp(12px, 2.6vh, 22px) - 6.24px);
  width: 48px;
  height: 48px;
  border: 0;
  background: transparent;
  place-items: center;
  color: rgba(13, 79, 88, 0.5);
  font-size: 30px;
  font-family: "Apple Symbols", "Noto Sans Symbols 2", "Segoe UI Symbol", sans-serif;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  pointer-events: auto;
  text-shadow: 0 1px 10px rgba(255, 255, 255, 0.32);
}

.draft-indicator {
  display: none;
  position: absolute;
  z-index: 4;
  left: clamp(12px, 2vw, 20px);
  bottom: calc(clamp(12px, 2.6vh, 22px) - 12.84px);
  width: 56px;
  height: 56px;
  border: 0;
  background: transparent;
  place-items: center;
  color: rgba(13, 79, 88, 0.5);
  font-size: 35px;
  font-family: "Apple Symbols", "Noto Sans Symbols 2", "Segoe UI Symbol", sans-serif;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  pointer-events: auto;
  text-shadow: 0 1px 10px rgba(255, 255, 255, 0.32);
}

.draft-indicator.is-visible {
  display: grid;
}

.memo-indicator-main {
  display: block;
}

.memo-indicator-badge {
  display: none;
  position: absolute;
  left: 50%;
  top: -8px;
  transform: translateX(-50%);
  color: rgba(13, 79, 88, 0.82);
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}

.memo-indicator.has-badge .memo-indicator-badge {
  display: block;
}

.memo-indicator.is-asterisk-mode .memo-indicator-main {
  font-size: 34px;
  font-weight: 700;
}

.memo-popup,
.draft-popup {
  display: none;
  position: fixed;
  z-index: 25;
  top: 0;
  left: 0;
  border: 1px solid rgba(13, 107, 118, 0.18);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(2px);
  box-sizing: border-box;
  box-shadow: 0 12px 28px rgba(29, 37, 41, 0.16);
  cursor: move;
  padding: 10px 10px 14px;
  touch-action: none;
}

.draft-popup {
  background: rgba(170, 176, 184, 0.375);
}

.memo-popup.is-visible,
.draft-popup.is-visible {
  display: block;
}

.memo-textarea,
.draft-textarea {
  display: block;
  width: 20ch;
  min-width: 20ch;
  max-width: 20ch;
  min-height: calc(5lh + 2px);
  resize: none;
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: text;
  font-weight: 500;
  font-size: 15px;
  line-height: 1.3;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  outline: none;
  padding: 0;
  touch-action: auto;
}

.memo-popup.has-custom-size .memo-textarea,
.draft-popup.has-custom-size .draft-textarea {
  width: 100%;
  max-width: none;
  min-width: 0;
  height: 100%;
  min-height: 0;
}

.memo-resize-handle,
.draft-resize-handle {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 16px;
  height: 16px;
  cursor: nwse-resize;
  touch-action: none;
}

.memo-resize-handle::before,
.draft-resize-handle::before {
  content: "";
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 10px;
  height: 10px;
  border-right: 2px solid rgba(13, 107, 118, 0.52);
  border-bottom: 2px solid rgba(13, 107, 118, 0.52);
}

.study-action {
  position: absolute;
  bottom: 0;
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: rgba(13, 79, 88, 0.38);
  cursor: pointer;
  font-size: 46px;
  font-weight: 400;
  line-height: 1;
  padding: 0;
  pointer-events: auto;
  text-shadow: 0 1px 10px rgba(255, 255, 255, 0.32);
  transform: translateX(-50%);
}

.study-action-x {
  left: 33.333333%;
}

.study-action-check {
  left: 66.666667%;
  font-size: 35px;
  transform: translate(-50%, 5%);
}

body.fullscreen-view .study-action {
  color: rgba(255, 255, 255, 0.42);
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.42);
}

body.fullscreen-view .study-progress {
  background: rgba(255, 255, 255, 0.12);
}

body.fullscreen-view .study-bulk-toast {
  background: rgba(255, 255, 255, 0.14);
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.42);
}

body.fullscreen-view .study-progress-star {
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.42);
}

body.fullscreen-view .memo-indicator {
  color: rgba(255, 255, 255, 0.7);
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.42);
}

body.fullscreen-view .draft-indicator {
  color: rgba(255, 255, 255, 0.7);
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.42);
}

body.fullscreen-view .memo-popup,
body.fullscreen-view .draft-popup {
  background: rgba(0, 0, 0, 0.22);
  border-color: rgba(255, 255, 255, 0.16);
}

body.fullscreen-view .draft-popup {
  background: rgba(28, 32, 36, 0.32);
}

body.fullscreen-view .memo-textarea,
body.fullscreen-view .draft-textarea {
  color: rgba(255, 255, 255, 0.88);
}

body.fullscreen-view .memo-resize-handle::before,
body.fullscreen-view .draft-resize-handle::before {
  border-right-color: rgba(255, 255, 255, 0.62);
  border-bottom-color: rgba(255, 255, 255, 0.62);
}

.thumb-strip {
  display: flex;
  min-height: 74px;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  gap: 8px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  padding: 8px;
}

.thumb-button {
  flex: 0 0 70px;
  width: 70px;
  height: 56px;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 6px;
  background: #e6e1d8;
  padding: 0;
  cursor: pointer;
}

.thumb-button.is-active {
  border-color: var(--accent);
}

.thumb-button img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (max-width: 760px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    width: 100dvw;
    max-width: 100dvw;
    height: 100dvh;
    min-height: 0;
  }

  .folder-panel {
    position: static;
    width: 100%;
    max-width: 100dvw;
    height: auto;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 52px 10px 10px;
  }

  .book-list {
    gap: 8px;
  }

  .book-tab-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
  }

  .book-tab-button {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .mobile-folder-list {
    display: flex;
    gap: 7px;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
  }

  .folder-button {
    flex: 0 0 auto;
    width: auto;
    min-width: 62px;
  }

  .folder-count {
    margin-left: 8px;
  }

  .viewer {
    width: 100%;
    max-width: 100dvw;
    height: 100%;
    min-width: 0;
    min-height: 0;
    padding: 10px;
    gap: 10px;
  }

  .viewer-bar {
    min-width: 0;
    min-height: 46px;
  }

  .counter {
    margin-right: 46px;
  }

  .viewer-bar > div {
    min-width: 0;
  }

  h1 {
    font-size: 22px;
  }

  .stage {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 0;
    height: 100%;
  }

  .slide {
    padding: 8px;
  }

  .nav-button {
    width: 38px;
    height: 48px;
  }

  .nav-button.prev {
    left: max(8px, env(safe-area-inset-left));
  }

  .nav-button.next {
    right: max(8px, env(safe-area-inset-right));
  }
}
