/* =========================================================
   Base Variables & Color Schemes
========================================================= */
:root {
    color-scheme: light dark;
    --bg-color: #FBFBFB;
    --text-color: #333;
    --link-color: #666;
    --primary-color: #007bff;
    --card-bg: #f9f9f9;
    --faq-border-color: #e5e5e5;
    --form-bg: linear-gradient(to right, #e6e6e6, #f9f9f9);
    --form-border: 1px solid #e9e9e9;
}

@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: light dark;
        --bg-color: #000000;
        --text-color: #ccc;
        --link-color: #ccc;
        --primary-color: #1e90ff;
        --card-bg: #1A1B1E;
        --faq-border-color: #3a3b40;
        --form-bg: #1A1B1E;
        --form-border: 1px solid #444;
    }
}

/* =========================================================
   Global Reset & Base Typography
========================================================= */
* {
    border: 0;
    line-height: 1;
    margin: 0;
    padding: 0;
}

html {
    color: var(--text-color);
    background: var(--bg-color);
    font-size: 62.5%;
}

body {
    font-family: -system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 1.6rem;
    font-size-adjust: 0.5;
    font-weight: 300;
    text-align: center;
    background-color: var(--bg-color);
    color: var(--text-color);
}

main {
    display: block;
    text-align: left;
}

a {
    color: var(--link-color);
    font-weight: 600;
}

ul, li {
    text-align: left;
}

.container {
    margin: 0 auto;
    max-width: 1164px;
    padding: 0 15px;
}

@media (min-width: 768px) {
    .container {
        padding: 0 30px;
    }
}

/* =========================================================
   Header & Navigation
========================================================= */
.header {
    height: 50px;
}

.header > .container {
    align-items: center;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    padding-top: 12px;
}

@media (min-width: 768px) {
    .header {
        height: 70px;
    }
    .header > .container {
        padding-top: 22px;
    }
}

.header-logo {
    display: flex;
    align-items: center;
    line-height: 1;
    margin: 0;
}

.header-logo img {
    height: 24px;
}

.header-logo a {
    color: var(--text-color);
    text-decoration: none;
    font-size: 2.4rem;
    font-weight: bold;
}

