/* ============================================================
   SILNIK GRY TEKSTOWEJ — STYL GŁÓWNY
   Motyw: mroczna fantasy, inspiracja starymi grami przeglądarkową
   ============================================================ */

/* RESET & BASE */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg-dark:     #0e0c0a;
    --bg-panel:    #1a1714;
    --bg-input:    #111009;
    --border:      #3a3228;
    --border-gold: #6b5320;
    --text:        #c8b89a;
    --text-muted:  #7a6a55;
    --text-light:  #e8d8b8;
    --gold:        #c9922a;
    --gold-light:  #e8b84b;
    --red:         #8b2020;
    --green:       #2a6b3a;
    --font-main:   'Georgia', 'Times New Roman', serif;
    --font-ui:     'Trebuchet MS', Arial, sans-serif;
}

html {
    height: 100%;
    background-color: var(--bg-dark);
    overflow: visible;
}

body {
    height: 100%;
    background-color: transparent;
    color: var(--text);
    font-family: var(--font-main);
    font-size: 16px;
    line-height: 1.7;
    overflow: visible;
}

/* Tło — pseudoelement żeby móc robić fade między dwoma obrazkami */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    background-size: cover;
    background-position: center top;
    background-repeat: no-repeat;
    transition: opacity 0.6s ease;
}

/* Dzień */
body.bg-day::before {
    background-image: url('WrotaDzien.png');
}

/* Noc (domyślna) */
body.bg-night::before {
    background-image: url('WrotaNoc.png');
}

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-light); text-decoration: underline; }

h1, h2, h3, h4 {
    font-family: var(--font-main);
    color: var(--text-light);
    font-weight: normal;
    letter-spacing: 0.04em;
}
h2 { font-size: 1.6rem; margin-bottom: 1rem; border-bottom: 1px solid var(--border-gold); padding-bottom: 0.4rem; }
h3 { font-size: 1.2rem; margin-bottom: 0.6rem; color: var(--gold); }

/* LAYOUT */
.site-header {
    background: var(--bg-panel);
    border-bottom: 2px solid var(--border-gold);
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.site-header-graphic {
max-width: 50rem !important;
}

.header-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    height: 56px;
}
.site-logo {
    font-size: 1.5rem;
    color: var(--gold-light);
    font-style: italic;
    letter-spacing: 0.1em;
    white-space: nowrap;
    text-decoration: none;
}
.site-logo:hover { color: #fff; text-decoration: none; }

.main-nav {
    display: flex;
    gap: 1.2rem;
    flex: 1;
}
.main-nav a {
    color: var(--text);
    font-family: var(--font-ui);
    font-size: 0.88rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.2rem 0;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
    text-decoration: none;
}
.main-nav a:hover, .main-nav a.active {
    color: var(--gold-light);
    border-bottom-color: var(--gold);
    text-decoration: none;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-family: var(--font-ui);
    font-size: 0.85rem;
    color: var(--text-muted);
    white-space: nowrap;
}
.header-user span { color: var(--text-light); }

.site-main {
    max-width: 1280px;
    margin: 2rem auto;
    padding: 0 1.5rem;
    min-height: calc(100vh - 120px);
    display: grid;
    grid-template-columns: 1fr 200px;
    grid-template-areas: "content sidebar";
    gap: 1.5rem;
    align-items: start;
}

.site-content {
    grid-area: content;
    min-width: 0;
}

/* Panel aktywnych graczy */
.online-panel {
    grid-area: sidebar;
	position: static;
    top: 0;
    align-self: start;
    background: var(--bg-panel);
    border: 1px solid var(--border-gold);
    border-radius: 4px;
    overflow: visible;
}
.online-panel-header {
    background: var(--bg-dark);
    padding: 0.5rem 0.8rem;
    font-family: var(--font-ui);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--gold);
    border-bottom: 1px solid var(--border-gold);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.online-dot {
    width: 7px; height: 7px;
    background: #4caf50;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 4px #4caf50;
}
.online-list {
    padding: 0.4rem 0;
    max-height: calc(100vh - 160px);
    overflow-y: auto;
    overflow-x: visible;
}
.online-entry {
    position: relative;
    padding: 0.35rem 0.8rem;
    font-size: 0.88rem;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    cursor: default;
}
.online-entry:last-child { border-bottom: none; }
.online-entry a {
    color: var(--gold-light);
    text-decoration: none;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.online-entry a:hover { color: var(--gold); text-decoration: underline; }

/* Tooltip aktywnego gracza */
.online-tooltip {
    display: none;
    position: fixed;
    z-index: 9999;
    background: var(--bg-panel);
    border: 1px solid var(--border-gold);
    border-radius: 4px;
    padding: 0.8rem;
    width: 260px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.8);
    pointer-events: none;
}
.online-entry:hover .online-tooltip { display: block; }
.tooltip-avatar {
    width: 160px; height: 160px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-gold);
    display: block;
    margin: 0 auto 0.6rem;
}
.tooltip-name {
    text-align: center;
    font-size: 0.88rem;
    color: var(--text-light);
    font-weight: bold;
    margin-bottom: 0.2rem;
}
.tooltip-race {
    text-align: center;
    font-size: 0.75rem;
    color: var(--gold);
    font-family: var(--font-ui);
    margin-bottom: 0.3rem;
}
.tooltip-seen {
    text-align: center;
    font-size: 0.72rem;
    color: var(--text-muted);
    font-family: var(--font-ui);
}

