:root {

  /* MAINTAIN */
  /* Color theme */
  --light-mode-bg-color: #eff1f5; /* Base */
  --light-mode-fg-color: #4c4f69; /* Text */
  /* Bold color */
  --light-mode-bold: #1e66f5; /* Blue */
  --dark-mode-bold: #8caaee; /* Blue */

  /* PC Font sizes */
  --pc-main-font-size: 16px;
  --pc-main-def-size: 20px;
  --pc-vocab-font-size: 85px;
  --pc-back-vocab-font-size: 60px;
  --pc-sentence-font-size: 52px;
  --pc-back-sentence-font-size: 35px;
  --pc-hint-font-size: 38px;
  --pc-info-font-size: 23px;

  /* Mobile font sizes */
  --mobile-main-font-size: 16px;
  --mobile-main-def-size: 16px;
  --mobile-vocab-font-size: 70px;
  --mobile-back-vocab-font-size: 32px;
  --mobile-sentence-font-size: 38px;
  --mobile-back-sentence-font-size: 24px;
  --mobile-hint-font-size: 24px;
  --mobile-info-font-size: 16px;

  /* Miscellaneous */
  --font-serif: "Hiragino Mincho ProN", "Noto Serif CJK JP", "Yu Mincho", HanaMinA, HanaMinB, serif;
  --font-sans: "Inter", "SF Pro Display", "Liberation Sans", "Segoe UI", "Hiragino Kaku Gothic ProN", "Noto Sans CJK JP", "Meiryo", HanaMinA, HanaMinB, sans-serif;
  --light-mode-image-brightness: 85%;
  --dark-mode-image-brightness: 80%;
  --def-picture-size: 200px;
  --max-width: 800px;

  /* MAINTAIN */
  --light-mode-tooltip-hover-color: rgba(220, 224, 232, 0.9); /* Crust */
  --dark-mode-tooltip-hover-color: rgba(35, 38, 52, 0.9); /* Crust */


  /* See https://github.com/donkuri/lapis/tree/main/docs/user_settings.md for an overview of these variables */
  --main-picture-position: "right"; /* "right", "left" */
  --sentence-furigana: "hover"; /* "hover", "always", "off" */
  --sentence-position: "above"; /* "above", "below" the definition box*/
  --mobile-sentence-position: "below";
  --mobile-audio-buttons: "default"; /* "default", "header" (inside vocabulary box) */
  --nsfw-blur-contained: "off"; /* "on", "off" */
  --open-misc-info: "off"; /* "on", "off" */
  --glossary-separator: "off"; /* "on" to separate dictionaries in definition box */
  --jitendex-format: "full"; /* "minimal" or space-separated list of "no-tags", "no-sentence", "no-forms", "no-xref", "no-img" */

  /* MAINTAIN */
  /* Pitch colors */
  --dark-mode-heiban: #99d1db; /* Sky */
  --dark-mode-atamadaka: #e78284; /* Red */
  --dark-mode-nakadaka: #ef9f76; /* Peach */
  --dark-mode-odaka: #a6d189; /* Green */
  --dark-mode-kifuku: #ca9ee6; /* Mauve */
  --light-mode-heiban: #04a5e5; /* Sky */
  --light-mode-atamadaka: #d20f39; /* Red */
  --light-mode-nakadaka: #fe640b; /* Peach */
  --light-mode-odaka: #40a02b; /* Green */
  --light-mode-kifuku: #8839ef; /* Mauve */

  font-size: var(--main-font-size);
}

.card {
  background-color: var(--bg-color) !important;
  color: var(--fg-color) !important;
}

  /* MAINTAIN */
