:root {
  --bg: #f4efe6;
  --panel: #fffdf8;
  --ink: #1f1a14;
  --muted: #6e6559;
  --line: #dfd5c8;
  --accent: #9b5a2f;
  --accent-soft: #f1dfce;
  --danger: #b7372f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 20% 10%, #fff8ee 0%, transparent 40%),
    radial-gradient(circle at 80% 0%, #f0e0cf 0%, transparent 35%),
    var(--bg);
  min-height: 100vh;
  padding: 12px;
  overflow-x: hidden;
}

.app {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 4px 14px rgba(31, 26, 20, 0.06);
}

header {
  position: relative;
  padding: 12px 14px;
  padding-right: 56px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, #fff8ef, #f8efdf);
}

h1 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.subtitle {
  display: none;
}

.mode-row {
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.mode-label {
  color: var(--muted);
  font-size: 0.82rem;
}

.mode-select {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
  padding: 6px 8px;
  font-size: 0.85rem;
}

.mode-hint {
  color: var(--muted);
  font-size: 0.75rem;
  font-style: italic;
}

.lookup-row {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1.2fr) minmax(0, 1.2fr) auto;
  border-bottom: 1px solid var(--line);
  background: #fff;
  min-width: 0;
}

.cell {
  min-height: 96px;
  padding: 12px 14px;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
}

.cell:last-child {
  border-right: none;
}

.cell-label {
  color: var(--muted);
  font-size: 0.8rem;
}

.cell-value {
  font-size: 1.05rem;
  word-break: break-word;
}

.cell-value.zh {
  font-size: 1.8rem;
  line-height: 1.2;
}

.input-inline {
  width: 100%;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 7px 10px;
  font-size: 0.9rem;
  background: #fff;
  color: var(--ink);
}

button {
  border: none;
  border-radius: 4px;
  padding: 10px 14px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s ease, opacity 0.2s ease;
}

button:active {
  transform: translateY(1px);
}

button[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.secondary {
  background: var(--accent-soft);
  color: #5a3419;
}

.danger {
  background: #f9e2df;
  color: var(--danger);
}

.pinyin-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.play-inline {
  width: 34px;
  height: 34px;
  min-width: 34px;
  padding: 0;
  font-size: 0.95rem;
  line-height: 1;
}

.save-cell {
  padding: 0;
  align-items: stretch;
  justify-content: stretch;
}

.save-cell .cell-label {
  display: none;
}

.save-inline {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 96px;
  padding: 0 14px;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1;
  border-radius: 0;
  border: 2px solid #7b4521;
  background: linear-gradient(180deg, #f5dfc6, #eec79f);
  color: #4a2b14;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45);
}

.save-inline:not([disabled]):hover {
  background: linear-gradient(180deg, #f8e6d1, #f1d1af);
}

.save-inline[disabled] {
  border-color: #a27b5b;
  background: linear-gradient(180deg, #efe3d5, #e5d5c4);
  color: #7a6755;
  box-shadow: none;
}

.saved {
  position: relative;
  padding: 20px;
  overflow: visible;
  min-width: 0;
}

.status-bar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  margin-bottom: 4px;
  min-width: 0;
}

.tabs-menu-wrap.top-right-menu {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 110;
}

.import-choice-dialog {
  position: fixed;
  inset: 0;
  background: rgba(31, 26, 20, 0.45);
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 14px;
}

.import-choice-dialog[hidden] {
  display: none !important;
}

.import-choice-card {
  width: min(420px, 100%);
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 14px 28px rgba(31, 26, 20, 0.22);
  padding: 14px;
}

.import-choice-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.import-choice-text {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.import-choice-actions {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.import-choice-btn {
  width: 100%;
  justify-content: center;
  min-height: 36px;
}

.import-choice-danger {
  background: #f7d7d4;
  color: #8e2f2a;
  border: 1px solid #e7b5b0;
}

.import-choice-danger:hover {
  background: #f4cbc7;
}

.scroll-top-fab {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: 44px;
  height: 44px;
  min-width: 44px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid #6f3f20;
  background: linear-gradient(180deg, #f4debf, #e7bf92);
  color: #4a2b14;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 10px 22px rgba(31, 26, 20, 0.2);
  z-index: 95;
}

.scroll-top-fab:hover {
  background: linear-gradient(180deg, #f7e6d0, #ebcaa4);
}

.scroll-top-fab[hidden] {
  display: none !important;
}

.playall-progress {
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  padding: 8px 10px;
  position: -webkit-sticky;
  position: sticky;
  top: 12px;
  z-index: 30;
  box-shadow: 0 8px 18px rgba(31, 26, 20, 0.12);
}

.playall-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.playall-progress-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.controller-close-btn {
  width: 24px;
  height: 24px;
  min-width: 24px;
  padding: 0;
  font-size: 0.82rem;
  line-height: 1;
  border-radius: 4px;
}

.playall-progress-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.playall-widget-btn {
  padding: 5px 10px;
  font-size: 0.82rem;
  line-height: 1;
  min-height: 28px;
  position: relative;
}

.playall-widget-btn.is-playing {
  padding-left: 24px;
}

.playall-widget-btn.is-playing::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 50%;
  width: 10px;
  height: 10px;
  border: 2px solid #7b4521;
  border-right-color: transparent;
  border-radius: 999px;
  transform: translateY(-50%) rotate(0deg);
  animation: playall-stop-spin 0.8s linear infinite;
}

@keyframes playall-stop-spin {
  to {
    transform: translateY(-50%) rotate(360deg);
  }
}

.playall-mode-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.playall-mode-wrap .playall-widget-btn {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.playall-mode-btn {
  width: 22px;
  min-width: 22px;
  height: 28px;
  padding: 0;
  border-radius: 0 3px 3px 0;
  margin-left: 0;
  border-left-width: 0;
  position: relative;
  line-height: 1;
  font-size: 0.72rem;
}

.playall-mode-btn::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 1px;
  background: rgba(123, 69, 33, 0.35);
  pointer-events: none;
}

.playall-mode-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 190px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: 0 8px 18px rgba(31, 26, 20, 0.12);
  z-index: 40;
  display: grid;
  padding: 4px;
}

.playall-mode-menu[hidden] {
  display: none !important;
}

.playall-mode-item {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  border-radius: 2px;
  padding: 7px 9px;
  font-size: 0.82rem;
  font-weight: 500;
}

.playall-mode-item:hover {
  background: #f8efe3;
}

.playall-mode-item.is-active {
  background: #f3fbf6;
  color: #1f5a39;
}

.playall-toggle-btn {
  padding: 6px 10px;
  font-size: 0.82rem;
  line-height: 1;
}

.playall-toggle-btn.is-on {
  background: #d7ebdd;
  color: #1f5a39;
}

.playall-repeat-label {
  color: var(--muted);
  font-size: 0.78rem;
}

.playall-repeat-select {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
  padding: 4px 6px;
  font-size: 0.82rem;
}

.playall-source-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  user-select: none;
}

.playall-source-toggle input {
  margin: 0;
}

.playall-progress-title {
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 700;
}

.playall-progress-text {
  color: var(--muted);
  font-size: 0.8rem;
}

.controller-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  margin: 0 6px 0 0;
  width: 34px;
  height: 34px;
  padding: 0;
  font-size: 0.9rem;
  line-height: 1;
  border-radius: 3px;
}

.playall-progress[hidden] {
  display: none !important;
}

.playall-progress-track {
  height: 8px;
  border-radius: 999px;
  background: #efe4d6;
  overflow: hidden;
}

.playall-progress-fill {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #cf8e5f, #9b5a2f);
  transition: width 0.24s ease;
}

.flashcard-stage {
  margin-bottom: 12px;
}

.flashcard-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 14px;
  min-height: 180px;
  display: grid;
  gap: 10px;
  align-content: start;
}

.flashcard-meta {
  color: var(--muted);
  font-size: 0.8rem;
}

.flashcard-target {
  font-size: 2rem;
  line-height: 1.25;
  word-break: break-word;
}

.flashcard-reading {
  font-size: 1.05rem;
  color: #503a26;
  word-break: break-word;
}

.flashcard-target.is-concealed,
.flashcard-reading.is-concealed,
.flashcard-source.is-concealed {
  color: #a89c8d;
  letter-spacing: 0.08em;
}

.flashcard-source {
  font-size: 0.95rem;
  color: var(--muted);
  word-break: break-word;
}

.flashcard-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
}

.flashcard-nav-btn {
  width: 30px;
  height: 30px;
  min-width: 30px;
  padding: 0;
  font-size: 1rem;
  line-height: 1;
  border-radius: 4px;
}

.flashcard-play-btn {
  width: 34px;
  min-width: 34px;
}

.flashcard-empty {
  border: 1px dashed var(--line);
  border-radius: 6px;
  color: var(--muted);
  padding: 14px;
  background: #fff;
}

.tabs-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
  min-width: 0;
}

.tabs-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1;
  align-items: flex-end;
  border-bottom: 1px solid var(--line);
  padding-bottom: 2px;
  min-width: 0;
}

