:root {
    --page-bg: #ddd;
    --body-bg: #fff;
    --text-color: #222;
    --link-color: #005386;
    --hover-bg: #eee;
    --hr-color: #76816b;
    --h3-bg: #eee;
    --search-box-bg: #fff;
    --search-box-text: #000;
    --search-box-border: 1px solid #000;
    --submit-bg: #ffdddd;
    --submit-hover-bg: #ddd;
    --suggestion-box-bg: #eee;
    --suggestion-box-border: 1px solid #666;
    --suggestion-hover-bg: #ddd;
    --logo-color: #fec604;
    --logo-shadow: 1px 1px #000;
    --logo-hover: #dca402;
    --link-button-bg: #00b1cb;
    --link-button-text: #fec604;
    --link-button-shadow: 2px 2px #069;
    --link-button-hover: #069ccc;
    --subtitle-color: #000;
    --similars-hover-bg: #ddd;
}

@media (prefers-color-scheme: dark) {
    :root {
        --page-bg: #121212;
        --body-bg: #1e1e1e;
        --text-color: #f0f0f0;
        --link-color: #4da6ff;
        --hover-bg: #333333;
        --hr-color: #555555;
        --h3-bg: #333333;
        --search-box-bg: #2d2d2d;
        --search-box-text: #f0f0f0;
        --search-box-border: 1px solid #444;
        --submit-bg: #554444;
        --submit-hover-bg: #3d3d3d;
        --suggestion-box-bg: #2d2d2d;
        --suggestion-box-border: 1px solid #444;
        --suggestion-hover-bg: #333333;
        --logo-color: #ffd700;
        --logo-shadow: 1px 1px #000;
        --logo-hover: #ffc400;
        --link-button-bg: #008c9e;
        --link-button-text: #ffd700;
        --link-button-shadow: 2px 2px #005f77;
        --link-button-hover: #006b7c;
        --subtitle-color: #ccc;
        --similars-hover-bg: #333333;
    }

    #dict-form {
        border-color: var(--search-box-border);
    }
    #dict-form select {
        border-top-color: var(--search-box-border);
    }
}

html {
    overflow-y: scroll;
    background-color: var(--page-bg);
}
body {
    color: var(--text-color);
    background-color: var(--body-bg);
    font-family: Helvetica, Arial, sans-serif;
    margin: 0 auto;
    max-width: 40em;
    text-align: center;
    padding: 0.5em 1em;
}