.card.nightMode {
  --bg-color: #303446; /* Base */
  --fg-color: #c6d0f5; /* Text */
  --bg-elevated: rgba(98, 104, 128, 0.12); /* Surface 2 */
  --bg-inset: #b5bfe2; /* Subtext 1 */
  --fg-subtle: #b5bfe2; /* Subtext 1 */

  --heiban: var(--dark-mode-heiban, initial);
  --atamadaka: var(--dark-mode-atamadaka, initial);
  --nakadaka: var(--dark-mode-nakadaka, initial);
  --odaka: var(--dark-mode-odaka, initial);
  --kifuku: var(--dark-mode-kifuku, initial);
  --bold: var(--dark-mode-bold, #7d8590);

  --image-brightness: var(--dark-mode-image-brightness);
  --tooltip-hover-color: var(--dark-mode-tooltip-hover-color);

  /* Code for 明鏡 第三版 by kiwakiwaa
    and can be found here https://github.com/kiwakiwaa/vertical-cards?tab=readme-ov-file#my-yomitan-dictionaries */
  --meikyo-white: #000000;
  --meikyo-black: #cccccc;
  --meikyo-blue: #33ccff;
  --meikyo-red: #ff3333;
  --meikyo-gray: #bbbbbb;
  --meikyo-pink: #cc6666;
  --meikyo-dark-red: #993333;
  --meikyo-fbox-white: #ffffff;
  --meikyo-fbox-gray: #cccccc;
  --meikyo-box-gray: #663333;
  /* Support for oubunsha kogo */
  --ozk5-blue: #00aaff;
  --ozk5-red: #ff6666;
  --ozk5-light-red: #b24747;
  --ozk5-gray: #888;
  --ozk5-hinshi-mark: #cccccc;
  --ozk5-kakomi-border: #888;
  --ozk5-metadata-background: #888;
  --ozk5-example-katsuyou-mark: #aaaaaa;
  --ozk5-mark-border: #acac04;
  --ozk5-gogi-panel-header: #331414;
  --ozk5-ruigo-panel-background: #cccccc;
  --ozk5-ruigo-panel-border: #777;
  --ozk5-appendix-title-background: #bf6666;
  --ozk5-gendai-mark: #cccccc;
  /* --background-color: #1e1e1e; */

  /* Support for sanseido kogo */
  --skogo-blue: #00aaff;
  --skogo-red: #ff6666;
  --skogo-light-red: #a54447;
  --skogo-extra-light-red: #481d1e;
  --skogo-hinshi-mark: #cccccc;
  --skogo-shubetsu-mark: #cccccc;
  --skogo-gendai-mark: #cccccc;
}

/* MAINTAIN */
.android .nightMode {
  --bg-color: #303446; /* Base */
  --fg-color: #c6d0f5; /* Text */
}

.android .nightMode:not(.ankidroid_dark_mode) {
  /* make it brighter since bg is black */
  --bg-elevated: rgba(98, 104, 128, 0.12); /* Surface 2 */
}

.android .nightMode.ankidroid_dark_mode {
  --bg-color: #303446; /* Base */
}

.card:not(.nightMode) {
  --bg-color: var(--light-mode-bg-color);
  --fg-color: var(--light-mode-fg-color);
  --heiban: var(--light-mode-heiban, initial);
  --atamadaka: var(--light-mode-atamadaka, initial);
  --nakadaka: var(--light-mode-nakadaka, initial);
  --odaka: var(--light-mode-odaka, initial);
  --kifuku: var(--light-mode-kifuku, initial);

  --bg-elevated: #acb0be; /* Surface 2 */
  --bg-inset: #5c5f77; /* Subtext 1 */
  --fg-subtle: #5c5f77; /* Subtext 1 */
  --bold: var(--light-mode-bold, #999999);

 /* BREAK */

  --image-brightness: var(--light-mode-image-brightness);
  --tooltip-hover-color: var(--light-mode-tooltip-hover-color);

  /* Code for 大辞泉 二版 by kiwakiwaa
    and can be found here https://github.com/kiwakiwaa/vertical-cards?tab=readme-ov-file#my-yomitan-dictionaries */
  --daijisen-black: #ffffff;
  --daijisen-white: #000000;
  --daijisen-blue: #00aaff;
  --daijisen-header-djs: #a0484f;
  --daijisen-header-djsp: #7a7a7a;
  --daijisen-header-text: #000000;
  --daijisen-logo-color: #dddddd;
  --daijisen-background-l3: #c0c0c0;
  --daijisen-accent-mark: #ff6666;
  --daijisen-accent-slash: #a0a0a0;

  --ozk5-blue: #4a8ade;
  --ozk5-red: #c00000;
  --ozk5-light-red: #d96666;
  --ozk5-gray: #888;
  --ozk5-hinshi-mark: #444;
  --ozk5-kakomi-border: #999;
  --ozk5-metadata-background: #999;
  --ozk5-example-katsuyou-mark: #666;
  --ozk5-mark-border: #660;
  --ozk5-gogi-panel-header: #f9e6e6;
  --ozk5-ruigo-panel-background: #444;
  --ozk5-ruigo-panel-border: #aaa;
  --ozk5-appendix-title-background: #633;
  --ozk5-gendai-mark: #888;
  /* --background-color: #f5f5f5; */

  --skogo-blue: #4a8ade;
  --skogo-red: #c00000;
  --skogo-light-red: #dfa6a8;
  --skogo-extra-light-red: #ffeeee;
  --skogo-hinshi-mark: #444;
  --skogo-shubetsu-mark: #707070;
  --skogo-gendai-mark: #888;
}

html.win,
html.mac,
html.linux:not(.android) {
  --main-font-size: var(--pc-main-font-size);
  --main-def-size: var(--pc-main-def-size);
  --vocab-font-size: var(--pc-vocab-font-size);
  --back-vocab-font-size: var(--pc-back-vocab-font-size);
  --sentence-font-size: var(--pc-sentence-font-size);
  --back-sentence-font-size: var(--pc-back-sentence-font-size);
  --hint-font-size: var(--pc-hint-font-size);
  --info-font-size: var(--pc-info-font-size);
}

html.mobile {
  --main-font-size: var(--mobile-main-font-size);
  --main-def-size: var(--mobile-main-def-size);
  --vocab-font-size: var(--mobile-vocab-font-size);
  --back-vocab-font-size: var(--mobile-back-vocab-font-size);
  --sentence-font-size: var(--mobile-sentence-font-size);
  --back-sentence-font-size: var(--mobile-back-sentence-font-size);
  --hint-font-size: var(--mobile-hint-font-size);
  --info-font-size: var(--mobile-info-font-size);
}

#qa {
  display: flex;
  align-items: stretch;
  flex-direction: column;
  min-height: calc(100vh - 40px);
  font-family: var(--font-serif);
  font-size: var(--main-font-size);
  text-align: center;
}

/* ------- Mobile css ------- */
@media (max-width: 512px) {
  .images-container {
    justify-content: space-around;
    flex-direction: row !important;
    max-width: 100% !important;
    width: 100%;
    flex-wrap: wrap;
  }

  .images-container img {
    width: 44%;
  }

  .img-popup-container {
    max-width: 100vw;
    max-height: 60vh;
  }

  .img-popup-img {
    object-fit: contain;
  }
}

@media (min-width: 768px) and (max-width: 1024px) {
  .img-popup-container {
    max-height: 70vh;
  }

  .img-popup-img {
    object-fit: contain;
  }
}

/* ----- Front elements ----- */

.front-vocab {
  font-size: var(--vocab-font-size);
  line-height: 1.5;
}

.front-sentence {
  font-size: var(--sentence-font-size);
  display: inline-block;
  line-height: 1.5;
}

#hint {
  font-size: var(--hint-font-size);
  margin-top: -5px;
  line-height: 1.5;
}