.tabs-menu-wrap {
  position: relative;
}

.tabs-menu-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 4px;
  width: 34px;
  height: 34px;
  padding: 0;
  font-size: 1.25rem;
  line-height: 1;
}

.tabs-menu-panel {
  position: absolute;
  right: 0;
  top: 38px;
  min-width: 150px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: 0 6px 18px rgba(31, 26, 20, 0.08);
  display: grid;
  padding: 4px;
  z-index: 20;
}

.tabs-menu-mobile-shell {
  display: contents;
}

.tabs-menu-mobile-head {
  display: none;
}

.tabs-menu-mobile-close {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 4px;
  width: 30px;
  height: 30px;
  min-width: 30px;
  padding: 0;
  font-size: 1rem;
  line-height: 1;
}

.tabs-submenu-wrap {
  position: relative;
}

.tabs-menu-item {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--ink);
  border-radius: 2px;
  padding: 8px 10px;
  font-size: 0.9rem;
}

.tabs-menu-item:hover {
  background: #f8efe3;
}

.tabs-submenu-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tabs-submenu-trigger[aria-expanded="true"] {
  background: #f8efe3;
}

.tabs-submenu-arrow {
  font-size: 0.86rem;
  color: var(--muted);
  margin-left: 8px;
}

.tabs-submenu-panel {
  position: absolute;
  left: calc(100% - 2px);
  right: auto;
  top: -4px;
  min-width: 180px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: 0 6px 18px rgba(31, 26, 20, 0.08);
  display: grid;
  padding: 4px;
  z-index: 22;
}

