/* --- Global Theme & Variables --- */
:root {
    --primary-bg: #0f1115;
    --card-bg: #1a1d23;
    --accent-green: #83f28f;
    --accent-tan: #d2b48c;
    --text-main: #e0e0e0;
    --text-muted: #606060;
    --border-radius: 8px;
}

body {
    background-color: var(--primary-bg);
    color: var(--text-main);
    font-family: 'Aptosserif', 'Segoe UI', serif;
    padding-bottom: 120px;
}

/* --- Header --- */
.titulus {
    background: linear-gradient(90deg, #d1ffdb, var(--accent-green));
    color: #111;
    text-align: center;
    padding: 1.5rem;
    margin: 0 0 2rem 0;
    font-weight: 800;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    border-radius: 0 0 var(--border-radius) var(--border-radius);
}

/* --- Input Section --- */
.centered {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 15px;
}

#inputs .btn {
    border-radius: 6px;
    border: none;
    font-weight: 600;
    margin: 5px;
    transition: all 0.2s ease;
}

#inputs .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

#diginput {
    background-color: var(--accent-tan);
    color: #111;
    font-size: 2rem;
    font-weight: bold;
    text-align: center;
    border: 3px solid rgba(0, 0, 0, 0.2);
    border-radius: var(--border-radius);
    max-width: 400px;
    margin: 25px auto;
    display: block;
}

/* --- Result Table (JS Generated) --- */
#infotable {
    margin-top: 20px;
}

th.vlabel {
    color: #aaffaa;
}

.table {
    background-color: var(--card-bg);
    color: var(--text-main);
    border-radius: var(--border-radius);
    overflow: hidden;
    border-collapse: collapse;
}


/* Striped Rows */
.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(255, 255, 255, 0.03);
}

.table td {
    padding: 15px;
    vertical-align: middle;
    border-top: 1px solid #2a2d35;
}

/* Flag Icons */
.lflag img {
    width: 40px;
    height: auto;
    border-radius: 3px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}

/* --- Table Column Scaling --- */

/* 1. Fix the width of the flag container */
td.lflag {
    width: 70px;
    /* Set a definitive width for the column */
    min-width: 70px;
    /* Prevent shrinking on small screens */
    max-width: 70px;
    text-align: center;
    vertical-align: middle;
    padding: 10px;
}

/* 2. Control the image inside the flag container */
img.lflag {
    width: 100%;
    /* Scale to the width of the td (70px) */
    height: auto;
    /* Maintain aspect ratio */
    display: block;
    margin: 0 auto;
    border-radius: 0.4em;
    border: 1px solid rgba(128, 128, 128, 0.1);
    /* Subtle border for dark mode */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}

/* 3. Ensure the text column takes up the rest of the space */
td.displine {
    width: auto;
    /* Allow this to expand */
    text-align: left;
    vertical-align: middle;
    padding-left: 15px;
}

/* 4. Force the table to respect these widths */
table.table {
    table-layout: fixed;
    /* This is the secret sauce */
    width: 100%;
}

.nonlat {
    font-size: 1.2em;
    font-family: 'Libserif', serif;
}

.phonetic {
    color: var(--text-muted);
    font-size: 0.95rem;
    font-style: italic;
    display: block;
    margin-top: 4px;
}

/* Script Specifics */
.korean {
    font-family: 'Notokr', sans-serif;
}

.arabic,
.hebrew {
    text-align: right;
}

/* Keep aligned with table flow */

/* --- Footer --- */
footer {
    position: fixed;
    bottom: 0;
    width: 100%;
    background: rgba(15, 17, 21, 0.9);
    backdrop-filter: blur(10px);
    border-top: 1px solid #333;
    padding: 15px 0;
    text-align: center;
}

footer p {
    display: inline-block;
    margin: 0 20px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

footer a {
    color: var(--accent-green);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

.inline {
    height: 18px;
    vertical-align: middle;
    margin-right: 5px;
}

/* Mobile Optimization */
@media (max-width: 600px) {
    .btn {
        width: 45%;
        font-size: 0.8rem;
    }

    #diginput.form-control {
        width: 100%;
    }
}

/* Lists & Textareas */
#listarea {
    width: 70vw;
    /* Default width */
}

@media (max-width: 600px) {
    #listarea {
        width: 100vw;
        /* Full width on small screens */
    }
}

/* all screens */
#listarea {
    border-radius: .75em;
    height: 40vh;
    background-color: #494949;
    color: #fff;
}

.btn {
    border-radius: .75em;
    padding-left: 5%;
    padding-right: 5%;
    border: 3px outset;
}

.btn:focus {
    border: 3px inset;
}

.outcard {
    width: 70vw;
    margin-left: 0;
}

div.vtable>table>th {
    font-size: 0.8em;
    color: green;
}