#click {
  user-select: none;
}

#click .front-vocab {
  display: inline-block;
  line-height: 1.2;
  margin-bottom: 20px;
  border-bottom: 2px dotted var(--fg-subtle);
}

/* ----- Back elements ----- */

/* Vocab on the back (for mobile) */
.vocab {
  line-height: 1.5;
  font-size: var(--back-vocab-font-size);
}

a {
  color: #3b82f6 !important;
}

.nightMode a {
  color: #93c5fd !important;
}

/* Header */
header {
  color: var(--fg-subtle);
  height: 40px;
  text-align: right;
  width: 100%;
  font-size: 1rem;
}

.top-container {
  font-family: var(--font-sans);
  max-width: calc(var(--max-width) + 20px);
  margin: 0px auto;
  width: calc(100% - 20px);
  fill: var(--fg-subtle) !important;
  position: relative;
  display: inline-block;
}

.freq-dropdown {
  cursor: pointer;
}

.freq-list-container {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  background-color: var(--tooltip-hover-color);
  color: var(--fg-color);
  padding: 10px;
  border-radius: 5px;
  z-index: 1000;
  width: 200px;
}

.freq-list-container ul {
  list-style-type: none;
  line-height: 1.5;
  margin: 0;
  padding: 0;
}

.freq-dropdown:hover .freq-list-container {
  display: block;
}