.tabs-submenu-panel[hidden] {
  display: none !important;
}

.tabs-menu-item.danger {
  color: #8e2f2a;
}

.tabs-menu-item.danger:hover {
  background: #fbe8e6;
}

.tabs-menu-sep {
  height: 1px;
  background: var(--line);
  margin: 4px 0;
}

.tabs-menu-label {
  color: var(--muted);
  font-size: 0.78rem;
  padding: 6px 10px 2px;
}

.tabs-move-list {
  display: grid;
}

.tabs-menu-muted {
  color: var(--muted);
  font-size: 0.85rem;
  padding: 8px 10px;
}

.tabs-menu-panel[hidden] {
  display: none !important;
}

.tab-item {
  display: inline-flex;
  align-items: center;
  gap: 0;
  padding: 0;
  position: relative;
}

.tab-item.active {
  color: var(--accent);
}

.tab-item.drag-over-target {
  background: #f3fbf6;
}

.tab-item.drag-over-reorder .tab-btn {
  border-color: #2f7d54;
}

.tab-item.drag-insert-left::before,
.tab-item.drag-insert-right::after {
  content: '';
  position: absolute;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: #2f7d54;
}

.tab-item.drag-insert-left::before {
  left: -4px;
}

.tab-item.drag-insert-right::after {
  right: -4px;
}

.tab-item.is-dragging {
  opacity: 0.55;
}

.tab-btn {
  background: var(--accent-soft);
  color: var(--ink);
  border: 1px solid var(--line);
  border-right-width: 0;
  border-radius: 4px 0 0 0;
  height: 24px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1;
  font-size: 0.85rem;
}

.tab-item.active .tab-btn {
  color: var(--accent);
  background: #f7ecdf;
  border-color: #d8c0a9;
  border-right-width: 0;
}

.tab-seg-wrap {
  position: relative;
  margin-left: -1px;
}

