/**
 * Flamenet Games — Stylesheet
 * Flamenet Games portal aesthetic, circa 2001
 */

/* -------------------------------------------------------
   Wrap + general
------------------------------------------------------- */
.fngm-wrap {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 13px;
    color: #000;
}

.fngm-error {
    color: #CC0000;
    padding: 6px;
    border: 1px solid #CC0000;
    background: #FFEEEE;
}

.fngm-msg,
.fngm-msg-ok,
.fngm-msg-err {
    padding: 6px 10px;
    margin-bottom: 10px;
    border: 1px solid;
    font-size: 12px;
}

.fngm-msg-ok { background: #EEFFEE; border-color: #006600; color: #006600; }
.fngm-msg-err { background: #FFEEEE; border-color: #CC0000; color: #CC0000; }

/* -------------------------------------------------------
   Section bar (same pattern as other plugins)
------------------------------------------------------- */
.fngm-section-bar {
    background: #7B0099;  /* Flamenet purple */
    color: #fff;
    font-size: 13px;
    font-weight: bold;
    padding: 5px 10px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.fngm-back-link {
    color: #FFCC00;
    text-decoration: none;
    font-weight: normal;
    font-size: 11px;
}

.fngm-back-link:hover { text-decoration: underline; }

/* -------------------------------------------------------
   Buttons
------------------------------------------------------- */
.fngm-btn-primary,
.fngm-btn-primary:visited,
.fngm-btn-primary:hover,
.fngm-btn-primary:visited:hover {
    color: #fff;
    text-decoration: none;
}

.fngm-btn-primary {
    display: inline-block;
    background: #7B0099;
    font-size: 12px;
    font-weight: bold;
    padding: 4px 12px;
    border: 1px solid #550066;
    cursor: pointer;
}

.fngm-btn-primary:hover,
.fngm-btn-primary:visited:hover {
    background: #9900BB;
}

.fngm-btn-danger {
    background: #CC0000;
    color: #fff;
    border-color: #990000;
}

.fngm-btn-danger:hover { background: #EE0000; }

.fngm-btn-resign {
    background: #888;
    color: #fff;
    font-size: 11px;
    padding: 3px 10px;
    border: 1px solid #555;
    cursor: pointer;
    margin-top: 8px;
    width: 100%;
}

.fngm-btn-resign:hover { background: #CC0000; }

/* -------------------------------------------------------
   Main Lobby — games grid
------------------------------------------------------- */
.fngm-main-lobby {}

.fngm-lobby-header {
    font-size: 22px;
    font-weight: bold;
    color: #000;
    margin-bottom: 6px;
}

.fngm-flamenet-logo {
    color: #7B0099;
    font-size: 28px;
    font-weight: bold;
}

.fngm-login-notice {
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
}

.fngm-login-notice a { color: #7B0099; font-weight: bold; }

.fngm-games-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 10px;
}

.fngm-game-card {
    border: 2px solid #AABBD4;
    background: #F0F4FF;
    padding: 14px;
    width: 160px;
    text-align: center;
    box-sizing: border-box;
}

.fngm-game-card:hover {
    border-color: #7B0099;
    background: #F5EEFF;
}

.fngm-game-icon {
    font-size: 42px;
    margin-bottom: 6px;
    line-height: 1;
}

.fngm-game-name {
    font-size: 14px;
    font-weight: bold;
    color: #003399;
    margin-bottom: 4px;
}

.fngm-game-desc {
    font-size: 11px;
    color: #555;
    margin-bottom: 8px;
    min-height: 28px;
}

/* -------------------------------------------------------
   Game Lobby — rooms table
------------------------------------------------------- */
.fngm-game-lobby {}

.fngm-lobby-actions {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.fngm-lobby-hint {
    font-size: 11px;
    color: #666;
}

.fngm-rooms-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    margin-bottom: 10px;
}

.fngm-rooms-table th {
    background: #CCAADD;
    color: #330044;
    font-weight: bold;
    padding: 4px 8px;
    border: 1px solid #AA88CC;
    text-align: left;
}

.fngm-rooms-table td {
    padding: 4px 8px;
    border: 1px solid #DDD;
}

.fngm-rooms-table tr:nth-child(even) td {
    background: #F5EEF8;
}

.fngm-no-rooms {
    color: #666;
    font-size: 12px;
    font-style: italic;
}

/* -------------------------------------------------------
   Chess board + layout
------------------------------------------------------- */
.fngm-chess-container {}

.fngm-status-bar {
    padding: 5px 10px;
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 10px;
    border: 1px solid;
}

.fngm-status-myturn  { background: #EEFFEE; border-color: #006600; color: #006600; }
.fngm-status-waiting { background: #F0F0F0; border-color: #999;    color: #555; }
.fngm-status-done    { background: #FFFAEE; border-color: #CC6600; color: #CC6600; }

.fngm-chess-wrap {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

/* Board column */
.fngm-board-col {
    flex: 0 0 auto;
}

.fngm-player-label {
    font-size: 12px;
    font-weight: bold;
    color: #003399;
    padding: 4px 2px;
}

.fngm-chess-board-wrap {
    position: relative;
    display: inline-block;
}

/* The 8×8 grid */
.fngm-chess-board {
    display: grid;
    grid-template-columns: repeat(8, 56px);
    grid-template-rows: repeat(8, 56px);
    border: 3px solid #5D3A1A;
    box-shadow: 2px 2px 6px rgba(0,0,0,0.4);
    cursor: default;
}

.fngm-sq {
    width: 56px;
    height: 56px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.fngm-sq-light { background: #F0D9B5; }
.fngm-sq-dark  { background: #B58863; }

.fngm-sq-selected {
    background: #F6F669 !important;
}

.fngm-sq-last-move {
    background: #CDD16E !important;
}

.fngm-sq-legal {
    /* highlight handled by dot or ring */
}

.fngm-legal-dot {
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.25);
    pointer-events: none;
}

.fngm-sq-legal-capture {
    box-shadow: inset 0 0 0 4px rgba(0, 0, 0, 0.3);
}

/* Pieces */
.fngm-piece {
    font-size: 38px;
    line-height: 1;
    user-select: none;
    pointer-events: none;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.fngm-piece-white { color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,0.6); }
.fngm-piece-black { color: #1A1A1A; text-shadow: 0 1px 2px rgba(255,255,255,0.2); }

/* Board labels */
.fngm-rank-labels {
    position: absolute;
    left: -14px;
    top: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.fngm-rank-labels span {
    height: 56px;
    line-height: 56px;
    font-size: 10px;
    color: #555;
    text-align: right;
    width: 12px;
}

.fngm-file-labels {
    display: flex;
    padding-left: 0;
    margin-top: 2px;
}

.fngm-file-labels span {
    width: 56px;
    text-align: center;
    font-size: 10px;
    color: #555;
}

/* -------------------------------------------------------
   Right panel: info + chat
------------------------------------------------------- */
.fngm-right-panel {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Info panel */
.fngm-info-panel {
    border: 1px solid #AABBD4;
    padding: 8px;
    background: #F5F8FF;
}

.fngm-info-title {
    font-size: 12px;
    font-weight: bold;
    color: #7B0099;
    margin-bottom: 6px;
    border-bottom: 1px solid #CCAADD;
    padding-bottom: 3px;
}

.fngm-info-table {
    font-size: 12px;
    width: 100%;
    border-collapse: collapse;
}

.fngm-info-table th {
    text-align: right;
    color: #003399;
    font-weight: bold;
    padding: 2px 6px 2px 0;
    width: 55px;
    white-space: nowrap;
}

.fngm-info-table td {
    text-align: left;
    padding: 2px 0;
}

/* Chat panel */
.fngm-chat-panel {
    border: 1px solid #AABBD4;
    padding: 8px;
    background: #FAFAFA;
    display: flex;
    flex-direction: column;
}

.fngm-chat-title {
    font-size: 12px;
    font-weight: bold;
    color: #7B0099;
    margin-bottom: 6px;
    border-bottom: 1px solid #CCAADD;
    padding-bottom: 3px;
}

.fngm-chat-log {
    height: 200px;
    overflow-y: auto;
    border: 1px solid #DDD;
    background: #fff;
    padding: 4px 6px;
    font-size: 11px;
    margin-bottom: 6px;
}

.fngm-chat-msg {
    margin-bottom: 3px;
    line-height: 1.4;
}

.fngm-chat-name {
    color: #7B0099;
    font-weight: bold;
}

.fngm-chat-text {
    color: #333;
}

.fngm-chat-input-row {
    display: flex;
    gap: 4px;
}

.fngm-chat-input-row input[type="text"] {
    flex: 1;
    font-size: 12px;
    padding: 3px 6px;
    border: 1px solid #999;
}

/* -------------------------------------------------------
   Promotion overlay
------------------------------------------------------- */
.fngm-promotion-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9000;
}

.fngm-promotion-box {
    background: #fff;
    border: 3px solid #7B0099;
    padding: 20px;
    text-align: center;
}

.fngm-promotion-title {
    font-size: 14px;
    font-weight: bold;
    color: #7B0099;
    margin-bottom: 12px;
}

.fngm-promotion-choices {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.fngm-promotion-choices button {
    font-size: 22px;
    padding: 8px 14px;
    border: 2px solid #7B0099;
    background: #F5EEFF;
    cursor: pointer;
}

.fngm-promotion-choices button:hover {
    background: #7B0099;
    color: #fff;
}

/* -------------------------------------------------------
   Game over overlay
------------------------------------------------------- */
.fngm-gameover-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9000;
}

.fngm-gameover-box {
    background: #fff;
    border: 4px solid #7B0099;
    padding: 30px 40px;
    text-align: center;
    max-width: 360px;
}

.fngm-gameover-title {
    font-size: 20px;
    font-weight: bold;
    color: #7B0099;
    margin-bottom: 10px;
}

.fngm-gameover-msg {
    font-size: 13px;
    color: #555;
    margin-bottom: 18px;
}

/* -------------------------------------------------------
   Responsive
------------------------------------------------------- */
@media (max-width: 700px) {
    .fngm-chess-wrap {
        flex-direction: column;
    }

    .fngm-chess-board {
        grid-template-columns: repeat(8, 40px);
        grid-template-rows: repeat(8, 40px);
    }

    .fngm-sq {
        width: 40px;
        height: 40px;
    }

    .fngm-piece { font-size: 28px; }

    .fngm-rank-labels span { height: 40px; line-height: 40px; }
    .fngm-file-labels span { width: 40px; }

    .fngm-legal-dot { width: 12px; height: 12px; }

    .fngm-games-grid { justify-content: center; }
    .fngm-game-card { width: 140px; }
}

@media (max-width: 400px) {
    .fngm-chess-board {
        grid-template-columns: repeat(8, 36px);
        grid-template-rows: repeat(8, 36px);
    }
    .fngm-sq { width: 36px; height: 36px; }
    .fngm-piece { font-size: 24px; }
    .fngm-rank-labels span { height: 36px; line-height: 36px; }
    .fngm-file-labels span { width: 36px; }
}

/* -------------------------------------------------------
   Tic-Tac-Toe
------------------------------------------------------- */

.fngm-ttt-layout {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.fngm-ttt-board-wrap {
    flex: 0 0 auto;
}

.fngm-ttt-board {
    display: grid;
    grid-template-columns: repeat(3, 110px);
    grid-template-rows: repeat(3, 110px);
    border: 3px solid #333;
    background: #fff;
    gap: 0;
}

.fngm-ttt-cell {
    width: 110px;
    height: 110px;
    border: 2px solid #444;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: default;
    position: relative;
    box-sizing: border-box;
    transition: background 0.1s;
}

.fngm-ttt-cell-playable {
    cursor: pointer;
}

.fngm-ttt-cell-playable:hover {
    background: #F5F0FF;
}

.fngm-ttt-mark {
    font-size: 64px;
    font-weight: 900;
    line-height: 1;
    user-select: none;
    pointer-events: none;
}

.fngm-ttt-x {
    color: #003399;
    font-family: Arial Black, Arial, sans-serif;
}

.fngm-ttt-o {
    color: #CC0000;
    font-family: Arial Black, Arial, sans-serif;
}

/* Highlight last move */
.fngm-ttt-last-move {
    background: #FAFACC;
}

/* Winning squares */
.fngm-ttt-win {
    background: #CCFFCC !important;
}
.fngm-ttt-win .fngm-ttt-x { color: #006600; }
.fngm-ttt-win .fngm-ttt-o { color: #006600; }

/* Score labels in info panel */
.fngm-ttt-x-label {
    color: #003399;
    font-weight: 900;
    font-size: 15px;
}

.fngm-ttt-o-label {
    color: #CC0000;
    font-weight: 900;
    font-size: 15px;
}

@media (max-width: 600px) {
    .fngm-ttt-layout { flex-direction: column; }
    .fngm-ttt-board  { grid-template-columns: repeat(3, 80px); grid-template-rows: repeat(3, 80px); }
    .fngm-ttt-cell   { width: 80px; height: 80px; }
    .fngm-ttt-mark   { font-size: 44px; }
}

@media (max-width: 380px) {
    .fngm-ttt-board  { grid-template-columns: repeat(3, 64px); grid-template-rows: repeat(3, 64px); }
    .fngm-ttt-cell   { width: 64px; height: 64px; }
    .fngm-ttt-mark   { font-size: 36px; }
}

/* -------------------------------------------------------
   Checkers — board + pieces
------------------------------------------------------- */

/* Dark squares on a checkers board are the playable squares */
.fngm-checkers-board .fngm-sq-dark {
    background: #5A7A2A;  /* classic dark green */
    cursor: default;
}

.fngm-checkers-board .fngm-sq-playable {
    cursor: pointer;
}

.fngm-checkers-board .fngm-sq-light {
    background: #F0D9B5;
    cursor: default;
    pointer-events: none;
}

/* Checkers pieces — CSS circles */
.fngm-checker {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    pointer-events: none;
    box-sizing: border-box;
}

/* Red man */
.fngm-checker-r {
    background: radial-gradient( circle at 35% 35%, #FF6644, #CC2200 );
    border: 3px solid #881100;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5), inset 0 1px 2px rgba(255,200,180,0.4);
}

/* Red king */
.fngm-checker-R {
    background: radial-gradient( circle at 35% 35%, #FF6644, #CC2200 );
    border: 3px solid #FFCC00;
    box-shadow: 0 2px 5px rgba(0,0,0,0.6), inset 0 1px 2px rgba(255,200,180,0.4);
}

/* Black man */
.fngm-checker-b {
    background: radial-gradient( circle at 35% 35%, #555, #111 );
    border: 3px solid #000;
    box-shadow: 0 2px 4px rgba(0,0,0,0.6), inset 0 1px 2px rgba(255,255,255,0.1);
}

/* Black king */
.fngm-checker-B {
    background: radial-gradient( circle at 35% 35%, #555, #111 );
    border: 3px solid #FFCC00;
    box-shadow: 0 2px 5px rgba(0,0,0,0.7), inset 0 1px 2px rgba(255,255,255,0.1);
}

/* Crown for kings */
.fngm-king-crown {
    font-size: 18px;
    color: #FFCC00;
    line-height: 1;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

/* Legal move dot on dark squares */
.fngm-checkers-board .fngm-legal-dot {
    width: 16px;
    height: 16px;
    background: rgba(255, 255, 200, 0.55);
    border-radius: 50%;
}

/* Legal capture ring */
.fngm-checkers-board .fngm-sq-legal-capture {
    box-shadow: inset 0 0 0 4px rgba(255, 255, 0, 0.5);
}

/* Selected square on checkers board */
.fngm-checkers-board .fngm-sq-selected {
    background: #AACC44 !important;
}

/* Last move highlight */
.fngm-checkers-board .fngm-sq-last-move {
    background: #88AA33 !important;
}

@media (max-width: 700px) {
    .fngm-checker {
        width: 30px;
        height: 30px;
    }
    .fngm-king-crown { font-size: 14px; }
}

@media (max-width: 400px) {
    .fngm-checker {
        width: 26px;
        height: 26px;
    }
    .fngm-king-crown { font-size: 12px; }
}

/* =======================================================
   Connect Four
======================================================= */

/* -------------------------------------------------------
   Container + layout
------------------------------------------------------- */
.fngm-c4-container {
    max-width: 780px;
    margin: 0 auto;
}

/* Reuse .fngm-ttt-layout (flex row: board + right panel) */

/* -------------------------------------------------------
   Board wrap + drop zone
------------------------------------------------------- */
.fngm-c4-board-wrap {
    display: inline-flex;
    flex-direction: column;
    align-items: stretch;
    background: #003399;
    border: 4px solid #001a66;
    border-radius: 6px;
    padding: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

/* Drop zone — row of arrow targets above the board */
.fngm-c4-drop-zone {
    display: grid;
    grid-template-columns: repeat(7, 56px);
    gap: 4px;
    margin-bottom: 4px;
}

.fngm-c4-drop-col {
    height: 24px;
    line-height: 24px;
    text-align: center;
    font-size: 18px;
    color: transparent;       /* hidden by default */
    cursor: default;
    border-radius: 3px;
    transition: background 0.15s;
    user-select: none;
}

.fngm-c4-drop-col.fngm-c4-drop-active {
    color: #FFCC00;
    cursor: pointer;
}

.fngm-c4-drop-col.fngm-c4-drop-active:hover {
    background: rgba(255,255,255,0.12);
}

/* -------------------------------------------------------
   Board grid
------------------------------------------------------- */
.fngm-c4-board {
    display: grid;
    grid-template-columns: repeat(7, 56px);
    grid-template-rows: repeat(6, 56px);
    gap: 4px;
}

/* -------------------------------------------------------
   Cells
------------------------------------------------------- */
.fngm-c4-cell {
    width: 56px;
    height: 56px;
    background: #003399;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.15s;
}

.fngm-c4-cell.fngm-c4-last-move {
    background: #0044bb;
}

.fngm-c4-cell.fngm-c4-win {
    background: #336600;
}

/* Hover preview cell */
.fngm-c4-cell.fngm-c4-hover .fngm-c4-piece {
    opacity: 0.45;
}
.fngm-c4-cell.fngm-c4-hover.fngm-c4-hover-r .fngm-c4-piece {
    background: radial-gradient(circle at 38% 38%, #ff6666 0%, #CC0000 70%);
    box-shadow: 0 0 0 2px #880000;
}
.fngm-c4-cell.fngm-c4-hover.fngm-c4-hover-y .fngm-c4-piece {
    background: radial-gradient(circle at 38% 38%, #ffff88 0%, #FFCC00 70%);
    box-shadow: 0 0 0 2px #aa8800;
}

/* -------------------------------------------------------
   Pieces
------------------------------------------------------- */
.fngm-c4-piece {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: #001a66;    /* empty = dark hole */
    box-shadow: inset 0 3px 8px rgba(0,0,0,0.6);
    transition: background 0.1s, box-shadow 0.1s;
}

.fngm-c4-piece.fngm-c4-red {
    background: radial-gradient(circle at 38% 38%, #ff6666 0%, #CC0000 70%);
    box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}

.fngm-c4-piece.fngm-c4-yellow {
    background: radial-gradient(circle at 38% 38%, #ffff88 0%, #FFCC00 70%);
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

/* Win pulse */
.fngm-c4-cell.fngm-c4-win .fngm-c4-piece {
    animation: c4-win-pulse 0.8s ease-in-out infinite alternate;
}

@keyframes c4-win-pulse {
    from { transform: scale(1);    box-shadow: 0 2px 6px rgba(0,0,0,0.5); }
    to   { transform: scale(1.12); box-shadow: 0 0 14px rgba(255,255,255,0.7); }
}

/* -------------------------------------------------------
   Player labels in info panel
------------------------------------------------------- */
.fngm-c4-r-label {
    font-size: 18px;
}

.fngm-c4-y-label {
    font-size: 18px;
}

/* -------------------------------------------------------
   Responsive
------------------------------------------------------- */
@media (max-width: 680px) {
    .fngm-c4-board {
        grid-template-columns: repeat(7, 40px);
        grid-template-rows: repeat(6, 40px);
        gap: 3px;
    }
    .fngm-c4-drop-zone {
        grid-template-columns: repeat(7, 40px);
        gap: 3px;
    }
    .fngm-c4-cell {
        width: 40px;
        height: 40px;
    }
    .fngm-c4-piece {
        width: 32px;
        height: 32px;
    }
}

@media (max-width: 420px) {
    .fngm-c4-board {
        grid-template-columns: repeat(7, 32px);
        grid-template-rows: repeat(6, 32px);
        gap: 2px;
    }
    .fngm-c4-drop-zone {
        grid-template-columns: repeat(7, 32px);
        gap: 2px;
    }
    .fngm-c4-cell {
        width: 32px;
        height: 32px;
    }
    .fngm-c4-piece {
        width: 26px;
        height: 26px;
    }
    .fngm-c4-drop-col {
        font-size: 14px;
        height: 20px;
        line-height: 20px;
    }
}