main {
  width: min(var(--max-width), calc(100% - 20px));
  margin-inline: auto;
}

/* Info (audio, reading) */
.info {
  font-family: var(--font-sans);
  font-size: var(--info-font-size);
  color: var(--fg-color);
}

.mobile .info {
  font-size: 0.9rem;
  padding-top: 7px;
}

/* Replay button */
.replay-button svg {
  width: 32px;
  height: 32px;
}

.mobile .audio-buttons {
  position: fixed;
  bottom: 0;
  left: 0;
  z-index: 1000;
}

/* Pitch */
.pitch {
  display: inline;
}

#pitch-tags {
  background-color: var(--fg-color);
  color: var(--bg-color);
  font-family: var(--font-sans);
  font-weight: 500;
  display: none;
  vertical-align: top;
  padding: 1px 3px;
  margin-right: -5px;
}

.mobile .nightMode #pitch-tags {
  color: #000 !important;
  background-color: #fff;
}

/* When multiple pitch */
.pitch ul,
#pitch-tags ul {
  list-style: none;
  display: inline;
  margin: 0;
  padding: 0;
}

.pitch li,
#pitch-tags li {
  display: inline;
}

.pitch ul > li:not(:last-child)::after {
  content: "・";
  color: var(--fg-color);
}

#pitch-tags ul > li:not(:last-child)::after {
  content: "・";
  color: var(--bg-color);
  font-size: 0.8em;
}

/* Definition container */
.main-def {
  background-color: var(--bg-elevated);
  font-family: var(--font-sans);
  font-size: var(--main-def-size);
  line-height: 1.75em;
  text-align: left;
  border-left: 5px solid #ccc;
  padding: 0.5em 10px;
  margin: 5px auto;
  overflow: hidden;
  position: relative;
}

.main-def ol {
  margin-block: 0em;
}

/* Definition info display */
.def-info {
  font-family: var(--font-sans);
  color: var(--fg-subtle);
  font-size: 0.9rem;
  text-align: right;
  pointer-events: none;
  visibility: hidden;
}

.mobile .def-info {
  margin-bottom: -5px;
}

/* MainDefinition */
.definition {
  text-align: left;
  width: fit-content;
  max-width: 100%;
}

/* Definition toggle css */
.edge {
  position: absolute;
  top: 0;
  width: 50px;
  height: 100%;
  cursor: pointer;
  opacity: 0.4;
}

.edge:hover {
  background-color: var(--bg-inset);
}

#edge-prev {
  left: 0;
  border-radius: 8px 0px 0px 8px;
}

#edge-next {
  right: 0;
  border-radius: 0px 8px 8px 0px;
}

/* Hide edges when not needed */
.edge:has(~ .definition > :last-child:first-child) {
  display: none;
}

/* Primary Image */
.image img {
  max-height: 400px;
  width: auto;
  border-radius: 5px;
  cursor: pointer;
  transition: filter 0.3s;
}

.image img:hover,
.def-image img:hover {
  filter: brightness(var(--image-brightness));
}