.tab-seg-btn {
  border: 1px solid var(--line);
  background: var(--accent-soft);
  color: #5a3419;
  border-left-width: 0;
  border-radius: 0 4px 0 0;
  width: 24px;
  height: 24px;
  min-width: 24px;
  padding: 0;
  font-size: 0.95rem;
  line-height: 1;
  position: relative;
}

.tab-seg-btn:hover {
  background: #f3e3d3;
}

.tab-seg-btn::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(123, 69, 33, 0.28);
  pointer-events: none;
}

.tab-seg-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  min-width: 170px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: 0 6px 18px rgba(31, 26, 20, 0.08);
  display: grid;
  padding: 4px;
  z-index: 25;
}

.tab-seg-menu[hidden] {
  display: none !important;
}

.tab-name-input {
  width: 140px;
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 6px 8px;
  font-size: 0.9rem;
  background: #fff;
  color: var(--ink);
}

.tab-add-btn {
  border: 1px solid var(--line);
  background: var(--accent-soft);
  color: #5a3419;
  border-radius: 4px 4px 0 0;
  width: 24px;
  height: 24px;
  padding: 0;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 0;
}

.tab-add-btn:hover {
  background: #f3e3d3;
}

.saved-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
  min-height: 48px;
  min-width: 0;
}

.saved-list.drag-over-end {
  outline: 2px dashed #b6dfc7;
  outline-offset: 4px;
  border-radius: 4px;
}

.saved-item {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 8px 10px;
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1.2fr) minmax(0, 1.2fr) auto;
  gap: 8px;
  align-items: center;
  background: #fff;
  cursor: grab;
  position: relative;
}

.saved-item.is-selected {
  border-color: #2f7d54;
  box-shadow: inset 0 0 0 1px #b6dfc7;
  background: #f3fbf6;
}

.saved-item.is-playing {
  border-color: #9b5a2f;
  box-shadow: inset 0 0 0 1px #f0d1b4;
  background: #fff6eb;
}

.saved-item.is-dragging {
  opacity: 0.55;
}

.saved-item.drag-over {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent-soft);
}

.saved-item.drag-insert-before::before,
.saved-item.drag-insert-after::after {
  content: '';
  position: absolute;
  left: 6px;
  right: 6px;
  height: 2px;
  background: #2f7d54;
}

.saved-item.drag-insert-before::before {
  top: -2px;
}

.saved-item.drag-insert-after::after {
  bottom: -2px;
}

