/* src/web/scss/styles.css */
html,
body {
  margin: 0;
  font-family: sans-serif;
  color: #222;
  background:
    linear-gradient(
      160deg,
      #4a6fa5,
      #2c3e50);
}
.app {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}
nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.85rem;
  padding: calc(0.5rem + env(safe-area-inset-top, 0px)) 0.75rem 0.5rem;
}
nav a {
  color: #666;
}
.workspace {
  flex: 1;
  position: relative;
  display: grid;
  gap: 0.75rem;
  padding: 0 0.75rem 0.75rem;
}
.browser,
.panel {
  background-color: white;
  border: 1px solid #c8c8c8;
  border-radius: 0.5rem;
  overflow: hidden;
}
.browser,
.panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.browser.flipping,
.panel.flipping {
  transition: transform 250ms ease, width 250ms ease;
}
.title-bar {
  padding: 0.35rem 0.75rem;
  background-color: #efefef;
  border-bottom: 1px solid #ddd;
  font-size: 0.8rem;
  font-weight: bold;
  color: #555;
  text-align: center;
}
.panel .title-bar {
  position: relative;
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.window-buttons {
  position: absolute;
  right: 0.3rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  gap: 0.2rem;
}
.window-buttons button {
  width: 1.5rem;
  height: 1.3rem;
  border: 1px solid #bbb;
  border-radius: 0.2rem;
  background: white center/60% no-repeat;
  cursor: pointer;
}
.window-buttons button:hover {
  background-color: #ddd;
}
.window-buttons .recenter {
  background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 12"><circle cx="6" cy="6" r="3.2" fill="none" stroke="%23222" stroke-width="1.3"/><path stroke="%23222" stroke-width="1.3" d="M6 0.5v2.5M6 9v2.5M0.5 6H3M9 6h2.5"/></svg>%0A');
}
.window-buttons .minimize {
  background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 12"><path stroke="%23222" stroke-width="1.5" d="M2 9h8"/></svg>%0A');
}
.window-buttons .maximize {
  background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 12"><rect x="2" y="2" width="8" height="8" fill="none" stroke="%23222" stroke-width="1.5"/></svg>%0A');
}
.window-buttons .restore {
  background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 12"><rect x="2" y="4" width="6" height="6" fill="white" stroke="%23222" stroke-width="1.3"/><path fill="none" stroke="%23222" stroke-width="1.3" d="M4 4V2h6v6H8"/></svg>%0A');
}
.taskbar-item {
  margin-left: auto;
  padding: 0.2rem 0.7rem;
  border: 1px solid #222;
  border-radius: 0.2rem;
  background-color: white;
  color: #222;
  font-size: 0.85rem;
  cursor: pointer;
}
.overlay .workspace,
.overlay.with-panel .workspace {
  grid-template-columns: minmax(0, 1fr);
  justify-content: stretch;
}
.overlay .panel {
  position: absolute;
  top: 0;
  bottom: 8px;
  left: calc(0.75rem + 8px);
  right: calc(0.75rem + 8px);
  z-index: 2;
  background: none;
  pointer-events: none;
}
.overlay .panel .line {
  pointer-events: auto;
}
.overlay .panel .header {
  background-color: white;
  border-bottom: 1px solid #c8c8c8;
  pointer-events: auto;
}
.overlay .browser {
  position: relative;
  z-index: 1;
}
.bubbles {
  position: absolute;
  bottom: 0;
  z-index: 2;
  pointer-events: none;
  font-size: calc(16px * var(--scale));
}
.bubbles .translation-view {
  padding: 0;
}
.bubbles .translation-view .cut {
  position: absolute;
  left: auto;
  right: auto;
  margin: 0;
  padding-left: 0;
  border-left: none;
}
.bubbles .translation-view .bubble {
  position: relative;
  width: fit-content;
  max-width: 100%;
  margin: 0 0 0.2em;
}
.bubbles .translation-view .bubble.placed {
  margin: 0;
  max-width: none;
}
.bubbles .translation-view .line,
.bubbles .translation-view .line.speech,
.bubbles .translation-view .line.scream,
.bubbles .translation-view .line.thought,
.bubbles .translation-view .line.square,
.bubbles .translation-view .line.shock,
.bubbles .translation-view .line.stroke {
  background-color: white;
  color: #222;
  border: none;
  border-radius: 9999px;
  padding: 0.1em 0.6em;
  font-size: 1em;
  font-weight: normal;
  margin: 0;
  box-sizing: border-box;
  width: 100%;
}
.bubbles .translation-view .line.fixed {
  display: grid;
  align-content: center;
  padding: 0;
  overflow: visible;
  line-height: 1.25;
}
.bubbles .translation-view .line.vertical {
  writing-mode: vertical-rl;
  text-orientation: upright;
  width: auto;
}
.bubbles .translation-view .line.vertical.fixed {
  width: 100%;
  justify-content: center;
}
.bubbles .translation-view.horimiya {
  font-size: 1.2em;
}
.bubbles .translation-view.horimiya .line {
  font-family: "Gaegu", cursive;
}
.bubbles .translation-view.horimiya .line.stroke,
.bubbles .translation-view.horimiya .line .stroke {
  font-family: "Black Han Sans", sans-serif;
}
.bubbles.editing .line {
  pointer-events: auto;
  cursor: move;
  outline: 1px dashed rgba(0, 0, 0, 0.35);
  touch-action: none;
}
.bubbles.editing .line-editor {
  display: block;
  box-sizing: border-box;
  width: 100%;
  min-width: 8em;
  min-height: 2.6em;
  padding: 0.1em 0.4em;
  border: 2px solid #1e88e5;
  border-radius: 0.3em;
  background-color: white;
  font: inherit;
  font-size: 1em;
  line-height: 1.25;
  resize: both;
  pointer-events: auto;
}
.bubbles.editing .add-image {
  position: absolute;
  width: 1.6em;
  height: 1.6em;
  margin-left: -1.6em;
  border: 2px solid #1e88e5;
  border-radius: 50%;
  background-color: white;
  color: #1e88e5;
  font-size: 1em;
  line-height: 1;
  cursor: pointer;
  pointer-events: auto;
}
.bubbles.editing .line {
  opacity: 0.55;
}
.bubbles.editing .bubble.selected .line,
.bubbles.editing .bubble.dragging .line {
  outline: 2px solid #1e88e5;
}
.bubbles.editing .baseline {
  position: absolute;
  height: 0;
  border-top: 2px dashed #e53935;
  cursor: ns-resize;
  pointer-events: auto;
  touch-action: none;
}
.bubbles.editing .baseline .tab {
  position: absolute;
  left: 0;
  bottom: 0;
  padding: 0 0.4em;
  border-radius: 0.3em 0.3em 0 0;
  background-color: #e53935;
  color: white;
  font: 12px sans-serif;
  line-height: 1.4;
  white-space: nowrap;
  cursor: move;
}
.bubbles.editing .rotor {
  position: absolute;
  left: 50%;
  top: -12px;
  width: 8px;
  height: 8px;
  margin-left: -4px;
  border: 1.5px solid #1e88e5;
  border-radius: 50%;
  background-color: white;
  cursor: grab;
  pointer-events: auto;
  touch-action: none;
}
.bubbles.editing .grip {
  position: absolute;
  width: 6px;
  height: 6px;
  background-color: #1e88e5;
  border: 1px solid white;
  pointer-events: auto;
  touch-action: none;
}
.bubbles.editing .grip.nw {
  left: -4px;
  top: -4px;
  cursor: nwse-resize;
}
.bubbles.editing .grip.ne {
  right: -4px;
  top: -4px;
  cursor: nesw-resize;
}
.bubbles.editing .grip.sw {
  left: -4px;
  bottom: -4px;
  cursor: nesw-resize;
}
.bubbles.editing .grip.se {
  right: -4px;
  bottom: -4px;
  cursor: nwse-resize;
}
.bubbles.editing .bubble-tools {
  position: absolute;
  left: 0;
  top: 100%;
  z-index: 3;
  display: flex;
  gap: 0.25rem;
  margin-top: 0.25rem;
  padding: 0.25rem;
  background-color: white;
  border: 1px solid #bbb;
  border-radius: 0.3rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  pointer-events: auto;
  font-size: 12px;
  white-space: nowrap;
}
.bubbles.editing .bubble-tools button {
  font-size: 12px;
  padding: 0.1rem 0.4rem;
  cursor: pointer;
}
.bubbles.editing .bubble-tools .size {
  align-self: center;
  min-width: 2.5em;
  text-align: center;
}
.bubbles.editing .bubble-tools .radius {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.bubbles.editing .bubble-tools .radius input {
  width: 5rem;
}
.edit-tools {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.5rem;
}
.edit-tools button {
  font-size: 0.85rem;
  padding: 0.25rem 0.6rem;
  border: 1px solid #bbb;
  border-radius: 0.3rem;
  background-color: white;
  cursor: pointer;
}
.desk {
  padding: 0.5rem 0.75rem;
}
.desk .edit-toggle {
  padding: 0.25rem 0.7rem;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 0.3rem;
  background: none;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.8rem;
  cursor: pointer;
}
.desk .edit-toggle[aria-pressed=true] {
  background-color: white;
  color: #222;
}
.chrome {
  padding: 0.5rem;
  border-bottom: 1px solid #ddd;
}
.address-bar {
  display: flex;
  gap: 0.5rem;
}
.address-bar .back,
.address-bar .forward,
.address-bar .home {
  flex: none;
  width: 2.2rem;
  border: 1px solid #bbb;
  border-radius: 0.3rem;
  background: white center/50% no-repeat;
  cursor: pointer;
}
.address-bar .back {
  background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="none" stroke="%23222" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" d="M15 5l-7 7 7 7"/></svg>%0A');
}
.address-bar .forward {
  background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="none" stroke="%23222" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" d="M9 5l7 7-7 7"/></svg>%0A');
}
.address-bar .home {
  background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="%23222" d="M12 3 2 12h3v8h5v-6h4v6h5v-8h3z"/></svg>%0A');
}
.address-bar input {
  flex: 1;
  min-width: 0;
  font-size: 1rem;
  padding: 0.4rem 0.6rem;
  border: 1px solid #bbb;
  border-radius: 0.3rem;
}
.address-bar button {
  font-size: 1rem;
  padding: 0.4rem 0.9rem;
  border: none;
  border-radius: 0.3rem;
  background-color: #222;
  color: white;
  cursor: pointer;
}
.message {
  margin: 0.5rem 0 0;
  font-size: 0.9rem;
  color: #b00020;
}
.viewer {
  flex: 1;
  position: relative;
  overflow: hidden;
  background-color: #cfff00;
}
.frame {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  border: none;
  background-color: #cfff00;
  transform-origin: 0 0;
  transition: transform 500ms;
}
.viewer.mobile.splash .frame {
  width: calc(100% / var(--splash-scale));
  height: calc(100% / var(--splash-scale));
  transform: scale(var(--splash-scale));
  transition: none;
}
.viewer.mobile.entered .frame {
  width: calc(188px + var(--fit));
  height: calc(100% / var(--scale));
  transform: scale(var(--scale)) translateX(calc(188px * -1));
}
.viewer.tall .frame {
  height: var(--doc-height);
}
.viewer.mobile.menu-open .frame {
  transform: scale(var(--scale));
}
.viewer.tall {
  flex: none;
  height: calc(var(--doc-height) * var(--scale));
  min-height: 0;
}
.scrim {
  position: absolute;
  left: calc(188px * var(--scale));
  right: 0;
  top: 0;
  bottom: 0;
  z-index: 5;
  display: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  border: none;
  padding: 0;
  background: none;
  -webkit-tap-highlight-color: transparent;
}
.viewer.menu-open .scrim {
  display: block;
}
.fab {
  position: fixed;
  left: 1rem;
  bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  z-index: 10;
  width: 3.5rem;
  height: 3.5rem;
  background-color: #222;
  background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="white" d="M24 6h-24v-4h24v4zm0 4h-24v4h24v-4zm0 8h-24v4h24v-4z"/></svg>%0A');
  background-size: 55%;
  background-repeat: no-repeat;
  background-position: center;
  border-radius: 50%;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  border: none;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  opacity: 1;
  transition: left 500ms, opacity 5000ms;
}
.viewer.entered .fab {
  opacity: 5%;
}
.viewer.menu-open .fab {
  left: calc(188px * var(--scale) + 1rem);
  opacity: 1;
}
.fab:hover,
.fab:focus-visible {
  opacity: 1;
  transition: left 500ms, opacity 500ms;
}
.controls {
  padding: 0.75rem 1rem;
  line-height: 1.5;
}
.controls .note {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  color: #666;
}
.controls .episode-picker {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-weight: bold;
}
.controls .episode-picker label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.controls .episode-picker select {
  flex: 1;
  min-width: 0;
  font-size: 1rem;
  padding: 0.3rem;
}
.controls .episode-number {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.controls .episode-number input {
  width: 5rem;
  font-size: 1.1rem;
  padding: 0.3rem;
  text-align: center;
}
.controls .episode-number button {
  width: 2.6rem;
  height: 2.6rem;
  font-size: 1.3rem;
  border: 1px solid #bbb;
  border-radius: 0.3rem;
  background-color: white;
  cursor: pointer;
}
.controls .episode-number button:disabled {
  color: #bbb;
  cursor: default;
}
.controls .episode-number .hint {
  flex-basis: 100%;
  font-size: 0.8rem;
  font-weight: normal;
  color: #666;
}
.controls .page-index {
  display: flex;
  gap: 0.3rem;
}
.controls .page-index button {
  font-size: 0.85rem;
  padding: 0.2rem 0.6rem;
  border: 1px solid #bbb;
  border-radius: 0.3rem;
  background-color: white;
  cursor: pointer;
}
.controls .page-index button[aria-pressed=true] {
  background-color: #222;
  border-color: #222;
  color: white;
}
.controls .fit-picker {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
  font-weight: bold;
}
.controls .fit-picker .label {
  flex-basis: 100%;
}
.controls .fit-picker button {
  font-size: 0.9rem;
  padding: 0.25rem 0.6rem;
  border: 1px solid #bbb;
  border-radius: 0.3rem;
  background-color: white;
  cursor: pointer;
}
.controls .fit-picker button[aria-pressed=true] {
  background-color: #222;
  border-color: #222;
  color: white;
}
.translations {
  flex: 1;
  position: relative;
  padding: 0 1rem;
  line-height: 1.5;
}
.translations .status {
  margin: 0.75rem 0;
  font-size: 0.85rem;
  color: #666;
}
.license {
  padding: 0.75rem 1rem;
  margin-top: 1.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid #ddd;
}
.license h3 {
  margin: 0 0 0.3rem;
  font-size: 0.85rem;
}
.license pre {
  margin: 0;
  white-space: pre-wrap;
  font-size: 0.75rem;
  color: #666;
}
.translation-view {
  padding: 0.75rem 0;
}
.translation-view .cut {
  margin: 0 0 0.75rem;
}
.translation-view.positioned {
  padding: 0;
}
.translation-view.positioned .cut {
  position: absolute;
  left: 1rem;
  right: 1rem;
  margin: 0;
}
.translation-view .line {
  margin: 0 0 0.3rem;
  width: fit-content;
  word-break: keep-all;
}
.translation-view .line.speech,
.translation-view .line.scream {
  background-color: white;
  border: 1px solid #222;
  border-radius: 1em;
  padding: 0.1em 0.6em;
}
.translation-view .line.scream {
  border-style: dotted;
  border-width: 2px;
}
.translation-view .line.thought {
  border: 1px dashed #222;
  border-radius: 1em;
  padding: 0.1em 0.6em;
}
.translation-view .line.square {
  border: 1px solid #222;
  padding: 0.1em 0.4em;
}
.translation-view .line.shock {
  background-color: #222;
  color: white;
  border-radius: 1em;
  padding: 0.1em 0.6em;
}
.translation-view .line.stroke,
.translation-view .line .stroke {
  color: #222;
  -webkit-text-fill-color: transparent;
  -webkit-text-stroke-width: 1px;
}
.translation-view .line strong.stroke {
  font-weight: normal;
  font-size: 1.2em;
}
.translation-view .line big.stroke {
  font-size: 1.4em;
}
.translation-view .line .blue {
  color: #2c8ea6;
}
.translation-view .line .flip {
  display: inline-block;
  transform: rotate(-180deg);
}
@media (max-width: 60rem) {
  nav {
    padding: calc(0.25rem + env(safe-area-inset-top, 0px)) 0.25rem 0.25rem;
    gap: 0.6rem;
  }
  .workspace {
    gap: 0.2rem;
    padding: 0 0 0.2rem;
  }
  .with-panel .workspace {
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  }
  .browser,
  .panel {
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
  .title-bar {
    padding: 0.15rem 0.4rem;
    font-size: 0.7rem;
  }
  .chrome {
    padding: 0.25rem;
  }
  .address-bar {
    gap: 0.25rem;
  }
  .address-bar input {
    font-size: 0.9rem;
    padding: 0.3rem 0.4rem;
  }
  .address-bar button {
    padding: 0.3rem 0.5rem;
    font-size: 0.9rem;
  }
  .address-bar .home {
    width: 2rem;
  }
  .controls {
    padding: 0.3rem;
    font-size: 0.8rem;
  }
  .controls .note {
    display: none;
  }
  .controls .episode-picker {
    gap: 0.3rem;
  }
  .controls .episode-number {
    gap: 0.25rem;
  }
  .controls .episode-number input {
    width: 3.4rem;
    font-size: 1rem;
    padding: 0.2rem;
  }
  .controls .episode-number button {
    width: 2rem;
    height: 2rem;
    font-size: 1.1rem;
  }
  .controls .fit-picker {
    gap: 0.25rem;
    margin-top: 0.3rem;
  }
  .controls .fit-picker button {
    padding: 0.15rem 0.4rem;
    font-size: 0.8rem;
  }
  .translations,
  .license {
    font-size: 0.8rem;
  }
  .translations {
    padding: 0 0.25rem;
  }
  .translation-view.positioned .cut {
    left: 0.25rem;
    right: 0.25rem;
  }
  .translation-view .cut {
    padding-left: 0.35rem;
    border-left-width: 2px;
  }
  .translation-view .line {
    font-size: 0.8rem;
    margin-bottom: 0.2rem;
  }
  .license {
    padding: 0.4rem 0.3rem;
  }
  .overlay .panel {
    left: 8px;
    right: 8px;
  }
  .desk {
    display: none;
  }
}
@media (min-width: 60rem) {
  .with-panel .workspace {
    grid-template-columns: minmax(0, 40rem) 24rem;
    justify-content: center;
  }
}
.workspace {
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
}
.viewer {
  min-height: calc(100dvh - 8rem);
}
.browser .pointer-shield {
  position: absolute;
  inset: 0;
  z-index: 1;
}
body.page {
  background: white;
}
body.page article {
  max-width: 44rem;
  margin: 0 auto;
  padding: 1rem 1rem 3rem;
  line-height: 1.7;
}
body.page article img {
  max-width: 100%;
}
body.page article table {
  border-collapse: collapse;
  font-size: 0.9rem;
}
body.page article th,
body.page article td {
  border: 1px solid #ddd;
  padding: 0.2rem 0.6rem;
}