/* Definition Image(s) */
.def-image {
  float: right;
  margin-left: 10px;
  max-width: min(35%, var(--def-picture-size));
  display: flex;
  flex-flow: column nowrap;
  justify-content: flex-start;
  gap: 10px;
}

.def-image img {
  object-fit: contain;
  max-height: var(--def-picture-size);
  border-radius: 3px;
  cursor: pointer;
  transition: filter 0.3s;
}

.def-image ol {
  list-style-type: none;
  padding: 0;
  margin: 0;
}

/* Image modal css */
.modal-bg {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background-color: rgba(0, 0, 0, 0.8);
  z-index: 1000;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.3s ease,
    visibility 0.3s ease;
}

.modal-bg.active {
  opacity: 1;
  visibility: visible;
}

.img-popup-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(calc(100% - 20px), calc(var(--max-width) + 200px));
  z-index: 1001;
  overflow: hidden;
  display: flex;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.3s ease,
    visibility 0.3s ease;
}

.img-popup-container.active {
  opacity: 1;
  visibility: visible;
}

.img-popup-img {
  width: auto;
  height: auto;
  margin: 0 auto;
  transition: transform 0.3s ease;
}

/* Hide NFSW Images -- make sure you use the tag `NSFW` EXACTLY */
.NSFW img,
.nsfw img,
.Nsfw img {
  filter: blur(30px);
  transition: filter 0.2s;

  &:hover {
    filter: blur(0px);
  }
}

/* Back sentence */
.sentence,
.sentence-mobile {
  line-height: 1.5;
  font-size: var(--back-sentence-font-size);
  display: inline-block;

  /* show furigana on hover */
  & rt {
    visibility: hidden;
  }

  & ruby:hover rt {
    visibility: visible;
  }
}

.mobile .sentence,
html:not(.mobile) .sentence-mobile {
  display: none;
}

/* Footer */
footer {
  margin-top: auto;
  width: 100%;
}

.bot-container {
  display: flex;
  justify-content: flex-end;
  max-width: calc(var(--max-width) + 20px);
  margin: 0px auto;
  width: calc(100% - 20px);
}

.tags-container {
  flex-grow: 1;
}

.tags-container .tags {
  min-height: 1.6em;
}

.tags {
  font-family: var(--font-sans);
  background-color: var(--bg-elevated);
  color: var(--fg-color);
  display: inline-grid;
  place-items: center;
  padding: 1px 5px;
  cursor: pointer;
  border-radius: 5px;
  font-size: 0.9rem;
  margin: auto 3px;
  text-overflow: ellipsis;
  overflow: hidden;
  max-width: 60dvw;
  white-space: nowrap;
}

.mobile .tags {
  padding: 1px 3px;
  font-size: 9px;
}

/* Definition Header */
.def-header {
  display: flex;
  font-size: 30px;
  justify-content: center;
  align-items: center;
  max-width: 820px;
  margin-inline: auto;
  position: relative;
  gap: min(20px, 2vw);
}

.dh-left {
  /* left */
  background: var(--bg-elevated);
  padding: 0.52em;
  border-radius: 5px;
  flex: 1;
  /* takes up all available space */
}

.dh-right {
  max-width: 400px;
  position: relative;
  font-size: 0;
  /* weird hack needed to make the image stay in line with the .def-header */
}

.mobile .dh-left {
  background: none;
  padding: 0em;
  border-radius: 0px;
}

.mobile .dh-left:has(~ .dh-right) {
  max-width: 60vw;
}

.mobile .dh-right {
  max-width: 40vw;
}

/* Misc. info */
.misc-info {
  font-family: var(--font-sans);
  background-color: var(--bg-elevated);
  border-radius: 8px;
  padding: 10px;
  margin: 0 auto;
}

.misc-info ul {
  margin: 0;
}

/* ----- Misc ----- */

/* Furigana */
ruby rt {
  user-select: none;
}

/* Bold */
b {
  color: var(--bold);
  font-weight: 600;
}