.online-empty {
    padding: 0.8rem;
    font-size: 0.82rem;
    color: var(--text-muted);
    text-align: center;
    font-style: italic;
}

@media(max-width: 800px) {
    .site-main {
        grid-template-columns: 1fr;
    }
    .online-panel { display: none; }
}

.site-footer {
    text-align: center;
    padding: 1.2rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-family: var(--font-ui);
    margin-top: 3rem;
}

/* PANELE */
.panel {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
.panel-gold {
    border: 11px solid transparent;
    border-image: url('panel_frame.png') 11 repeat;
    border-radius: 0;
    padding: 0.5rem 1rem;
    background: var(--bg-panel);
}
.panel.panel-gold {
    border: 11px solid transparent;
    border-image: url('panel_frame.png') 11 repeat;
    border-radius: 0;
    background: var(--bg-panel);
}

/* AUTH BOX */
.auth-box {
    max-width: 420px;
    margin: 4rem auto;
    background: var(--bg-panel);
    border: 1px solid var(--border-gold);
    border-radius: 4px;
    padding: 2rem 2.5rem;
}
.auth-box h2 {
    text-align: center;
    margin-bottom: 1.5rem;
}
.auth-link {
    margin-top: 1.2rem;
    text-align: center;
    font-family: var(--font-ui);
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* FORMULARZE */
.form-group {
    margin-bottom: 1.1rem;
}
.form-group label {
    display: block;
    margin-bottom: 0.35rem;
    font-family: var(--font-ui);
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.form-group label small {
    text-transform: none;
    letter-spacing: 0;
    color: var(--text-muted);
}
.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 3px;
    color: var(--text-light);
    padding: 0.55rem 0.8rem;
    font-family: var(--font-main);
    font-size: 1rem;
    transition: border-color 0.2s;
    outline: none;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--border-gold);
}
.form-group textarea {
    min-height: 120px;
    resize: vertical;
}

/* PRZYCISKI */
.btn {
    display: inline-block;
    padding: 0.55rem 1.4rem;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-family: var(--font-ui);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    transition: background 0.2s, color 0.2s;
    text-decoration: none;
}
.btn-primary {
    background: var(--gold);
    color: #1a1200;
    width: 100%;
    margin-top: 0.5rem;
}
.btn-primary:hover {
    background: var(--gold-light);
    color: #0e0c00;
    text-decoration: none;
}
.btn-secondary {
    background: var(--bg-panel);
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-secondary:hover {
    border-color: var(--gold);
    color: var(--gold);
    text-decoration: none;
}
.btn-danger {
    background: var(--red);
    color: #f8caca;
}
.btn-sm { padding: 0.3rem 0.8rem; font-size: 0.8rem; }

/* ALERTY */
.alert {
    padding: 0.8rem 1rem;
    border-radius: 3px;
    margin-bottom: 1rem;
    font-family: var(--font-ui);
    font-size: 0.9rem;
}
.alert-error   { background: #2d0a0a; border: 1px solid #6b1515; color: #f8a0a0; }
.alert-success { background: #0a2010; border: 1px solid #1a5030; color: #80d8a0; }
.alert-info    { background: #0a1828; border: 1px solid #1a3860; color: #80b8f0; }

/* TABELE */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.6rem 0.8rem; text-align: left; border-bottom: 1px solid var(--border); }
th { font-family: var(--font-ui); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
tr:hover td { background: rgba(255,255,255,0.02); }

/* DIVIDER */
hr { border: none; border-top: 1px solid var(--border); margin: 1.5rem 0; }

/* CHECKBOX NARRATOR */
.narrator-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-ui);
    font-size: 0.9rem;
    color: var(--text-muted);
    cursor: pointer;
    margin-bottom: 0.8rem;
}
.narrator-toggle input[type="checkbox"] { accent-color: var(--gold); width: 16px; height: 16px; }

/* POST W SESJI */
.post {
    border-left: 3px solid var(--border);
    padding: 0.8rem 1rem;
    margin-bottom: 1rem;
    background: rgba(255,255,255,0.02);
    border-radius: 0 3px 3px 0;
}
.post.narrator { border-left-color: var(--gold); background: rgba(201,146,42,0.05); }
.post-author {
    font-family: var(--font-ui);
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}
.post-author strong { color: var(--gold-light); }
.post.narrator .post-author strong { color: var(--gold); font-style: italic; }
.post-content { color: var(--text); line-height: 1.8; }
.post-time { font-size: 0.75rem; color: var(--text-muted); margin-left: 0.5rem; }

/* BADGE NAWIGACYJNY (nieprzeczytane wiadomości) */
.nav-badge {
    display:inline-flex; align-items:center; justify-content:center;
    background:var(--gold); color:#1a1200; font-family:var(--font-ui);
    font-size:0.68rem; font-weight:bold; border-radius:10px;
    min-width:16px; height:16px; padding:0 4px;
    vertical-align:middle; margin-left:2px;
}

.header-avatar-img {
width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}