/* fartle Container */
.fartle-container {
    position: relative;
    background-position: center;
    text-align: center;
    overflow: hidden;
    min-height: 300px;
    transition: background-image 0.3s ease-in-out;
}

.fartle-container::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
}

.fartle-container * {
    position: relative;
    z-index: 2;
}

.fartle-instructions {
    font-family: 'Original Surfer', 'Arial', sans-serif;
    font-size: 18px;
    border-left: 5px solid #bada55;
    background: #0b74bfaa;
    margin-top: 15px;
    padding: 10px;
    border-top-right-radius: 15px;
    border-bottom-right-radius: 15px;
}

.fartle-instructions p,
.fartle-instructions h2 {
    color: #ffffff;
}

/* fartle Grid */
.fartle-grid {
    display: grid;
    grid-template-rows: repeat(6, 1fr);
    gap: 5px;
    margin: 0 auto;
    justify-content: center;
    padding-bottom: 15px;
}

/* fartle Rows */
.fartle-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 5px;
}

/* fartle Tiles */
.fartle-tile {
    width: 75px;
    height: 75px;
    border: 2px solid #555;
    font-size: 30px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s;
    box-shadow: 2px 2px 5px rgba(2, 32, 75, 0.4);
    background-color: #0b74bf;
    color: #EAEAEA;
}
html.dark-mode .fartle-tile {
    border: 2px solid #bada55;
    background-color: #0b5285;
}
@media (max-width: 768px) {
    .fartle-tile {
        width: 65px;
        height: 65px;
    }
}

/* Tile Colors for Correct, Present, and Absent States */
.fartle-tile.correct {
    background-color: #4ad71c !important;
    color: #181818;
}

.fartle-tile.present {
    background-color: #F05454 !important;
    color: #181818;
}

.fartle-tile.absent {
    background-color: #0a5388aa;
    color: #EAEAEA;
    text-decoration: line-through;
}

.fartle-tile.flip {
    animation: flip 0.6s;
}

.fartle-tile.shake {
    animation: shake 0.4s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    15%       { transform: translateX(-7px); }
    35%       { transform: translateX(7px); }
    55%       { transform: translateX(-5px); }
    75%       { transform: translateX(5px); }
    90%       { transform: translateX(-2px); }
}

@keyframes flip {
    0% {
        transform: rotateX(0deg);
    }
    50% {
        transform: rotateX(90deg);
    }
    100% {
        transform: rotateX(0deg);
    }
}

/* Game Popup */
#game-popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.popup-content {
    background: #2E2E2E;
    color: #EAEAEA;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    max-width: 300px;
    width: 80%;
}

.popup-content p {
    font-size: 18px;
    margin-bottom: 20px;
}

/* Popup Button */
#popup-ok-btn {
    padding: 10px 20px;
    background-color: #5BC0BE;
    color: #181818;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s ease;
}

#popup-ok-btn:hover {
    background-color: #3A3A3A;
    color: #EAEAEA;
}

/* Virtual Keyboard */
.virtual-keyboard {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.keyboard-row {
    display: flex;
    gap: 1px;
    justify-content: center;
}

/* Virtual Keyboard Keys */
.virtual-key {
    padding: 7px;
    font-size: 18px;
    font-weight: bold;
    box-shadow: 2px 2px 5px rgba(2, 32, 75, 0.4);
    background-color: #0b74bfaa;
    color: #EAEAEA;
    border: 2px solid #555;
    border-radius: 5px;
    cursor: pointer;
    margin: 2px;
    transition: background-color 0.3s ease;
}

.virtual-key:active {
    background-color: #5BC0BE !important;
    color: #181818 !important;
}

.virtual-key.correct {
    background-color: #4ad71c !important;
    color: #181818 !important;
    border-color: #4ad71c !important;
}

.virtual-key.present {
    background-color: #F05454 !important;
    color: #181818 !important;
    border-color: #F05454 !important;
}

.virtual-key.absent {
    background-color: #0a5388aa !important;
    color: #EAEAEA !important;
    text-decoration: line-through;
}

/* Visual if word has multiple of the same letter */
.fartle-tile[data-dup] {
  position: relative;
}

.fartle-tile[data-dup]::after {
  content: "×" attr(data-dup);
  position: absolute;
  top: 2px;
  right: 4px;
  font-size: 0.6em;
  opacity: 0.7;
  pointer-events: none;
}

/* =============================================
   TOAST NOTIFICATIONS
   ============================================= */
.fartle-toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(-12px);
    padding: 12px 22px;
    border-radius: 10px;
    font-size: 17px;
    font-weight: bold;
    color: #fff;
    z-index: 99999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
    white-space: nowrap;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    text-align: center;
}

.fartle-toast--visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.fartle-toast--warning {
    background: #9e6e0a;
    border: 2px solid #f0c040;
}

.fartle-toast--error {
    background: #b52020;
    border: 2px solid #ff6b6b;
}

.fartle-toast--info {
    background: #0b74bf;
    border: 2px solid #5bb8f5;
}

/* =============================================
   TWO-COLUMN LAYOUT
   ============================================= */
#fartle-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
}

#fartle-sidebar {
    display: contents;
}

.full-width-section-header { order: 0; }
#fartle-daily-scores        { order: 1; }
#fartle-main                { order: 2; }
.virtual-keyboard           { order: 3; }

#fartle-main {
    display: flex;
    flex-direction: column;
    align-items: center;
}

@media (min-width: 1100px) {
    #fartle-layout {
        flex-direction: row;
        align-items: flex-start;
        justify-content: center;
        gap: 24px;
    }

    #fartle-main {
        order: 1;
    }

    #fartle-sidebar {
        display: flex;
        order: 2;
        flex-direction: column;
        align-items: center;
        gap: 16px;
        position: sticky;
        top: 80px;
        align-self: flex-start;
    }

    .full-width-section-header { order: unset; }
    #fartle-daily-scores        { order: unset; width: 100%; }
    .virtual-keyboard           { order: unset; }

    #fartle-sidebar .full-width-section-header h1 {
        font-size: 1.5rem;
    }

    #fartle-sidebar .full-width-section-header img {
        width: 48px;
        height: 48px;
    }

    #fartle-sidebar .virtual-key {
        padding: 5px 4px;
        font-size: 14px;
        margin: 1px;
    }
}

/* =============================================
   SIDEBAR DAILY SCORES PANEL
   ============================================= */
#fartle-daily-scores {
    background: #0b74bfcc;
    border-radius: 10px;
    padding: 14px 16px;
    font-family: 'Original Surfer', 'Arial', sans-serif;
    color: #fff;
    width: 100%;
    box-sizing: border-box;
}

.fds-header {
    font-size: 15px;
    font-weight: bold;
    color: #bada55;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.2);
    padding-bottom: 8px;
}

#fds-list ol {
    margin: 0;
    padding-left: 20px;
}

#fds-list li {
    font-size: 14px;
    color: #fff;
    margin-bottom: 5px;
    line-height: 1.3;
}

#fds-list li strong {
    color: #bada55;
}

.fds-empty {
    font-size: 13px;
    color: #cceeff;
    font-style: italic;
    margin: 4px 0;
}

.fds-countdown {
    font-size: 12px;
    color: #cceeff;
    margin-top: 10px;
    border-top: 1px solid rgba(255,255,255,0.15);
    padding-top: 8px;
    text-align: center;
}