.mobile b {
  font-weight: 400;
}

/* Hide scrollbar */
.card {
  -ms-overflow-style: none;
  scrollbar-width: 0;

  &::-webkit-scrollbar {
    display: none;
  }
}

/* Dropdown */
details {
  font-family: var(--font-sans);
  margin: 5px 0px;
}

summary {
  user-select: none;
  cursor: pointer;
  margin: 0px auto;
}

/* Pitch graphs css */
.pitch-low {
  position: relative;
}

.pitch-high {
  position: relative;
}

.pitch-high > .pitch-line {
  display: block;
  position: absolute;
  top: -0.1em;
  left: 0;
  right: 0;
  height: 0;
  border-top-width: 0.1em;
  border-top-style: solid;
}

.pitch-to-drop {
  position: relative;
  padding-right: 0.1em;
  margin-right: 0.1em;
}

.pitch-to-drop > .pitch-line {
  display: block;
  position: absolute;
  top: -0.1em;
  left: 0;
  right: 0;
  border-top-width: 0.1em;
  border-top-style: solid;
  right: -0.1em;
  height: 0.4em;
  border-right-width: 0.1em;
  border-right-style: solid;
}

/* Pitch coloring */
.heiban {
  color: var(--heiban);
}

.atamadaka {
  color: var(--atamadaka);
}

.nakadaka {
  color: var(--nakadaka);
}

.odaka {
  color: var(--odaka);
}

.kifuku {
  color: var(--kifuku);
}

/* Format Definitions */
ul[data-sc-content="glossary"] > li:not(:first-child)::before {
  white-space: pre-wrap;
  content: " | ";
  display: inline;
}

ul[data-sc-content="glossary"] > li {
  display: inline;
}

ul[data-sc-content="glossary"] {
  display: inline;
  list-style: none;
  padding-left: 0;
}

[data-sc-content="glossary"] ~ ul,
[data-sc-content="glossary"] ~ div {
  line-height: normal;
}

[data-sc-content="attribution"],
[data-sc-content="graphic-attribution"] {
  display: none;
}

/* reduce indentations of Jitendex for mobile */
.mobile li[data-dictionary^="Jitendex"] ul,
.mobile li[data-dictionary^="Jitendex"] ol,
.mobile li[data-details^="Jitendex"] ul,
.mobile li[data-details^="Jitendex"] ol {
  padding-left: 0.3em;
}

/* Turn off italics */
.definition i {
  font-style: normal;
}

li[data-dictionary^="JMdict"] i {
  font-style: italic;
}

.definition a span {
  max-width: 300px !important;
}

.definition .hidden {
  display: none;
}

/* Prevent wrapping in the middle of a Jitendex tags */
span[data-sc-code] {
  white-space: nowrap;
}

/* backwards compatibility code for JPMN definitions */
li[data-details="JMdict (English)"] .dict-group__glossary > ul,
li[data-details="JMdict (English)"]
  .dict-group__glossary
  ul[data-sc-content="glossary"],
li[data-details="JMdict"] .dict-group__glossary > ul,
li[data-details="JMdict"] .dict-group__glossary ul[data-sc-content="glossary"],
li[data-details="JMdict Extra"] .dict-group__glossary > ul,
li[data-details="JMdict Extra"]
  .dict-group__glossary
  ul[data-sc-content="glossary"] {
  display: inline;
  padding-left: 0em;
}

li[data-details="JMdict (English)"] .dict-group__glossary > ul > li,
li[data-details="JMdict (English)"]
  .dict-group__glossary
  ul[data-sc-content="glossary"]
  > li,
li[data-details="JMdict"] .dict-group__glossary > ul > li,
li[data-details="JMdict"]
  .dict-group__glossary
  ul[data-sc-content="glossary"]
  > li,
li[data-details="JMdict Extra"] .dict-group__glossary > ul > li,
li[data-details="JMdict Extra"]
  .dict-group__glossary
  ul[data-sc-content="glossary"]
  > li {
  display: inline;
  padding-right: 0em;
  margin-right: 0em;
}