.header ul {
    align-items: center;
    display: flex;
    gap: 30px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.header li {
    display: block;
    margin: 0;
    padding: 0;
}

.header-nav a {
    color: var(--link-color);
    text-decoration: none;
}

/* Mobile Menu Navigation Toggle */
.header-nav-toggle {
    background: url("data:image/svg+xml,%3Csvg height='32px' viewBox='0 0 32 32' width='32px' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4,10h24c1.104,0,2-0.896,2-2s-0.896-2-2-2H4C2.896,6,2,6.896,2,8S2.896,10,4,10z M28,14H4c-1.104,0-2,0.896-2,2s0.896,2,2,2h24c1.104,0,2-0.896,2-2S29.104,14,28,14z M28,22H4c-1.104,0-2,0.896-2,2s0.896,2,2,2h24c1.104,0,2-0.896,2-2S29.104,22,28,22z' fill='%23333'/%3E%3C/svg%3E");
    background-position: center;
    background-repeat: no-repeat;
    background-size: 22px;
    border: 0;
    cursor: pointer;
    display: block;
    height: 30px;
    padding: 0;
    position: relative;
    width: 30px;
}

@media (prefers-color-scheme: dark) {
    .header-nav-toggle {
        filter: invert(1);
    }
}

@media (min-width: 768px) {
    .header-nav-toggle {
        display: none;
    }
}

@media (max-width: 767px) {
    .noscroll {
        overflow: hidden;
    }
    .header-nav ul {
        display: none;
    }
    .header-nav-on .header-nav-toggle {
        background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7 7l18 18M7 25L25 7' stroke='%23000' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
        z-index: 10000;
    }
    .header-nav-on ul {
        align-items: center;
        background: var(--bg-color);
        display: flex;
        flex-direction: column;
        gap: 30px;
        height: 100vh;
        justify-content: center;
        left: 0;
        position: fixed;
        top: 0;
        width: 100%;
        z-index: 9999;
    }
}

/* =========================================================
   Page Layout
========================================================= */
.page {
    margin: 0;
    max-width: 100%;
    padding-left: 0;
    padding-right: 0;
}

.page > .container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

@media (min-width: 850px) {
    .page > .container {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 40px;
    }
    
    .page .article {
        flex: 1;
        min-width: 0;
    }
    
    .page .sidebar,
    .page .sidebar-container {
        flex: 0 0 320px;
        width: 320px;
    }
}

@media (min-width: 768px) and (max-width: 849px) {
    .page .sidebar,
    .page .sidebar-container {
        flex-basis: 100%;
        max-width: none;
    }
}

.article {
    max-width: 800px;
}

.sidebar {
    padding-top: 10px;
    width: 100%;
}

/* =========================================================
   Form & Calculator Styles
========================================================= */
.calculator-card {
    background: var(--card-bg);
    border: var(--form-border);
    border-radius: 8px;
    box-sizing: border-box;
    padding: 15px;
    width: 100%;
}

.calculator-card h1 {
    margin-top: 0;
    font-size: 3.2rem;
    margin-bottom: 15px;
}

.calculator-card p {
    margin-bottom: 10px;
}

.form {
    background: var(--form-bg);
    border: var(--form-border);
    border-radius: 10px;
    line-height: 1.45;
    margin: 10px 0;
    padding: 5px 20px;
    width: auto;
}

.form:after {
    clear: both;
    content: "";
    display: block;
    height: 0;
}

.form fieldset {
    border: none;
    line-height: 1.5;
    margin: 10px 0;
    width: 100%;
}

.form input {
    border: 1px solid var(--form-border);
    border-radius: 3px;
    font-family: "Helvetica Neue", Arial, sans-serif;
    font-size: 2.2rem;
    padding: 5px;
    background-color: var(--bg-color);
    color: var(--text-color);
}

.form input[type=text] {
    font-size: 1.8rem;
    margin: 5px 3px;
}

.form input[type=submit] {
    background: #369;
    border: 1px solid rgba(0,0,0,0);
    color: #fff;
    font-size: 1.3rem;
    font-weight: 600;
    padding: 10px;
    text-transform: uppercase;
    cursor: pointer;
}

.form input[type=submit]:hover {
    background: #058;
}

.form .results input[type=text] {
    background: var(--card-bg);
    padding-bottom: 7px;
}

.values input {
    min-width: 4ch;
    max-width: 15ch;
}

.results input {
    min-width: 10ch;
    max-width: 15ch;
}

@media (min-width: 728px) {
    .form .values {
        float: left;
        width: 50%;
    }
    .form .results {
        float: right;
        width: 50%;
        text-align: right;
    }
}

@media (max-width: 727px) {
    .form {
        margin-top: 5px;
    }
    .form .results {
        align-items: center;
        display: flex;
        gap: 3px;
    }
    .form .results input[type=submit] {
        flex: 0 0 auto;
    }
    .form .results input[type=text] {
        flex: 1 1 auto;
        max-width: none;
        min-width: 0;
        width: 100%;
    }
}

/* =========================================================
   Typography & Content Blocks
========================================================= */
h1 {
    font-size: 3.2rem;
    margin-bottom: 15px;
    margin-top: 30px;
}

h2 {
    font-size: 2.2rem;
    margin-bottom: 15px;
    margin-top: 30px;
    line-height: 1.45;
}

h3 {
    font-size: 1.8rem;
    margin-bottom: 15px;
    margin-top: 30px;
    line-height: 1.45;
}

p {
    font-size: 1.8rem;
    line-height: 1.45;
    margin: 15px 0;
}

.intro {
    font-size: 1.8rem;
    color: #666;
    margin-top: 5px;
}

ul, li {
    line-height: 1.45;
    padding: 10px;
}

/* =========================================================
   Footer
========================================================= */
.footer {
    font-size: 1.2rem;
    padding: 20px 0;
}

.footer > .container {
    align-items: center;
    display: flex;
    gap: 15px;
    justify-content: space-between;
}

.footer ul {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
    line-height: 1;
    margin: 0;
    padding: 0;
    list-style: none;
}

.footer a {
    font-weight: 600;
    text-decoration: none;
}

@media (max-width: 767px) {
    .footer {
        padding-bottom: 30px;
    }
    .footer > .container {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
    }
    .footer ul {
        flex-direction: column;
        gap: 8px;
        justify-content: flex-start;
        text-align: center;
    }
}

/* =========================================================
   Copy Button & Related Widgets
========================================================= */
.btn-copy {
    background-color: #f9f9f9;
    background-position: center;
    background-repeat: no-repeat;
    background-size: 15px;
    border: 1px solid #ccc;
    border-radius: 3px;
    cursor: pointer;
    height: 30px;
    margin-left: 3px;
    padding: 0;
    vertical-align: middle;
    width: 30px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 24 24%27%3E%3Cpath fill=%27%23666%27 d=%27M16 1H4c-1.1 0-2 .9-2 2v12h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z%27/%3E%3C/svg%3E");
}

.btn-copy:hover {
    border-color: #999;
}

.related a {
    align-items: center;
    background: #ffffff;
    border: var(--form-border);
    border-radius: 8px;
    box-sizing: border-box;
    color: var(--text-color);
    display: flex;
    font-weight: 600;
    justify-content: space-between;
    padding: 18px;
    text-decoration: none;
}

.related a:after {
    color: var(--link-color);
    content: "›";
    font-size: 2.4rem;
    line-height: 1;
    margin-left: 12px;
}

.related {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    margin: 0;
    padding: 0;
}

.calculator-card ul, 
.entry-content ul, 
.sidebar ul {
    list-style: none;
    padding-left: 0;
}

.calculator-card .entry-header .entry-title,
article.calculator-card h1.entry-title {
    font-size: 3.2rem;
    margin-top: 0 !important;
    margin-bottom: 15px !important;
    line-height: 1.25;
}

/* Breadcrumbs */
.breadcrumbs {
    margin-bottom: 15px;
}

.breadcrumbs .breadcrumb-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.breadcrumbs .breadcrumb-list li {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 1.3rem;
    color: var(--text-color, #666);
}

.breadcrumbs .breadcrumb-list li a {
    color: var(--link-color, #0066cc);
    text-decoration: none;
}

.breadcrumbs .breadcrumb-list li a:hover {
    text-decoration: underline;
}

.breadcrumbs .breadcrumb-list li.separator {
    color: var(--text-color, #999);
}

/* =========================================================
   WordPress Comments Styling
========================================================= */
.comments-area {
    margin-top: 30px;
    background: var(--card-bg, #ffffff);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 8px;
    padding: 25px;
}

.comments-title {
    font-size: 2rem;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color, #e2e8f0);
}

.comment-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.comment-list .comment {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #edf2f7;
}

.comment-list .comment:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.comment-body {
    position: relative;
}

.comment-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.comment-author .avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.comment-author .fn {
    font-weight: 600;
    font-size: 1.4rem;
    color: var(--text-color, #333);
    font-style: normal;
}

.comment-metadata {
    font-size: 1.2rem;
    color: #718096;
}

.comment-metadata a {
    color: inherit;
    text-decoration: none;
}

.comment-metadata a:hover {
    text-decoration: underline;
}

.comment-content {
    font-size: 1.4rem;
    line-height: 1.6;
    color: var(--text-color, #333);
}

.comment-content p {
    margin-bottom: 10px;
}

.reply {
    margin-top: 10px;
    font-size: 1.3rem;
}

.comment-reply-link {
    color: var(--link-color, #0066cc);
    text-decoration: none;
    font-weight: 500;
}

.comment-reply-link:hover {
    text-decoration: underline;
}

.comment-list .children {
    list-style: none;
    padding-left: 30px;
    margin-top: 15px;
    border-left: 2px solid #edf2f7;
}

.comment-respond {
    margin-top: 30px;
    padding-top: 25px;
    border-top: 1px solid var(--border-color, #e2e8f0);
}

.comment-reply-title {
    font-size: 1.8rem;
    margin-bottom: 15px;
}

.comment-form p {
    margin-bottom: 15px;
}

.comment-form label {
    display: block;
    font-size: 1.3rem;
    margin-bottom: 5px;
    font-weight: 500;
}

.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
    width: 90%;
    padding: 10px 12px;
    border: 1px solid var(--border-color, #cbd5e0);
    border-radius: 6px;
    font-size: 1.4rem;
    font-family: inherit;
    background: #f8fafc;
}

.comment-form input:focus,
.comment-form textarea:focus {
    outline: none;
    border-color: var(--link-color, #0066cc);
    background: #fff;
}

.comment-form textarea {
    resize: vertical;
    min-height: 120px;
}

.comment-form .submit {
    background: var(--link-color, #0066cc);
    color: #fff;
    border: none;
    padding: 10px 20px;
    font-size: 1.4rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.comment-form .submit:hover {
    opacity: 0.9;
}

/* =========================================================
   Archive & Grid Card Layout
========================================================= */
.content-layout {
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-start;
    align-items: flex-start;
    gap: 30px;
    max-width: 1280px;
    margin: 30px auto;
    padding: 0 15px;
    box-sizing: border-box;
}

.primary-content {
    flex: 1;
    min-width: 0;
}

.content-layout aside, 
.content-layout .sidebar, 
.content-layout #secondary {
    width: 300px;
    flex: 0 0 300px;
}

.other-games__wrapper {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
    padding: 20px 0;
    font-family: 'Clear Sans', 'Helvetica Neue', Arial, sans-serif;
}

.other-games__item {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    overflow: hidden;
    min-height: 122px;
    background: #fff;
    border-radius: 16px;
    -webkit-box-shadow: 0 0 10px rgba(0, 0, 0, 0.05);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.05);
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.other-games__item:hover {
    transform: translateY(-3px);
    -webkit-box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.other-games__item-img {
    width: 130px; 
    flex-shrink: 0;
    background-color: #f6f5f1; 
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.other-games__item-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.other-games__placeholder {
    width: 100%;
    height: 100%;
    background-color: #eaeaea;
}

.other-games__item-content {
    padding: 12px 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex-grow: 1;
    min-width: 0;
}

.other-games__item-title {
    font-size: 18px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 6px 0;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.other-games__item-desc {
    font-size: 14px;
    color: #4b5563;
    margin: 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

@media screen and (max-width: 850px) {
    .content-layout {
        flex-wrap: wrap;
    }
    .content-layout aside, 
    .content-layout .sidebar, 
    .content-layout #secondary {
        width: 100%;
        flex: 1 1 100%;
    }
}

/* =========================================================
   Sidebar Specific Styling
========================================================= */
.sidebar-container {
    width: 100%;
    max-width: 320px;
}

.sidebar-widget {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.widget-title {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    margin-top: 0;
    margin-bottom: 16px;
    border-bottom: 2px solid #3b82f6;
    padding-bottom: 8px;
    display: inline-block;
}

.trending-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.trending-list li {
    margin-bottom: 12px;
    border-bottom: 1px solid #f3f4f6;
    padding-bottom: 12px;
}

.trending-list li:last-child {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
}

.trending-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-decoration: none;
    color: #374151;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s ease;
}

.trending-link:hover {
    color: #3b82f6;
}

.trending-arrow {
    color: #9ca3af;
    font-size: 16px;
    transition: transform 0.2s ease;
}

.trending-link:hover .trending-arrow {
    transform: translateX(4px);
    color: #3b82f6;
}

.sticky-wrapper {
    position: -webkit-sticky;
    position: sticky;
    top: 24px;
    z-index: 10;
}

/* =========================================================
   How to Play & Controls Box
========================================================= */
.game-instructions-box {
    margin: 20px 0;
    padding: 0;
    overflow: hidden;
}

.instructions-accordion summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: var(--card-bg);
    cursor: pointer;
    font-size: 1.8rem;
    font-weight: 600;
    list-style: none;
}

.instructions-accordion summary::-webkit-details-marker {
    display: none;
}

.instructions-accordion[open] summary {
    border-bottom: var(--form-border);
}

.instructions-content {
    padding: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.instructions-block {
    flex: 1 1 300px;
}

.instructions-block h4 {
    font-size: 1.4rem;
    margin-top: 0;
    margin-bottom: 12px;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.instructions-block p {
    margin: 0;
    font-size: 1.5rem;
}

.controls-list {
    list-style: none !important;
    padding: 0 !important;
    margin: 0;
}

.controls-list li {
    margin-bottom: 12px;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-color);
}

kbd {
    background-color: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    box-shadow: 0 2px 0 #d1d5db;
    color: #374151;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 1.2rem;
    font-weight: 600;
    padding: 4px 8px;
    min-width: 24px;
    text-align: center;
    display: inline-block;
    line-height: 1;
}

@media (prefers-color-scheme: dark) {
    kbd {
        background-color: #374151;
        border-color: #4b5563;
        box-shadow: 0 2px 0 #1f2937;
        color: #f3f4f6;
    }
}

/* =========================================================
   OVERRIDE PAKSA UNTUK DARK MODE (Harus di Baris Paling Bawah)
========================================================= */
@media (prefers-color-scheme: dark) {
    html, body {
        background-color: #000000 !important;
        color: #cccccc !important;
    }
    
    /* Memaksa background elemen menjadi abu-abu gelap */
    .calculator-card, 
    .calculatorcontainer, 
    .empty-state, 
    .calculator-wrapper, 
    .button-group, 
    .related a, 
    .formula-box, 
    .sidebar-widget,
    .citation-box-container {
        background-color: #1A1B1E !important;
        border-color: #444444 !important;
        color: #cccccc !important;
    }

    /* Memaksa teks judul dan tautan widget tetap terang */
    .sidebar-widget .widget-title,
    .trending-link,
    .related a::after {
        color: #cccccc !important;
    }

    /* Memaksa tombol Copy dan elemen button menolak inline style HTML/JS */
    button, 
    .btn-copy, 
    .custom-like-btn, 
    .custom-dislike-btn {
        background-color: #25262B !important;
        border-color: #444444 !important;
        color: #cccccc !important;
    }
}