.saved-cell {
  min-width: 0;
  font-size: 0.95rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.saved-source {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  word-break: break-word;
  line-height: 1.25;
}

.saved-pinyin,
.saved-katakana {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  word-break: break-word;
  line-height: 1.25;
}

.saved-zh {
  font-size: 1rem;
}

.saved-item.mode-ja .saved-zh {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  word-break: break-word;
  line-height: 1.25;
}

.saved-item.mode-zh .saved-zh {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  word-break: break-word;
  line-height: 1.25;
}

.saved-play {
  width: 30px;
  height: 30px;
  min-width: 30px;
  padding: 0;
  font-size: 0.9rem;
  line-height: 1;
}

.saved-actions {
  display: inline-flex;
  align-items: center;
  justify-self: end;
  gap: 6px;
}

.saved-action-btn {
  width: 30px;
  height: 30px;
  min-width: 30px;
  padding: 0;
  font-size: 0.9rem;
  line-height: 1;
}

.saved-delete {
  font-size: 0.85rem;
}

.saved-copy {
  opacity: 1;
  pointer-events: auto;
}

.hint {
  color: var(--muted);
  font-size: 0.85rem;
}

.error {
  color: var(--danger);
  font-size: 0.95rem;
  padding: 0;
  border-bottom: 0;
  height: 24px;
  display: flex;
  align-items: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

@media (max-width: 940px) {
  body {
    padding: 8px;
  }

  .app {
    width: 100%;
    max-width: 100%;
  }

  .lookup-row {
    grid-template-columns: 1fr;
  }

  .cell {
    border-right: none;
    border-bottom: 1px solid var(--line);
    min-height: auto;
    display: grid;
    grid-template-columns: 84px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
  }

  .cell:last-child {
    border-bottom: none;
  }

  .cell-label {
    margin: 0;
    font-size: 0.78rem;
  }

  .cell-value,
  .input-inline,
  .pinyin-inline,
  .save-inline {
    grid-column: 2;
    min-width: 0;
  }

  .cell-value {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .cell-value.zh {
    font-size: 1.05rem;
    line-height: 1.2;
  }

  .pinyin-inline {
    justify-content: space-between;
    align-items: center;
  }

  .pinyin-inline .cell-value {
    margin-right: 0;
    flex: 1;
    min-width: 0;
    text-align: left;
  }

  .save-cell {
    padding: 8px 12px;
    grid-template-columns: 1fr;
    align-items: center;
    justify-content: center;
  }

  .save-inline {
    grid-column: 1 / -1;
    justify-self: stretch;
    width: 100%;
    height: 42px;
    min-height: 42px;
    border-radius: 4px;
    font-size: 0.95rem;
    border-width: 2px;
    font-weight: 800;
  }

  .playall-progress {
    top: 8px;
    padding: 8px;
  }

  .playall-progress-head {
    align-items: flex-start;
    justify-content: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .playall-progress-left {
    width: 100%;
    flex-wrap: wrap;
    gap: 6px 8px;
  }

  .playall-widget-btn,
  .playall-toggle-btn,
  .playall-mode-btn,
  .playall-repeat-select {
    height: 28px;
  }

  .flashcard-target {
    font-size: 1.4rem;
  }

  .playall-progress-text {
    align-self: flex-end;
  }

  .saved-item {
    grid-template-columns: 1fr;
    align-items: center;
    gap: 4px;
  }

  .status-bar {
    align-items: flex-start;
    padding-right: 42px;
  }

  .import-choice-card {
    padding: 12px;
  }

  .scroll-top-fab {
    right: 12px;
    bottom: 12px;
    width: 40px;
    height: 40px;
    min-width: 40px;
  }

  .tabs-menu-panel {
    position: fixed;
    inset: 0;
    top: 0;
    right: auto;
    min-width: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: rgba(31, 26, 20, 0.38);
    z-index: 120;
    padding: 10px 8px;
    display: block;
  }

  .tabs-menu-wrap.top-right-menu {
    position: absolute;
    top: 8px;
    right: 8px;
  }

  .tabs-menu-mobile-shell {
    display: grid;
    gap: 0;
    width: min(440px, 100%);
    max-height: calc(100dvh - 20px);
    overflow: auto;
    margin-left: auto;
    margin-right: auto;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 14px 30px rgba(31, 26, 20, 0.22);
    padding: 8px;
  }

  .tabs-menu-mobile-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2px 2px 8px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--line);
    font-weight: 700;
    color: var(--ink);
  }

  .tabs-submenu-panel {
    position: static;
    left: auto;
    right: auto;
    top: auto;
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 4px;
    box-shadow: none;
    margin: 4px 0 6px 12px;
    padding: 4px;
  }

  .tabs-submenu-arrow {
    transform: rotate(90deg);
    transition: transform 0.15s ease;
  }

  .tabs-submenu-trigger[aria-expanded="true"] .tabs-submenu-arrow {
    transform: rotate(180deg);
  }

  .saved-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .saved-source {
    align-items: flex-start;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    word-break: break-word;
  }

  .saved-cell::before {
    color: var(--muted);
    font-size: 0.78rem;
    flex: 0 0 72px;
  }

  .saved-source::before {
    content: 'Input';
  }

  .saved-chinese::before {
    content: 'Target';
  }

  .saved-pinyin::before {
    content: 'Reading';
  }

  .saved-katakana::before {
    content: 'Katakana';
  }

  .saved-zh {
    font-size: 0.96rem;
  }

  .saved-item.mode-ja .saved-zh {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    word-break: break-word;
    line-height: 1.25;
  }

  .saved-item.mode-zh .saved-zh {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    word-break: break-word;
    line-height: 1.25;
  }

  .saved-actions {
    width: 100%;
    justify-self: auto;
    justify-content: flex-start;
    gap: 8px;
  }

  .saved-actions::before {
    content: 'Actions';
    color: var(--muted);
    font-size: 0.78rem;
    margin-right: 8px;
    flex: 0 0 72px;
    text-align: left;
  }

  .saved-action-btn {
    width: 28px;
    height: 28px;
    min-width: 28px;
  }

  .saved-copy {
    opacity: 1;
    pointer-events: auto;
  }
}
