:root {
  color-scheme: light;
  --ink: #202124;
  --paper: #fbfaf7;
  --panel: #ffffff;
  --line: #d8d2c8;
  --accent: #237c6b;
  --accent-strong: #155e50;
  --danger: #b3342d;
  --shadow: 0 18px 45px rgba(29, 32, 36, 0.13);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background:
    radial-gradient(circle at 20% 8%, rgba(35, 124, 107, 0.12), transparent 28%),
    linear-gradient(135deg, #f5f2eb 0%, #f9fbfa 48%, #f3f0ea 100%);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow: hidden;
}

button,
input {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr) 260px;
  gap: 16px;
  height: 100%;
  padding: 16px;
}

.app-shell.menus-swapped {
  grid-template-columns: 260px minmax(0, 1fr) 128px;
}

.app-shell.menus-swapped .settings-panel {
  grid-column: 1;
  grid-row: 1;
}

.app-shell.menus-swapped .workspace {
  grid-column: 2;
  grid-row: 1;
}

.app-shell.menus-swapped .left-rail {
  grid-column: 3;
  grid-row: 1;
}

.left-rail,
.settings-panel {
  align-self: stretch;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(99, 90, 78, 0.2);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.left-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  padding-top: 18px;
  padding-bottom: 18px;
  border-radius: 8px;
}

.tool-button {
  display: grid;
  width: 104px;
  height: 104px;
  place-items: center;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  color: #fff;
  background: var(--danger);
  box-shadow: 0 10px 20px rgba(179, 52, 45, 0.24);
}

.tool-button:hover {
  filter: brightness(0.95);
}

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

.tool-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
  transform: none;
}

