/* 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.25em; /* 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 */ --reading-expand-transition: calc(300ms * var(--global-transition-scale)); /* hover expand transition duration for multiple readings */ --active-detransition: calc(150ms * var(--global-transition-scale)); /* colors */ --fg: canvastext; --fg-alt: buttonface; --bg: canvas; --bg-alt: buttontext; } .mobile #card { --text-block-padding: 0.5em; --native-font-size: 1.10rem; --foreign-font-size: 1.75rem; } /* 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.has-b > 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 { display: none !important; } /* hide furigana but don't shift layout */ #card.front ruby rt.hidden { visibility: hidden; } /* don't select furigana when selecting text */ rt { user-select: none; } /* 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); line-height: 1.5; } /* 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: canvas; } #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; align-content: center; } #card #back #tags .tag .inner { position: relative; opacity: 0; transition-duration: var(--tag-transition); transition-property: opacity, padding; white-space: nowrap; min-height: 0; min-width: 0; display: flex; justify-content: center; cursor: default; } /* 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 */ #card #back #target-word-reading .kanji .writing, #card #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 .note { line-height: 0; margin: 0; margin-top: 1em; margin-right: 0.25em; } .mobile #card.vertical-layout #target-word-reading .note { margin: 0; margin-bottom: 0.5em; } .mobile #card.vertical-layout #target-word-reading .kanji { display: flex; } /* 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; } #card #target-word-translation .definitions.showcomma .definition-separator::after { content: ", "; } /* mobile definitions style */ .mobile #card.vertical-layout #target-word-translation .definitions { display: flex; flex-direction: column; align-items: center; } .mobile #card.vertical-layout #target-word-translation .definitions .definition-separator::after { content: ""; } .mobile #card.vertical-layout #target-word-translation .definitions .definition-separator { height: var(--definition-marker-height); width: var(--definition-marker-width); opacity: var(--definition-marker-opacity); border-radius: 999px; background-color: currentColor; margin: var(--definition-spacing) 0; } /* 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; min-width: calc(1lh - 4px); 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 { --pitch-accent-padding: 4px; position: relative; font-size: 80%; font-weight: bold; width: calc(1em + var(--pitch-accent-padding)); height: calc(1em + var(--pitch-accent-padding)); display: inline-flex; align-items: center; justify-content: center; } #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 .content, .indicator .stamp span { color: canvas; } .night_mode #target-word-reading .indicator .content, .night_mode .indicator .stamp span { color: currentColor; } .indicator .stamp::before, #target-word-reading .indicator::before { background-color: currentColor; } .night_mode #target-word-translation .indicator .stamp::before, .night_mode #target-word-reading .indicator::before { 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); } /* collapse kanji with multiple writings */ #back .kanji { position: relative; display: inline-flex; flex-direction: row; --writing-padding: 4px; --writing-margin: 4px; } #back .kanji .extra-writings .extra-count { transition-property: opacity; transition-duration: var(--reading-expand-transition); opacity: 1; font-size: 75%; font-weight: bold; user-select: none; } #back .kanji .extra-writings { transition-property: padding, gap; gap: 0px; transition-duration: var(--reading-expand-transition); position: relative; padding: 0 1em; align-items: center; cursor: text; } #back .kanji .extra-writings::after { content: ""; position: absolute; border-radius: 0.5em; background-color: currentColor; transition-property: width, height, opacity; transition-duration: var(--reading-expand-transition); opacity: 15%; top: 50%; left: 50%; height: 1em; width: 1.5em; transform: translate(-50%, -50%); z-index: -1; } #back .kanji .extra-writings .writing-separator, #back .kanji .extra-writings .writing { margin: 0; position: relative; overflow: hidden; transition-property: padding, margin, grid-template-rows, grid-template-columns; transition-duration: var(--reading-expand-transition); width: max-content; display: grid; align-items: center; justify-content: center; align-content: center; grid-template-rows: 1fr; grid-template-columns: 0fr; } #back .kanji .extra-writings .writing-separator .inner, #back .kanji .extra-writings .writing .inner { min-height: 0; min-width: 0; transition: opacity var(--reading-expand-transition); opacity: 0; display: flex; justify-content: center; } #back .kanji .extra-writings .writing::after { content: ""; position: absolute; inset: 0; background-color: currentColor; transition: opacity var(--reading-expand-transition); opacity: 0; border-radius: 8px; } .extra-count { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); } #back .kanji .extra-writings { position: relative; display: inline-flex; border-radius: 8px; padding: 0 20px; } /* multiple writings hover/hold expand */ #back #target-word-reading:hover .kanji .extra-writings .writing, #back #target-word-reading:hover .kanji .extra-writings .writing-separator { grid-template-columns: 1fr; } #back #target-word-reading:hover .kanji .extra-writings .extra-count { opacity: 0; } #back #target-word-reading:hover .kanji .extra-writings .writing .inner, #back #target-word-reading:hover .kanji .extra-writings .writing-separator .inner { opacity: 1; } #back #target-word-reading:hover .kanji .extra-writings { padding: 0; } #back #target-word-reading:hover .kanji .extra-writings::after { width: 100%; height: 100%; opacity: 0; } /* multiple writings as tags (vertical mobile layout only) */ .mobile #card.vertical-layout #back #target-word-reading:hover .kanji .extra-writings .writing::after { opacity: 20%; } .mobile #card.vertical-layout #back .kanji, .mobile #card.vertical-layout #back .kanji .extra-writings { flex-direction: column; } .mobile #card.vertical-layout #back .kanji .extra-writings { padding: 0.5em 0; } .mobile #card.vertical-layout #back #target-word-reading:hover .kanji .extra-writings { padding: 0; } .mobile #card.vertical-layout #back .kanji .extra-writings .writing { grid-template-rows: 0fr; } .mobile #card.vertical-layout #back #target-word-reading:hover .kanji .extra-writings .writing { grid-template-rows: 1fr; } .mobile #card.vertical-layout #back .kanji .writing-separator { display: none; } .mobile #card.vertical-layout #back #target-word-reading:hover .kanji .extra-writings .writing { padding: 0 var(--writing-padding); } .mobile #card.vertical-layout #back #target-word-reading:hover .kanji .extra-writings { gap: var(--writing-margin); } /* vertical align for target-word-reading parts */ #card.horizontal-layout #target-word-reading > * { vertical-align: middle; } /* mobile tap highlight */ .mobile #card * { -webkit-tap-highlight-color: transparent; } .mobile #card #sentence-translation .outer, .mobile #card #audio svg { box-shadow: 0 0 0 0px currentColor; transition-property: box-shadow; transition-duration: var(--active-detransition); } .mobile #card #sentence-translation .outer:active, .mobile #card #audio:active svg { box-shadow: 0 0 0 2px currentColor; transition-duration: 0ms; } #card { color-scheme: light; } .night_mode #card { color-scheme: dark; } /* horizontal numbers and punctuation in single kana space in vertical japanese */ #card.vertical-layout #sentence .horizontal-in-vertical { text-combine-upright: all; } /* make elements within this class display on one line */ .vertical-layout .flex-line { flex-direction: column; } .horizontal-layout .flex-line { flex-direction: row; } .flex-line { display: flex !important; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0; } /* display:none utility class */ .display-none { display: none; } /* play audio button size */ .mobile .replay-button svg { width: 48px !important; height: 48px !important; } .replay-button svg { width: 24px !important; height: 24px !important; border-radius: 25%; /* display rounded tap highlight on mobile */ } /* maximize size of touch target (for mobile) */ .replay-button { margin: 0px !important; padding: 6px; /* max allowed padding w/o changing page layout */ color: var(--fg); } /* force play icon to be same as text color */ .replay-button svg path { fill: currentColor !important; }