/* global parameters */ #card { --max-column-width: 30em; /* max column width for text (~30 kana / ~50 latin characters) */ --spoiler-transition: 300ms; /* spoiler hide/unhide transition duration */ --tag-transition: 300ms; /* 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: 1.2pt; /* pitch accent / word type indicator stroke weight */ } .mobile #card { --text-block-padding: 0.5em; --native-font-size: 1.10rem; --foreign-font-size: 1.75rem; } /* default fonts */ body { font-family: "Inter", "Hiragino Kaku Gothic ProN", sans-serif; font-weight: 400; } #card #sentence:has(b) { color: #000b; } #card #sentence b { color: #000f; } .night_mode #card #sentence:has(b) { color: #fffb; } .night_mode #card #sentence b { color: #ffff; } /* 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; } .spoiler .inner { transition: filter var(--spoiler-transition); } .spoiler.hidden .inner { filter: blur(0.6rem); } .spoiler.visible .inner { filter: blur(0rem); } .spoiler .outer::after { transition: backdrop-filter var(--spoiler-transition); } .spoiler.hidden .outer::after { backdrop-filter: contrast(70%); } .spoiler.visible .outer::after { backdrop-filter: contrast(100%); } /* 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 { background-color: hsl(calc(1deg * var(--tag-hue)), 60%, 20%); } .night_mode #card #back #tags .tag { background-color: hsl(calc(1deg * var(--tag-hue)), 65%, 80%); } #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, transform; 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 (pitch accent or word type) */ .indicator { position: relative; display: inline-block; padding: 1px 4px; margin: 0 0.25em; vertical-align: middle; 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; } .indicator .script-japanese { font-size: 90%; vertical-align: middle; } .indicator .stamp * { line-height: 0; } .indicator:has(.stamp) > *:not(.stamp) { vertical-align: middle; } .indicator:has(.stamp) { padding-top: 0; padding-bottom: 0; padding-left: 0; } .indicator .stamp { position: relative; padding: 2px 4px; margin: 1px; margin-right: 3px; font-weight: bold; font-size: 90%; vertical-align: top; display: inline-block; } .indicator .stamp::before { content: ""; position: absolute; inset: 0; border-radius: 2px; z-index: -1; } /* theme colors */ .indicator .stamp { color: white; } .indicator .stamp::before { background-color: black; } .night_mode #target-word-translation .indicator .stamp::before { background-color: white; opacity: 40%; } /* grey color in definitions */ #target-word-translation .indicator .stamp::before, #target-word-translation .indicator > *:not(.stamp), #target-word-translation .indicator::after { opacity: 50%; }