/* global parameters */ #card { --max-column-width: 30em; /* max column width for text (~30 kana / ~50 latin characters) */ --spoiler-transition: calc(300ms * var(--global-transition-scale)); /* spoiler hide/unhide transition duration */ --tag-transition: calc(300ms * var(--global-transition-scale)); /* tag hover/tap expand transition duration */ --separator-opacity: 20%; /* opacity of the answer separator */ --separator-weight: 2px; /* layout-dependent width/height of separator */ --spoiler-blur-padding: 4px; /* padding for the spoiler blur box */ --text-block-padding: 1em; /* layout-dependent horizontal/vertical padding for text blocks */ --text-block-margin: 0.5em; /* layout-dependent horizontal/vertical margin for text blocks */ --tag-font-size: 80%; /* font size for card tags */ --subtile-font-size: 75%; /* font size for subtile style (notes, curly braces in translations) */ --subtile-opacity: 50%; /* font opacity for subtile style */ --reading-kana-font-size: var(--native-font-size); /* font size of kana in reading field */ --native-font-size: 1.0rem; /* font size for generic native (latin) text */ --foreign-font-size: 1.5rem; /* font size for generic foreign (japanese) text */ --definition-spacing: 0.75em; /* definition spacing (mobile vertical only) */ --definition-marker-width: 2em; /* definition marker width (mobile vertical only) */ --definition-marker-height: 2px; /* definition marker height (mobile vertical only) */ --definition-marker-opacity: 50%; /* definition marker opacity (mobile vertical only) */ --indicator-stroke-weight: 1px; /* pitch accent / word type indicator stroke weight */ --sentence-highlight-contrast: 80%; /* opacity of non-highlighted text in sentence */ --global-transition-scale: 1.0; /* transition duration multiplier */ --indicator-opacity: 50%; /* opacity of indicators in translations (word type) */ --pitch-accent-opacity: 70%; /* opacity of pitch accent indicator in reading field */ } .mobile #card { --text-block-padding: 0.5em; --native-font-size: 1.10rem; --foreign-font-size: 1.75rem; --indicator-stroke-weight: 1.2pt; } /* no transitions (accessibility) */ @media (prefers-reduced-motion) { #card { --global-transition-scale: 0; } } /* high-contrast (accessibility) */ @media (prefers-contrast: more) { .spoiler.hidden .inner { opacity: 100% !important; } .spoiler.hidden .outer::after { opacity: 40% !important; } .spoiler:not(.inline) .outer, .spoiler.inline { border: 2px solid currentColor; } .spoiler.inline { margin: -2px; } .subtile::before { content: "("; } .subtile::after { content: ")"; } #card { --subtile-opacity: 100%; --separator-opacity: 100%; --separator-weight: 4px; --indicator-opacity: 100%; --sentence-highlight-contrast: 100%; --pitch-accent-opacity: 100%; } .night_mode #target-word-reading .indicator::before { background-color: transparent !important; box-shadow: inset 0 0 0 2px currentColor; opacity: 100% !important; } #card #back #tags { opacity: 1 !important; } #tags .tag { background-color: currentColor !important; } #tags .tag .inner { padding-left: 0; } #card #back #tags:active .tag .inner, #card #back #tags:hover .tag .inner { padding-left: 1em; } #tags .tag .inner:before { background: var(--tag-color-dark); } .night_mode #tags .tag .inner:before { background: var(--tag-color-light); } #tags .tag .inner:before { position: absolute; left: 0.25em; top: 50%; content: ""; width: 1em; height: 1em; border-radius: 99999px; transform: translate(-50%,-50%); } } /* default fonts */ body { font-family: "Inter", "Hiragino Kaku Gothic ProN", sans-serif; font-weight: 400; } /* increase contrast of highlighted word */ #card #sentence:has(b) > * { opacity: var(--sentence-highlight-contrast); } #card #sentence > b { opacity: 100%; } /* body margin */ body { margin: 0; width: 100vw; height: 100vh; } /* remove AnkiDroid margin (causes little overscroll) */ .mobile #content { margin: 0; } /* vertical center card in body */ body { display: flex; flex-direction: column; justify-content: center; } /* default font sizes (desktop) */ #card .foreign { font-size: var(--foreign-font-size); } #card .native { font-size: var(--native-font-size); } /* default text alignment and layout */ #card { text-align: center; } #card > * > span { display: block; } /* separator defaults */ #separator { border: none; opacity: var(--separator-opacity); margin: 0; background-color: currentColor; } /* separator size */ #card.horizontal-layout #separator { height: var(--separator-weight); } #card.vertical-layout #separator { width: var(--separator-weight); } /* hide answer and separator on card front */ #card.front #back, #card.front hr, #card.front ruby rt.hidden { display: none !important; } /* extra space above complete translated sentence */ #card #back #sentence-translation { margin-top: 2em; } /* blur spoiler */ .spoiler { cursor: pointer; } .spoiler .outer { margin: 0 auto; display: inline-block; position: relative; border-radius: 8px; overflow: hidden; padding: var(--spoiler-blur-padding); } .spoiler .outer::after { content: ""; position: absolute; inset: 0; background-color: gray; } .spoiler .inner { transition-property: filter, opacity; transition-duration: var(--spoiler-transition); } .spoiler.hidden .inner { filter: blur(0.6rem); opacity: 75%; } .spoiler.visible .inner { filter: blur(0rem); opacity: 100%; } .spoiler .outer::after { transition: opacity var(--spoiler-transition); } .spoiler.hidden .outer::after { opacity: 25%; } .spoiler.visible .outer::after { opacity: 0%; } /* inline spoilers */ .spoiler.inline { overflow: hidden; border-radius: 4px; display: inline-block; vertical-align: text-bottom; } .spoiler.inline .outer { padding: 0; display: inline; } /* fill display horizontally or vertically */ #card.horizontal-layout { width: 100vw; } #card.vertical-layout { height: 100vh; } /* grid column layout for vertical card layout */ #card.vertical-layout > * { grid-row: 1; } #card.vertical-layout { display: grid; grid-auto-columns: 1fr auto auto; } #card.vertical-layout #back { flex-direction: column; } #card.vertical-layout #back, #card.vertical-layout #front { display: flex; justify-content: center; } /* grid column settings */ #card.vertical-layout #back { grid-column: 1; } #card.vertical-layout #separator { grid-column: 2; } #card.vertical-layout #front { grid-column: 3; } /* default text element spacing */ #card.horizontal-layout > * > span, #card.vertical-layout > #back > span { padding: 0 var(--text-block-padding); margin: var(--text-block-margin) auto; } #card.vertical-layout #sentence { padding: var(--text-block-padding) 0; margin: auto var(--text-block-margin); } /* vertical japanese text only in sentence */ #card.vertical-layout #sentence { writing-mode: vertical-rl; } /* max text column width (~30 characters in japanese, ~50 in latin) */ #card.vertical-layout > #front > #sentence { max-height: var(--max-column-width); } #card.horizontal-layout > * > span, #card.vertical-layout > #back > span { max-width: var(--max-column-width); margin-left: auto; margin-right: auto; } /* display kana reading smaller and below kanji in vertical layout */ #card.vertical-layout #target-word-reading .reading { display: block; font-size: var(--reading-kana-font-size); } /* tag container */ #card #back #tags { font-size: var(--tag-font-size); display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 4px; margin: 2em 0.5em 0.5em 0.5em; max-width: unset; padding: 10px; opacity: 60%; transition: opacity var(--tag-transition); } /* tag style */ #card #back #tags .tag { --tag-color-light: hsl(calc(1deg * var(--tag-hue)), 60%, 20%); --tag-color-dark: hsl(calc(1deg * var(--tag-hue)), 65%, 80%); } #card #back #tags .tag { background-color: var(--tag-color-light); } .night_mode #card #back #tags .tag { background-color: var(--tag-color-dark); } #card #back #tags .tag .inner { color: white; } .night_mode #card #back #tags .tag .inner { color: black; } #card #back #tags .tag { --tag-hue: 0; padding: 4px; border-radius: 999px; margin: 0; transition-property: padding, grid-template-rows, grid-template-columns; transition-duration: var(--tag-transition); overflow: hidden; display: grid; grid-template-rows: 0fr; grid-template-columns: 0fr; justify-content: center; align-items: center; } #card #back #tags .tag .inner { position: relative; opacity: 0; left: 50%; transform: translate(-50%, 0%); transition-duration: var(--tag-transition); transition-property: opacity, padding; white-space: nowrap; min-height: 0; min-width: 0; user-select: none; cursor: default; margin: 0 auto; } /* tag hover/hold expand */ #card #back #tags:active, #card #back #tags:hover { opacity: 1; } #card #back #tags:active .tag .inner, #card #back #tags:hover .tag .inner { opacity: 1; } #card #back #tags:active .tag, #card #back #tags:hover .tag { grid-template-rows: 1fr; grid-template-columns: 1fr; padding: 4px 12px; } /* display tags vertically on mobile */ .mobile #card.vertical-layout #back #tags { flex-direction: column; } .mobile #card.vertical-layout #back #tags .tag { max-width: max-content; } /* make sure to hide empty fields */ .parse.empty { display: none !important; } /* don't break syllables in the reading field on vertical mobile */ .mobile #card.vertical-layout #back #target-word-reading .reading .syllable { white-space: nowrap; } /* subtile style */ .subtile { font-style: italic; opacity: var(--subtile-opacity); font-size: var(--subtile-font-size); vertical-align: baseline; } .subtile .script-japanese { font-style: normal; } /* italic japanese looks weird */ /* word note style */ #card #target-word-reading .kanji { position: relative; } #card #target-word-reading .note { position: absolute; } #card #target-word-reading .note { left: -0.25em; top: 50%; transform: translate(-100%, -50%); } .mobile #card.vertical-layout #target-word-reading .note { top: -0.25em; left: 50%; transform: translate(-50%, -100%); } /* definitions */ #card #target-word-translation .definitions { display: inline; padding: 0; } #card #target-word-translation .definitions .definition, #card #target-word-translation .definitions .definition-separator { list-style: none; display: inline; } /* mobile definitions style */ #card #target-word-translation .definitions .definition-separator::after { content: ", "; } .mobile #card.vertical-layout #target-word-translation .definitions .definition-separator { display: none; } .mobile #card.vertical-layout #target-word-translation .definitions .definition { position: relative; display: block; max-width: max-content; margin: var(--definition-spacing) auto; } .mobile #card.vertical-layout #target-word-translation .definitions .definition:last-child::before { display: none; } .mobile #card.vertical-layout #target-word-translation .definitions .definition::before { content: ""; position: absolute; bottom: calc(-0.5 * var(--definition-spacing)); left: 50%; right: 0px; height: var(--definition-marker-height); width: var(--definition-marker-width); opacity: var(--definition-marker-opacity); border-radius: 999px; background-color: currentColor; transform: translate(-50%, 50%); } /* indicator (word type + defaults) */ .indicator { position: relative; display: inline-block; margin: 0.25em; border: var(--indicator-stroke-weight) solid transparent; } .indicator::after { content: ""; position: absolute; inset: calc(-1 * var(--indicator-stroke-weight)); border-radius: 4px; border: var(--indicator-stroke-weight) solid currentColor; z-index: -1; } .indicator .script-japanese { font-size: 90%; } .indicator .content, .indicator .stamp { display: inline-block; } .indicator .content { margin: 1px 4px; } .indicator .stamp { position: relative; padding: 2px 4px; margin: 1px; font-weight: bold; font-size: 90%; height: 100%; } .indicator .stamp::before { content: ""; position: absolute; inset: 0; border-radius: 2px; z-index: -1; } .indicator .stamp * { display: inline-block; } /* indicator (pitch accent pattern) */ #target-word-reading .indicator::after { border: none; } #target-word-reading .indicator { position: relative; bottom: 1px; /* cancel out margin of .indicator > .content */ font-size: 80%; font-weight: bold; vertical-align: baseline; } #target-word-reading .indicator .content { margin: 1px 6px; } #target-word-reading .indicator::before { border-radius: 6px; content: ""; z-index: -1; position: absolute; inset: 0; opacity: var(--pitch-accent-opacity); } /* theme colors */ #target-word-reading .indicator, .indicator .stamp { color: white; } .indicator .stamp::before, #target-word-reading .indicator::before { background-color: black; } .night_mode #target-word-translation .indicator .stamp::before, .night_mode #target-word-reading .indicator::before { background-color: white; opacity: calc(0.45 * var(--pitch-accent-opacity)); } /* grey color in definitions */ #target-word-translation .indicator .stamp::before, #target-word-translation .indicator > *:not(.stamp), #target-word-translation .indicator::after { opacity: var(--indicator-opacity); }