li[data-details="JMdict (English)"] .dict-group__glossary > ul > li::after,
li[data-details="JMdict (English)"]
  .dict-group__glossary
  ul[data-sc-content="glossary"]
  > li::after,
li[data-details="JMdict"] .dict-group__glossary > ul > li::after,
li[data-details="JMdict"]
  .dict-group__glossary
  ul[data-sc-content="glossary"]
  > li::after,
li[data-details="JMdict Extra"] .dict-group__glossary > ul > li::after,
li[data-details="JMdict Extra"]
  .dict-group__glossary
  ul[data-sc-content="glossary"]
  > li::after {
  content: " | ";
  white-space: pre-wrap;
}

li[data-details="JMdict (English)"]
  .dict-group__glossary
  > ul
  > li:last-of-type:after,
li[data-details="JMdict (English)"]
  .dict-group__glossary
  ul[data-sc-content="glossary"]
  > li:last-of-type:after,
li[data-details="JMdict"] .dict-group__glossary > ul > li:last-of-type:after,
li[data-details="JMdict"]
  .dict-group__glossary
  ul[data-sc-content="glossary"]
  > li:last-of-type:after,
li[data-details="JMdict Extra"]
  .dict-group__glossary
  > ul
  > li:last-of-type:after,
li[data-details="JMdict Extra"]
  .dict-group__glossary
  ul[data-sc-content="glossary"]
  > li:last-of-type:after {
  display: none;
}

/*
 * customization for specific dictionaries
 */
/* Makes JMdict italic */
ol li[data-details="JMdict (English)"] .dict-group__tag-list,
ol li[data-details="JMdict"] .dict-group__tag-list,
ol li[data-details="JMdict Extra"] .dict-group__tag-list {
  font-style: italic;
}

/* removes the dictionary entry for jmdict */
ol
  li[data-details="JMdict (English)"]
  .dict-group__tag-list
  .dict-group__tag--dict,
ol li[data-details="JMdict"] .dict-group__tag-list .dict-group__tag--dict,
ol
  li[data-details="JMdict Extra"]
  .dict-group__tag-list
  .dict-group__tag--dict {
  display: none;
}

/* Makes Nico/Pixiv italic */
ol li[data-details="Nico/Pixiv"] .dict-group__tag-list {
  font-style: italic;
}

/* Removes the extra text for the collapsed 新和英 display */
ol
  li[data-details="新和英"]
  details.glossary-text__details
  .glossary-text__summary
  .dict-group__glossary--first-line {
  display: none;
}

/*
 * --------------------
 *  dictionary entries
 * --------------------
 */
.dict-group__tag-list .dict-group__tag:not(:first-child)::before {
  content: ", ";
}

.dict-group__tag-list::before {
  content: "(";
}

.dict-group__tag-list::after {
  content: ") ";
}

.definition ol:has(> li[data-dictionary]),
.definition ol:has(> li[data-details]) {
  padding-inline-start: 1.3em;
}

/* Removes list numbering when only one list element  */
.definition ol:has(> li[data-dictionary]:only-of-type),
.definition ol:has(> li[data-details]:only-of-type) {
  list-style-type: none;
  padding-inline-start: 0;
}

/* Better formatting meikyo 3rd edition */
li[data-dictionary="明鏡国語辞典 第三版"] span {
  width: 25em !important;
  vertical-align: bottom !important;
}

li[data-dictionary="明鏡国語辞典 第三版"]
  div:has(> span[data-sc-class="品格"]) {
  margin-bottom: 5px !important;
}

li[data-dictionary="明鏡国語辞典 第三版"] [data-sc-body] {
  font-size: var(--main-def-size) !important;
}