.tool-button svg {
  display: block;
  width: 58px;
  height: 58px;
  stroke: currentColor;
  stroke-width: 2.15;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.gauntlet-animation {
  display: block;
  width: 80px;
  height: 80px;
  pointer-events: none;
}

.undo-button {
  background: var(--accent);
  box-shadow: 0 10px 20px rgba(35, 124, 107, 0.2);
}

.clear-button,
.undo-button {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.undo-button svg {
  width: 62px;
  height: 62px;
  transform: translateX(-2px);
}

.color-palette {
  display: grid;
  grid-template-columns: repeat(2, 46px);
  gap: 8px;
  width: 104px;
}

.color-swatch {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 2px solid rgba(35, 124, 107, 0.2);
  border-radius: 8px;
  background: #1f1d1a;
  cursor: pointer;
  box-shadow: 0 8px 16px rgba(29, 32, 36, 0.1);
}

.color-swatch.active {
  border-color: var(--accent);
  box-shadow:
    0 0 0 3px rgba(35, 124, 107, 0.18),
    0 8px 16px rgba(29, 32, 36, 0.12);
}

.color-picker-button {
  color: var(--accent-strong);
  background:
    linear-gradient(#fff, #fff) padding-box,
    conic-gradient(#d64c4c, #e1c84d, #42a85b, #3e9fcf, #7e55cc, #d64c4c) border-box;
}

.color-picker-button svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
}

.color-picker-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.swap-menu-button {
  width: 104px;
  min-height: 42px;
  margin-top: auto;
  border: 1px solid rgba(35, 124, 107, 0.24);
  border-radius: 8px;
  color: var(--accent-strong);
  background: #eef5f2;
  cursor: pointer;
  font-size: 13px;
  font-weight: 720;
}

.theme-switcher {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 104px;
  margin-top: auto;
}

.theme-button {
  height: 34px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(29, 32, 36, 0.13);
}

.theme-button-current {
  background: linear-gradient(135deg, #fbfaf7 0 34%, #237c6b 34% 67%, #b7ddd4 67%);
}

.theme-button-dark {
  background: linear-gradient(135deg, #070707 0 34%, #1a1a1a 34% 67%, #4d4d4d 67%);
}

.theme-button-violet {
  background: linear-gradient(135deg, #07052f 0 28%, #922b91 28% 52%, #167db5 52% 76%, #10c0e0 76%);
}

.theme-button-sunset {
  background: linear-gradient(135deg, #062c3c 0 28%, #126c83 28% 52%, #4ebebc 52% 76%, #f48470 76%);
}

.theme-button.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 30%, transparent);
}

.theme-switcher + .swap-menu-button {
  margin-top: 0;
}

.swap-menu-button:hover {
  filter: brightness(0.97);
}

.swap-menu-button.active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.workspace {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(94, 86, 74, 0.24);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

#practiceCanvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
}

.settings-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border-radius: 8px;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.panel-header h1 {
  margin: 0 0 2px;
  font-size: 20px;
  font-weight: 720;
  letter-spacing: 0;
}

.panel-header p {
  margin: 0;
  color: #6f6a62;
  font-size: 13px;
}

.file-picker {
  display: grid;
  min-height: 46px;
  place-items: center;
  border: 1px solid var(--accent);
  border-radius: 8px;
  color: #fff;
  background: var(--accent);
  cursor: pointer;
  font-weight: 680;
  text-align: center;
}

.file-picker:hover {
  background: var(--accent-strong);
}

.control-row {
  display: grid;
  gap: 4px;
}

.control-row label {
  color: #4d4943;
  font-size: 13px;
  font-weight: 650;
}

.control-row label span {
  color: var(--accent-strong);
  font-variant-numeric: tabular-nums;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.primary-button,
.secondary-button,
.icon-button,
.icon-small-button,
.text-toggle,
.mode-button,
.sort-button {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 680;
}

.primary-button,
.secondary-button {
  min-height: 36px;
  padding: 0 14px;
}

.compact-button {
  min-height: 34px;
  padding: 0 10px;
}

.primary-button {
  color: #fff;
  background: var(--accent);
}

.secondary-button {
  color: var(--accent-strong);
  background: #e7f1ee;
  border: 1px solid rgba(35, 124, 107, 0.24);
}

.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.primary-button:hover,
.secondary-button:not(:disabled):hover,
.icon-small-button:hover,
.sort-button:hover {
  filter: brightness(0.97);
}

.icon-small-button,
.sort-button {
  min-height: 30px;
  padding: 0 10px;
  color: var(--accent-strong);
  background: #eef5f2;
}

.icon-small-button {
  display: grid;
  width: 28px;
  min-width: 28px;
  padding: 0;
  place-items: center;
}

.icon-small-button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

.icon-small-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.library-panel {
  display: flex;
  flex: 1;
  min-height: min(300px, 34vh);
  flex-direction: column;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(99, 90, 78, 0.18);
}

.library-header,
.sort-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
}

.library-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 28px;
}

.library-header span {
  color: #4d4943;
  font-size: 12.5px;
  font-weight: 750;
}

.folder-path-input {
  min-width: 0;
  height: 28px;
  padding: 0 4px;
  border: 1px solid rgba(35, 124, 107, 0.18);
  border-radius: 8px;
  color: #4d4943;
  background: rgba(255, 255, 255, 0.72);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.folder-path-input:focus {
  outline: 2px solid rgba(35, 124, 107, 0.2);
  outline-offset: 1px;
}

.sort-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 3px;
  border-radius: 8px;
  background: #edf0ec;
}

.sort-button.active {
  color: #fff;
  background: var(--accent);
}

.sort-button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

.library-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
  padding-bottom: clamp(24px, 8vh, 96px);
}

.library-item {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 4px;
  border: 1px solid rgba(94, 86, 74, 0.18);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  text-align: left;
}

.library-item img,
.library-pdf-thumb,
.library-page-thumb {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 6px;
  background: #102024;
  object-fit: contain;
}

.library-pdf-thumb {
  display: grid;
  place-items: center;
  color: #f4fbff;
  font-size: 20px;
  font-weight: 760;
}

.library-page-thumb {
  display: block;
}

.library-name {
  overflow: hidden;
  color: #4d4943;
  font-size: 10px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-empty {
  grid-column: 1 / -1;
  color: #766f66;
  font-size: 13px;
  line-height: 1.35;
}

.text-toggle-group,
.draw-mode-group {
  display: grid;
  gap: 4px;
}

.inline-toggle-row {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: end;
  column-gap: 10px;
}

.inline-toggle-row .text-toggle-group {
  align-self: end;
  margin-bottom: 1px;
}

.inline-toggle-row > div:last-child {
  min-width: 0;
}

.text-toggle-group {
  grid-template-columns: repeat(2, 42px);
}

.draw-mode-group {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.text-toggle,
.mode-button {
  min-height: 30px;
  border: 1px solid rgba(35, 124, 107, 0.24);
  color: var(--accent-strong);
  background: transparent;
}

.text-toggle.active,
.mode-button.active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.mode-button {
  display: grid;
  width: 70%;
  aspect-ratio: 1;
  padding: 0;
  justify-self: center;
  place-items: center;
}

.mode-button svg {
  width: 74px;
  height: 74px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mode-button .pointer-mode-icon {
  width: 72px;
  height: 72px;
  stroke-width: 1.55;
  transform: none;
}

.pressure-pen-icon {
  display: block;
  width: 74px;
  height: 74px;
  background: currentColor;
  mask: url("./assets/stylus-rings-icon.svg") center / 150% 150% no-repeat;
  -webkit-mask: url("./assets/stylus-rings-icon.svg") center / 150% 150% no-repeat;
}

.calligraphy-brush-icon {
  display: block;
  width: 74px;
  height: 74px;
  background: currentColor;
  mask: url("./assets/japanese-calligraphy-brush.svg") center / contain no-repeat;
  -webkit-mask: url("./assets/japanese-calligraphy-brush.svg") center / contain no-repeat;
}

.hand-outline-icon {
  display: block;
  width: 74px;
  height: 74px;
  background: currentColor;
  mask: url("./assets/hand-outline.svg") center / contain no-repeat;
  -webkit-mask: url("./assets/hand-outline.svg") center / contain no-repeat;
}

@media (max-height: 760px) {
  .settings-panel {
    gap: 8px;
  }

  .library-panel {
    min-height: 220px;
  }
}

@media (max-height: 640px) {
  .library-panel {
    min-height: 170px;
  }

  .library-list {
    padding-bottom: 120px;
  }
}

.crop-button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.crop-dialog {
  width: min(92vw, 840px);
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
}

.crop-dialog::backdrop {
  background: rgba(22, 24, 26, 0.42);
}

.crop-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid rgba(99, 90, 78, 0.24);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.crop-header,
.crop-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.crop-header h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0;
}

.icon-button {
  display: grid;
  position: relative;
  width: 54px;
  height: 54px;
  flex: 0 0 54px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #5d574f;
  background: #f2eee7;
  font-size: 0;
  font-weight: 500;
  line-height: 1;
  transition:
    color 160ms ease,
    background-color 160ms ease,
    border-color 160ms ease,
    transform 160ms ease,
    box-shadow 160ms ease;
}

.icon-button::before,
.icon-button::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 28px;
  height: 3px;
  border-radius: 999px;
  background: currentColor;
  content: "";
}

.icon-button::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.icon-button::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.icon-button:not(:disabled):hover {
  color: var(--panel);
  background: var(--ink);
  border-color: var(--ink);
  box-shadow: 0 8px 18px color-mix(in srgb, var(--ink) 22%, transparent);
  transform: scale(1.05);
  filter: none;
}

.icon-button:not(:disabled):active {
  transform: scale(0.97);
}

#cropCanvas,
#fileCropCanvas {
  display: block;
  width: 100%;
  height: min(62vh, 560px);
  border: 1px solid rgba(94, 86, 74, 0.24);
  border-radius: 8px;
  background: #f8f6f0;
  cursor: crosshair;
  touch-action: none;
}

@media (max-width: 820px) {
  body {
    overflow: auto;
  }

  .app-shell {
    grid-template-columns: 112px minmax(0, 1fr);
    grid-template-rows: minmax(420px, 1fr) auto;
    min-height: 100%;
    height: auto;
    gap: 10px;
    padding: 10px;
  }

  .app-shell.menus-swapped {
    grid-template-columns: 112px minmax(0, 1fr);
  }

  .app-shell.menus-swapped .left-rail {
    grid-column: 1;
    grid-row: 1;
  }

  .app-shell.menus-swapped .workspace {
    grid-column: 2;
    grid-row: 1;
  }

  .app-shell.menus-swapped .settings-panel {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .left-rail {
    grid-column: 1;
    grid-row: 1;
    padding-top: 10px;
  }

  .workspace {
    grid-column: 2;
    grid-row: 1;
    min-height: 420px;
  }

  .settings-panel {
    grid-column: 1 / -1;
    grid-row: 2;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 14px;
  }

  .panel-header,
  .file-picker,
  .secondary-button,
  .library-panel {
    grid-column: 1 / -1;
  }

  .tool-button {
    width: 92px;
    height: 92px;
  }

  .swap-menu-button {
    width: 92px;
  }

  .theme-switcher {
    width: 92px;
  }

  .library-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #808080;
  --paper: #070707;
  --panel: #1a1a1a;
  --line: #4d4d4d;
  --accent: #4d4d4d;
  --accent-strong: #808080;
  --danger: #1a1a1a;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.45);
}

:root[data-theme="dark"] body {
  background: #070707;
}

:root[data-theme="dark"] .left-rail,
:root[data-theme="dark"] .settings-panel {
  background: rgba(8, 8, 8, 0.96);
  border-color: #1a1a1a;
}

:root[data-theme="dark"] .workspace,
:root[data-theme="dark"] #cropCanvas,
:root[data-theme="dark"] #fileCropCanvas {
  border-color: #1a1a1a;
  background: #0d0d0d;
}

:root[data-theme="dark"] .panel-header p,
:root[data-theme="dark"] .control-row label,
:root[data-theme="dark"] .library-header span,
:root[data-theme="dark"] .library-name,
:root[data-theme="dark"] .library-empty {
  color: #808080;
}

:root[data-theme="dark"] .secondary-button,
:root[data-theme="dark"] .icon-small-button,
:root[data-theme="dark"] .sort-button,
:root[data-theme="dark"] .swap-menu-button,
:root[data-theme="dark"] .icon-button {
  color: #808080;
  background: #1a1a1a;
  border-color: #4d4d4d;
}

:root[data-theme="dark"] .folder-path-input,
:root[data-theme="dark"] .library-item {
  color: #808080;
  background: #101010;
  border-color: #1a1a1a;
}

:root[data-theme="dark"] .sort-toggle {
  background: #1a1a1a;
}

:root[data-theme="dark"] .library-panel,
:root[data-theme="dark"] .text-toggle,
:root[data-theme="dark"] .mode-button,
:root[data-theme="dark"] .color-swatch {
  border-color: #4d4d4d;
}

:root[data-theme="dark"] .tool-button,
:root[data-theme="dark"] .file-picker,
:root[data-theme="dark"] .primary-button,
:root[data-theme="dark"] .text-toggle.active,
:root[data-theme="dark"] .mode-button.active,
:root[data-theme="dark"] .sort-button.active,
:root[data-theme="dark"] .swap-menu-button.active {
  color: #808080;
}

:root[data-theme="dark"] .color-picker-button {
  color: #808080;
  background:
    linear-gradient(#1a1a1a, #1a1a1a) padding-box,
    conic-gradient(#4d4d4d, #808080, #4d4d4d, #1a1a1a, #4d4d4d, #808080) border-box;
}

:root[data-theme="dark"] input[type="range"] {
  height: 16px;
  appearance: none;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    #4d4d4d 0 var(--range-progress),
    #808080 var(--range-progress) 100%
  ) center / 100% 6px no-repeat;
}

:root[data-theme="dark"] input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border: 1px solid #4d4d4d;
  border-radius: 999px;
  background: transparent;
}

:root[data-theme="dark"] input[type="range"]::-webkit-slider-thumb {
  width: 22px;
  height: 22px;
  margin-top: -9px;
  appearance: none;
  border: 2px solid #808080;
  border-radius: 50%;
  background: #4d4d4d;
}

:root[data-theme="dark"] input[type="range"]::-moz-range-track {
  height: 6px;
  border: 1px solid #4d4d4d;
  border-radius: 999px;
  background: transparent;
}

:root[data-theme="dark"] input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: 2px solid #808080;
  border-radius: 50%;
  background: #4d4d4d;
}

:root[data-theme="dark"] :is(
  .tool-button,
  .file-picker,
  .primary-button,
  .secondary-button,
  .icon-button,
  .icon-small-button,
  .text-toggle,
  .mode-button,
  .sort-button,
  .swap-menu-button
):not(:disabled):hover {
  color: #1a1a1a;
  background: #808080;
  border-color: #808080;
  filter: none;
}

:root[data-theme="dark"] :is(.clear-button, .undo-button):not(:disabled):hover {
  background: transparent;
  border-color: transparent;
  filter: brightness(0.92) saturate(1.08);
}

:root[data-theme="violet"] {
  color-scheme: dark;
  --ink: #b8f4f2;
  --paper: #07052f;
  --panel: #211052;
  --line: #44206c;
  --accent: #922b91;
  --accent-strong: #10c0e0;
  --danger: #641d68;
  --shadow: 0 18px 45px rgba(2, 2, 36, 0.55);
  --theme-surface: rgba(19, 10, 62, 0.94);
  --theme-soft: #211052;
  --theme-border: #44206c;
}

:root[data-theme="sunset"] {
  color-scheme: dark;
  --ink: #d7f3ee;
  --paper: #062c3c;
  --panel: #0a4457;
  --line: #126c83;
  --accent: #f48470;
  --accent-strong: #ffe0aa;
  --danger: #bd5e62;
  --shadow: 0 18px 45px rgba(1, 27, 39, 0.5);
  --theme-surface: rgba(5, 48, 65, 0.94);
  --theme-soft: #0a4457;
  --theme-border: #126c83;
}

:root[data-theme="violet"] body {
  background:
    radial-gradient(circle at 52% 8%, rgba(16, 192, 224, 0.28), transparent 28%),
    linear-gradient(150deg, #05042a 0%, #161052 56%, #3b125f 100%);
}

:root[data-theme="sunset"] body {
  background:
    radial-gradient(circle at 50% 12%, rgba(244, 132, 112, 0.24), transparent 26%),
    linear-gradient(150deg, #041f2d 0%, #0a4d62 58%, #126c83 100%);
}

:root:is([data-theme="violet"], [data-theme="sunset"]) .left-rail,
:root:is([data-theme="violet"], [data-theme="sunset"]) .settings-panel {
  background: var(--theme-surface);
  border-color: var(--theme-border);
}

:root:is([data-theme="violet"], [data-theme="sunset"]) .workspace,
:root:is([data-theme="violet"], [data-theme="sunset"]) #cropCanvas,
:root:is([data-theme="violet"], [data-theme="sunset"]) #fileCropCanvas {
  border-color: var(--theme-border);
  background: var(--paper);
}

:root:is([data-theme="violet"], [data-theme="sunset"]) .panel-header p,
:root:is([data-theme="violet"], [data-theme="sunset"]) .control-row label,
:root:is([data-theme="violet"], [data-theme="sunset"]) .library-header span,
:root:is([data-theme="violet"], [data-theme="sunset"]) .library-name,
:root:is([data-theme="violet"], [data-theme="sunset"]) .library-empty {
  color: var(--ink);
}

:root:is([data-theme="violet"], [data-theme="sunset"]) .secondary-button,
:root:is([data-theme="violet"], [data-theme="sunset"]) .icon-small-button,
:root:is([data-theme="violet"], [data-theme="sunset"]) .sort-button,
:root:is([data-theme="violet"], [data-theme="sunset"]) .swap-menu-button,
:root:is([data-theme="violet"], [data-theme="sunset"]) .icon-button,
:root:is([data-theme="violet"], [data-theme="sunset"]) .sort-toggle {
  color: var(--ink);
  background: var(--theme-soft);
  border-color: var(--theme-border);
}

:root:is([data-theme="violet"], [data-theme="sunset"]) .folder-path-input,
:root:is([data-theme="violet"], [data-theme="sunset"]) .library-item {
  color: var(--ink);
  background: color-mix(in srgb, var(--theme-soft) 82%, black);
  border-color: var(--theme-border);
}

:root:is([data-theme="violet"], [data-theme="sunset"]) .library-panel,
:root:is([data-theme="violet"], [data-theme="sunset"]) .text-toggle,
:root:is([data-theme="violet"], [data-theme="sunset"]) .mode-button,
:root:is([data-theme="violet"], [data-theme="sunset"]) .color-swatch {
  border-color: var(--theme-border);
}

:root .icon-button:not(:disabled):hover {
  color: var(--panel);
  background: var(--ink);
  border-color: var(--ink);
}

@media (max-width: 520px) {
  .settings-panel {
    grid-template-columns: 1fr;
  }

  .library-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