@font-face {
    font-family: "norican-regular";
    src: url("/branding/Norican-Regular-subset.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
}


article, figcaption, figure, header, main, nav {
    display: block;
}
a {
    color: var(--link-color);
    text-decoration: underline;
}
a:hover {
    background-color: var(--hover-bg);
}
table, img {
    border: 0;
    width: 100%;
}
hr {
    border: 0;
    border-bottom: 1px solid var(--hr-color);
    border-top: 1px solid var(--hr-color);
    height: 3px;
    clear: both;
}
h1 {
    font-size: 160%;
}
h2 {
    font-size: 140%;
    margin-top: 0.7ex;
}
h3 {
    font-size: 100%;
    margin-bottom: 0.5ex;
    background-color: var(--h3-bg);
}
h4 {
    font-size: 100%;
    font-style: italic;
    float: left;
    margin-right: 1em;
    margin-top: 2ex;
    margin-bottom: 1ex;
}
table tr td {
    padding: 2px 10px 2px 0px;
}
pre {
    margin: 0;
}
footer,
header {
    padding-bottom: 1em;
    margin: auto;
    max-width: 24em;
}
footer,
nav,
main {
    margin: 0 auto;
    padding-top: 1ex;
    text-align: left;
}
main {
    border-top: 28px solid transparent;
    border-bottom: 28px solid transparent;
    -webkit-border-image: url(/branding/border.svg) 100% 0% 100% 0% round;
    -o-border-image: url(/branding/border.svg) 100% 0% 100% 0% round;
    border-image: url(/branding/border.svg) 100% 0% 100% 0% round;
}
footer,
nav {
    text-align: center;
}
#links li a {
    background-color: var(--link-button-bg);
    color: var(--link-button-text);
    padding: 0.5ex 0.5em;
    margin: 0.5ex 0.5em;
    font-weight: bold;
    border-radius: 2px;
    text-shadow: var(--link-button-shadow);
}
#links,
#dicts {
    list-style-type: none;
    margin: 0;
    padding: 0;
}
#links {
    margin-bottom: 1em;
}
#searches p {
    float: left;
    margin-right: 1em;
}
#searches ul {
    display: inline;
    padding-left: 0;
}
#similars {
    padding: 0;
}
#similars li {
    margin-right: 0.5em;
}
#similars li::after {
    content: " ";
}
#similars li,
#searches li,
#links li,
#dicts li {
    display: inline;
}
#similars li a,
#searches li a,
#links li a,
#dicts li a {
    text-decoration: none;
}
#similars li a:hover,
#searches li a:hover,
#dicts li a:hover {
    background-color: var(--similars-hover-bg);
    border-radius: 2px;
}
#links li a:hover {
    background-color: var(--link-button-hover);
}
#dict-form {
    margin: 0.5em 1em 0;
    position: relative;
    border: var(--search-box-border);
    border-radius: 2px;
}
#dict-form input,
#dict-form select {
    border: none;
}
#dict-form input,
#dict-form select,
#headword-suggestion-box {
    height: 2.5em;
    background: var(--search-box-bg);
    color: var(--search-box-text);
    padding: 0;
    margin: 0;
    padding-left: 1ex;
    padding-right: 1ex;
    box-sizing: border-box;
}
#dict-form input:focus {
    outline: none;
}
#dict-form select,
#menu,
#logo {
    width: 100%;
}
#logo {
    font-family: norican-regular, cursive;
    font-size: 2em;
    font-weight: bold;
    font-style: italic;
    color: var(--logo-color);
    text-decoration: none;
    text-shadow: var(--logo-shadow);
}
#logo:hover {
    color: var(--logo-hover);
}
#langs a img {
    height: 11px;
    width: 16px;
    padding: 0 4px;
}
#subtitle {
    font-family: 'CourierNew', Courier, monospace;
    color: var(--subtitle-color);
    text-decoration: none;
    font-weight: bold;
}
#dict-form input[type=text],
#headword-suggestion-box {
    width: 74%;
    float: left;
}
#dict-form input[type=submit] {
    width: 26%;
    background-color: var(--submit-bg);
    font-weight: bold;
    float: right;
}
#dict-form input[type=submit]:hover {
    background-color: var(--submit-hover-bg);
    cursor: pointer;
}
#dict-form select {
    border-top: 1px solid var(--search-box-border);
    clear: both;
}
#headword-suggestion-box {
    border: var(--suggestion-box-border);
    background-color: var(--suggestion-box-bg);
    position: absolute;
    height: auto;
    padding: 0;
    top: 2em;
    left: -1px;
    z-index: 2;
    line-height: 1.8em;
}
#headword-suggestion-box:empty {
    display: none;
}
#headword-suggestion-box > div {
    padding-left: 0.5em;
    cursor: pointer;
    text-align: left;
}
#headword-suggestion-box > div:hover {
    background-color: var(--suggestion-hover-bg);
}
.hidden {
    display: none;
}
.selected {
    font-weight: bold;
    font-style: italic;
}
.dict-info-button,
.copy-permalink {
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
}
.dict-info-button:hover,
.copy-permalink:hover {
    opacity: 1;
}
.copy-tooltip {
    position: fixed;
    background: #333;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    pointer-events: none;
    z-index: 10000;
    animation: fadeOut 1s ease-out forwards;
}
@keyframes fadeOut {
    0% { opacity: 1; }
    70% { opacity: 1; }
    100% { opacity: 0; }
}
.highlight-target {
    animation: highlightBlink 2s ease-in-out;
}
@keyframes highlightBlink {
    0%, 100% { background-color: transparent; }
    50% { background-color: rgba(255, 255, 0, 0.3); }
}
.dict-info-button {
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
    margin-left: 0.3em;
}
.dict-info-button:hover {
    opacity: 1;
}
.dict-info-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    animation: fadeIn 0.2s ease-out;
}
@media (prefers-color-scheme: dark) {
    .dict-info-backdrop {
        background-color: rgba(0, 0, 0, 0.7);
    }
}
.dict-info-box {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 90%;
    width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    background-color: var(--body-bg);
    color: var(--text-color);
    border: 2px solid var(--hr-color);
    border-radius: 8px;
    padding: 1.5em;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    animation: slideIn 0.2s ease-out;
    line-height: 1.6;
    text-align: left;
}
@media (prefers-color-scheme: dark) {
    .dict-info-box {
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.7);
    }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -45%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}