/* Formatting for sanseido kogo dict */
li[data-dictionary="三省堂 全訳読解古語辞典"] span[data-sc-body] {
  line-height: 1.4em;
}
[data-dictionary="三省堂 全訳読解古語辞典"] span[data-sc-rectr][data-sc-fill] {
  color: #f5f5f5 !important;
}
.nightMode
  [data-dictionary="三省堂 全訳読解古語辞典"]
  span[data-sc-rectr][data-sc-fill] {
  color: #1e1e1e !important;
}

/* Formatting for oubunsha kogo dict */
li[data-dictionary="旺文社 全訳古語辞典"] [data-sc-audio_play_button],
li[data-dictionary="旺文社 全訳古語辞典"] [data-sc-audio_stop_button] {
  display: none !important;
}
li[data-dictionary="旺文社 全訳古語辞典"] div[data-sc用例囲み-g],
li[data-dictionary="旺文社 全訳古語辞典"] div[data-sc和歌俳句囲み-g],
li[data-dictionary="旺文社 全訳古語辞典"] div[data-sc冒頭文囲み-g],
li[data-dictionary="旺文社 全訳古語辞典"] div[data-sc小倉囲み-g] {
  margin-top: 0 !important;
}
[data-dictionary="旺文社 全訳古語辞典"] span[data-sc-rectr][data-sc-fill] {
  color: #f5f5f5 !important;
}
.nightMode
  [data-dictionary="旺文社 全訳古語辞典"]
  span[data-sc-rectr][data-sc-fill] {
  color: #1e1e1e !important;
}

/*
 *  USER SETTINGS
 *  Please modify the variables on the top of the file.
 */
settings[data-main-picture-position="left"] + #qa .def-header {
  flex-flow: row-reverse;
}

settings[data-sentence-furigana="always"] + #qa .sentence rt,
settings[data-sentence-furigana="always"] + #qa .sentence-mobile rt {
  visibility: visible;
}

settings[data-sentence-furigana="off"] + #qa .sentence rt,
settings[data-sentence-furigana="off"] + #qa .sentence-mobile rt {
  display: none;
}

html.mobile
  settings[data-mobile-sentence-position="above"]
  + #qa
  .sentence-mobile,
html:not(.mobile) settings[data-sentence-position="below"] + #qa .sentence {
  display: none;
}

html.mobile settings[data-mobile-sentence-position="above"] + #qa .sentence,
html:not(.mobile)
  settings[data-sentence-position="below"]
  + #qa
  .sentence-mobile {
  display: block;
}

html.mobile settings[data-mobile-audio-buttons="header"] + #qa .audio-buttons {
  position: static;
}

settings[data-nsfw-blur-contained="on"] + #qa .NSFW,
settings[data-nsfw-blur-contained="on"] + #qa .nsfw,
settings[data-nsfw-blur-contained="on"] + #qa .Nsfw {
  overflow: hidden;
}

settings[data-glossary-separator="on"] + #qa .definition {
  & li[data-dictionary]:not(:last-of-type),
  & li[data-details]:not(:last-of-type) {
    border-bottom: 1px dashed var(--fg-subtle);
  }
}

settings[data-jitendex-format~="minimal"] + #qa .definition {
  & [data-sc-content]:not([data-sc-content="glossary"]) {
    display: none;
  }
}

settings[data-jitendex-format~="minimal"] + #qa .definition,
settings[data-jitendex-format~="no-tags"] + #qa .definition {
  & [data-sc-code] {
    display: none;
  }
  & ul {
    padding-inline-start: 0px;
    margin-block: 0px;
    & > li::marker {
      content: "";
    }
  }
}

settings[data-jitendex-format~="no-sentence"] + #qa .definition {
  & [data-sc-content|="example-sentence"] {
    display: none;
  }
}

settings[data-jitendex-format~="no-forms"] + #qa .definition {
  & [data-sc-content="forms"] {
    display: none;
  }
}

settings[data-jitendex-format~="no-xref"] + #qa .definition {
  & [data-sc-content|="xref"] {
    display: none;
  }
}

settings[data-jitendex-format~="no-img"] + #qa .definition {
  & [data-sc-content|="graphic"] {
    display: none;
  }
}