html, body{
	height: 100%;
}

body{
	font-family: Monospace;
	background: #fff;
	overflow: hidden;
	margin: 0;
}

a {
	color: black;
	text-decoration: underline;
}

#offline{
	padding: 20px 10px;
	font-size: 14px;
}

#offline .big{
	font-size: 32px;
	line-height: 32px;
}

.chat{
	padding: 0 10px;
	overflow: hidden;
	height: 100%;
	display: flex;
	flex-direction: column;
	max-width: 950px;
	margin-right: auto;
	margin-left: auto;
	position: relative;
}

#msgs {
	flex-grow: 1;
	overflow-y: visible;
	display: flex;
	flex-shrink: 0;
	flex-direction: column;
}

.msgs {
	margin: 0;
	padding: 0;
	padding-bottom: 5px;
}

.msgs li {
	list-style: none;
	margin: 0;
	overflow: hidden;
	margin-bottom: 5px;
	display: flex;
}

.message-from-self {
	padding-right: 6px;
	justify-content: flex-end;
	text-align: right;
	display: flex;
}

#typing li {
	display: inline-block;
	margin-right: 5px;
}

.msgs li .body {
	display: block;
	overflow: hidden;
	word-wrap: break-word;
        white-space: pre-wrap;
}

.msgs li .message {
	position: relative;
	padding: 6px 12px;
	border-radius: 1.3em;
	text-align: left;
	background: #e5e4e4;
	display: inline-block;
	max-width: 450px;
}

.msgs li .prefix{
	margin-top: 10px;
}

.msgs li .prefix,
.msgs li .suffix {
	padding-left: 12px;
	display: block;
	color: rgba(0, 0, 0, .40);
	font-size: 12px;
	clear: both;
}

@media only screen and (max-width: 600px){
	.msgs li .message {
		max-width: 75vw;
	}
}

.msgs li .writing {
	
}

.msgs li .writing .one,
.msgs li .writing .two,
.msgs li .writing .three {
	opacity: .2;
	animation: dot 2s infinite;
	-webkit-animation: dot 2s infinite;
}

.msgs li .writing .one {
	animation-delay: 0.0s;
	-webkit-animation-delay: 0.0s;
}

.msgs li .writing .two {
	animation-delay: 0.5s;
	-webkit-animation-delay: 0.5s;
}

.msgs li .writing .three {
	animation-delay: 1s;
	-webkit-animation-delay: 1s;
	padding-right: 2px;
}

@-webkit-keyframes dot {
		0% { opacity: .2; }
	 25% { opacity:	1; }
	100% { opacity: .2; }
}

@keyframes dot {
		0% { opacity: .2; }
	 25% { opacity:	1; }
	100% { opacity: .2; }
}

.msgs li.in .message {
	float: left;
	margin-left: 20px;
}

.msgs li.in .message:before,
.msgs li.in .message:after {
	right: 100%;
	/*top: 50%;*/ top: 18px;
	border: solid transparent;
	content: " ";
	height: 0;
	width: 0;
	position: absolute;
	pointer-events: none;
}

.msgs li.in .message:after {
	border-right-color: #fff;
	border-width: 8px;
	margin-top: -8px;
}

.msgs li.in .message:before {
	border-right-color: #bbb;
	border-width: 9px;
	margin-top: -9px;
}

.msgs li.in .prefix,
.msgs li.in .suffix {
	padding-left: 30px;
	text-align: left;
}

.msgs li.out .message {
	float: right;
	margin-right: 20px;
}

.msgs li.out .message:before,
.msgs li.out .message:after {
	left: 100%;
	/*top: 50%;*/ top: 18px;
	border: solid transparent;
	content: " ";
	height: 0;
	width: 0;
	position: absolute;
	pointer-events: none;
}

.msgs li.out .message:after {
	border-left-color: #fff;
	border-width: 8px;
	margin-top: -8px;
}

.msgs li.out .message:before {
	border-left-color: #bbb;
	border-width: 9px;
	margin-top: -9px;
}

.msgs li.out .prefix,
.msgs li.out .suffix {
	padding-right: 30px;
	text-align: right;
}

.msgs li.split {
	text-align: center;
	position: relative;
	padding: 20px 0;
}

.msgs li.split:before {
	content: "";
	display: block;
	border-top: solid 1px #bbb;
	width: 100%;
	height: 1px;
	position: absolute;
	top: 50%;
	z-index: 1;
}

.msgs li.split .text {
	display: inline-block;
	background: #e5e5e5;
	padding: 0 20px;
	position: relative;
	z-index: 5;
	color: #666;
}

#emic {
	position: absolute;
	border: 1px solid #bbb;
	width: 250px;
	height: 210px;
	margin: 0;
	padding: 0;
	font-size: 0;
	overflow: auto;
	margin-left: auto;
	bottom: 88px;
	right: 0px;
}

#emic li{
	display: inline-block;
	list-style-type: none;
	padding: 5px;
	cursor: pointer;
}

#emic li:hover{
	box-shadow: 0px 0px 5px 1px white;
}

.chat-box {
	flex-grow: 1;
	display: flex;
	flex-direction: column;
	overflow-y: scroll;
	position: relative;
}

.chat-form	{
	background: #fff;
	padding: 10px;
	position: relative;
}

.chat-form .form-control {
	display: inline-block;
	width: 100%;
	border: 1px solid #bbb;
	border-radius: 0;
	padding: 10px;
	margin: 0;
	color: #333;
	background-color: #fff;
	font-size: 14px;
	box-shadow: none;
	/*min-height: 100px;*/
	height: 39px;
	box-sizing: border-box;
}

.chat-form .form-control:focus {
	outline: 0;
	box-shadow: none;
}

#send{
	background: none;
	color: white;
	text-transform: uppercase;
	padding: 5px;
	margin: 0 10px 0 0;
	border: 1px solid white;
	border-radius: 0;
}

#emic_btn {
	float: right;
	margin: 0;
	position: absolute;
	right: 10px;
	bottom: 40px;
	margin-top: 35px;
	z-index: 100;
	background: none;
	border: none;
	padding: 8px;
}

#users, #users li{
	margin: 0;
	padding: 0;
	display: inline-block;
}

#users li:after {
	content: "•";
	padding: 0 5px;
}

#users li:last-child:after {
	content: "";
}
/* Gallinarium welcome / onboarding */
.gallinarium-welcome {
        max-width: 720px;
        margin: 0 auto 22px auto;
        padding: 18px 20px;
        text-align: left;
        line-height: 1.5;
}

.gallinarium-welcome h2 {
        margin: 0 0 16px 0;
        text-align: center;
        font-size: 24px;
}

.gallinarium-welcome p {
        margin: 0 0 12px 0;
}

.welcome-translation {
        margin-top: 16px;
        text-align: center;
}

.welcome-translation a {
        font-weight: bold;
        text-decoration: underline;
}

@media (max-width: 600px) {
        .gallinarium-welcome {
                padding: 10px 12px;
                margin-bottom: 16px;
                font-size: 14px;
                line-height: 1.4;
        }

        .gallinarium-welcome h2 {
                font-size: 20px;
                margin-bottom: 12px;
        }

        .gallinarium-welcome p {
                margin-bottom: 10px;
        }
}

/* Vrijeme poruke */
.msg-time {
        display: inline-block;
        margin-left: 7px;
        font-size: 10px;
        opacity: 0.55;
        vertical-align: baseline;
}

/* Gallinarium presence bar */
#presence-bar {
        display: flex;
        align-items: center;
        gap: 10px;
        position: relative;
}

#human-users-wrap {
        position: relative;
        display: inline-block;
}

#human-users-toggle {
        background: none;
        border: none;
        color: inherit;
        padding: 0;
        cursor: pointer;
        font: inherit;
}

#human-users-menu {
        display: none;
        position: absolute;
        right: 0;
        bottom: 24px;
        min-width: 180px;
        max-height: 260px;
        overflow-y: auto;
        margin: 0;
        padding: 8px 10px;
        list-style: none;
        z-index: 1000;
        background: #222;
        border: 1px solid #666;
        box-shadow: 0 4px 12px rgba(0,0,0,0.35);
}

#human-users-menu.open {
        display: block;
}

#human-users-menu li {
        display: block;
        padding: 4px 2px;
        white-space: nowrap;
}

#human-users-menu li:after {
        content: "";
        padding: 0;
}

/* Nick + vrijeme u istom redu na vrhu poruke */
.msg-header {
        display: flex;
        align-items: baseline;
        gap: 7px;
        width: 100%;
}

.msg-header .prefix {
        display: inline-block;
        margin: 0;
}

.msg-header .msg-time {
        display: inline-block;
        margin: 0;
        font-size: 10px;
        opacity: 0.55;
        white-space: nowrap;
}

/* Razmak izmedju nick/vrijeme zaglavlja i teksta poruke */
.msg-header {
        margin-bottom: 8px;
}

/* Razmak ispod cijele poruke */
.message {
        margin-bottom: 8px;
}

/* Donja presence traka - SEND + system botovi + korisnici u jednom redu */
#send {
        display: inline-block;
        vertical-align: middle;
}

#presence-bar {
        display: inline-flex;
        align-items: center;
        gap: 10px;
        vertical-align: middle;
        width: auto;
}

#presence-bar #users {
        display: inline-flex;
        align-items: center;
        margin: 0;
        padding: 0;
}

#human-users-wrap {
        display: inline-block;
        vertical-align: middle;
}

/* Gallinarium Progenies presence menu */
#progenies-wrap {
        position: relative;
        display: inline-block;
        vertical-align: middle;
}

#progenies-toggle {
        background: none;
        border: none;
        color: inherit;
        padding: 0;
        cursor: pointer;
        font: inherit;
}

#progenies-menu {
        display: none;
        position: absolute;
        right: 0;
        bottom: 24px;
        min-width: 180px;
        max-height: 260px;
        overflow-y: auto;
        margin: 0;
        padding: 8px 10px;
        list-style: none;
        z-index: 1000;
        background: #222;
        border: 1px solid #666;
        box-shadow: 0 4px 12px rgba(0,0,0,0.35);
}

#progenies-menu.open {
        display: block;
}

#progenies-menu li {
        display: block;
        padding: 4px 2px;
        white-space: nowrap;
}

#progenies-menu li:after {
        content: "";
        padding: 0;
}


/* ===== REFUGIUM VIEW ===== */

#main-view-nav {
        position: fixed;
        top: 12px;
        right: 16px;
        z-index: 1000;
        display: flex;
        align-items: center;
        gap: 7px;
        padding: 5px 8px;
        background: rgba(20, 20, 24, 0.72);
        border: 1px solid rgba(255,255,255,0.08);
        border-radius: 8px;
        backdrop-filter: blur(6px);
}

#main-view-nav button {
        border: 0;
        background: transparent;
        color: #777;
        font-size: 11px;
        letter-spacing: 1.4px;
        cursor: pointer;
        padding: 4px 5px;
}

#main-view-nav button.active {
        color: #ddd;
}

#main-view-nav span {
        color: #444;
}

#refugium-view {
        display: none;
        width: 100%;
        height: 100dvh;
        min-height: 100dvh;
        background: #111;
        color: #aaa;
}

#refugium-view.open {
        display: flex;
        align-items: center;
        justify-content: center;
}

.refugium-inner {
        text-align: center;
        padding: 30px;
        transform: translateY(-5vh);
}

.refugium-inner h1 {
        margin: 0;
        color: #d0d0d0;
        font-size: clamp(30px, 5vw, 52px);
        font-weight: 300;
        letter-spacing: 8px;
}

.refugium-ps {
        margin-top: 8px;
        color: #666;
        font-size: 13px;
        letter-spacing: 2px;
}

.refugium-building {
        margin-top: 70px;
        display: flex;
        flex-direction: column;
        gap: 8px;
        color: #777;
        font-size: 14px;
}

.refugium-building strong {
        color: #999;
        font-weight: 400;
}

.refugium-building span {
        font-size: 12px;
        color: #5f5f5f;
}

@media (max-width: 600px) {
        #main-view-nav {
                top: 8px;
                right: 8px;
        }

        .refugium-inner {
                padding: 22px;
                transform: translateY(-3vh);
        }

        .refugium-inner h1 {
                font-size: 30px;
                letter-spacing: 6px;
        }

        .refugium-building {
                margin-top: 55px;
        }
}

/* ===== REFUGIUM MODE SWITCH ===== */

body:not(.refugium-mode) #refugium-view {
        display: none;
}

body.refugium-mode .chat {
        display: none;
}

body.refugium-mode #refugium-view {
        display: flex;
        align-items: center;
        justify-content: center;
}


/* ===== REFUGIUM PRIVATE WORKSHOP ===== */

#refugium-workshop {
        display: flex;
        width: min(900px, calc(100vw - 40px));
        height: min(760px, calc(100dvh - 100px));
        flex-direction: column;
        margin: auto;
        color: #aaa;
}


.refugium-workshop-head {
        flex: 0 0 auto;
        text-align: center;
        padding: 20px 0 24px;
        border-bottom: 1px solid #292929;
}

.refugium-workshop-head h1 {
        margin: 0;
        color: #d0d0d0;
        font-size: 28px;
        font-weight: 300;
        letter-spacing: 6px;
}

.refugium-workshop-ps {
        margin-top: 6px;
        color: #666;
        font-size: 12px;
        letter-spacing: 2px;
}

.refugium-library-status {
        margin-top: 18px;
        color: #666;
        font-size: 11px;
        letter-spacing: 1.5px;
}

#refugium-messages {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        padding: 24px 8px;
}

.refugium-empty {
        padding-top: 40px;
        text-align: center;
        color: #555;
        font-size: 13px;
}

.refugium-compose {
        flex: 0 0 auto;
        display: flex;
        gap: 10px;
        padding-top: 14px;
        border-top: 1px solid #292929;
}

#refugium-input {
        flex: 1;
        box-sizing: border-box;
        resize: none;
        min-height: 42px;
        max-height: 120px;
        padding: 11px 12px;
        background: #0e0e0e;
        color: #ccc;
        border: 1px solid #333;
        outline: none;
        font: inherit;
}

#refugium-input:focus {
        border-color: #555;
}

#refugium-send {
        flex: 0 0 auto;
        padding: 0 18px;
        background: transparent;
        color: #888;
        border: 1px solid #3a3a3a;
        cursor: pointer;
}

@media (max-width: 600px) {
        body.refugium-mode #refugium-view {
                align-items: flex-start;
                box-sizing: border-box;
                padding: 52px 12px 12px;
                overflow: hidden;
        }

        #refugium-workshop {
                width: 100%;
                height: 100%;
                min-height: 0;
                margin: 0;
        }

        .refugium-workshop-head {
                padding: 10px 0 14px;
        }

        #refugium-messages {
                padding: 14px 4px;
        }

        .refugium-compose {
                padding-top: 10px;
        }
}

/* ===== REFUGIUM MESSAGES ===== */

.refugium-message {
        margin-bottom: 24px;
}

.refugium-message-author {
        margin-bottom: 7px;
        color: #777;
        font-size: 10px;
        letter-spacing: 1.5px;
        text-transform: uppercase;
}

.refugium-message-body {
        color: #bbb;
        font-size: 13px;
        line-height: 1.65;
        white-space: pre-wrap;
        overflow-wrap: anywhere;
}


/* REFUGIUM thinking indicator */
.refugium-thinking {
        display: inline-block;
        letter-spacing: 4px;
        animation: refugium-pulse 1.4s ease-in-out infinite;
}

@keyframes refugium-pulse {
        0%, 100% { opacity: 0.25; }
        50%      { opacity: 0.9; }
}


/* Gallina / Gallus - vizualno razlikovanje govornika */
.speaker-gallina {
        margin-left: 12px;
}

.speaker-gallus {
        margin-left: 32px;
}

.speaker-gallina .msg-header .prefix::before {
        content: "🐔 ";
        text-decoration: none;
}

.speaker-gallus .msg-header .prefix::before {
        content: "🐓 ";
        text-decoration: none;
}

/* Na uskom ekranu cuvamo sirinu chata */
@media (max-width: 600px) {
        .speaker-gallina {
                margin-left: 6px;
        }

        .speaker-gallus {
                margin-left: 16px;
        }
}

/* Gallina/Gallus - svi govornici poravnati, razlikuju ih samo ikone */
.speaker-gallina,
.speaker-gallus {
        margin-left: 0 !important;
}

/* Gallina / Gallus - VARIJANTA 4 bez bocnih crta */

/* Gallus - blaga topla nijansa cijele kartice */
.speaker-gallus .message {
        background: rgba(232, 154, 69, 0.16);
}

.speaker-gallus .msg-header .prefix {
        color: #e89a45;
        text-decoration: none !important;
}

.speaker-gallus .msg-header .prefix::before {
        content: "🐓 ";
}

/* Gallina - blaga ruzicasto-ljubicasta nijansa cijele kartice */
.speaker-gallina .message {
        background: rgba(228, 90, 167, 0.16);
}

.speaker-gallina .msg-header .prefix {
        color: #e45aa7;
        text-decoration: none !important;
}

.speaker-gallina .msg-header .prefix::before {
        content: "🐔 ";
}

/* REFUGIUM je sada izravno workshop; stara javna fasada se ne prikazuje. */
#refugium-view .refugium-inner {
        display: none;
}

/* REFUGIUM — informativna poveznica */
.refugium-info-link {
    margin-top: 12px;
    text-align: center;
}

#refugium-info-open {
    color: #777;
    font-size: 12px;
    letter-spacing: 0.5px;
    text-decoration: none;
    transition: color 0.2s ease;
}

#refugium-info-open:hover,
#refugium-info-open:focus-visible {
    color: #ddd;
    text-decoration: underline;
}

/* REFUGIUM — unutarnji informativni prikaz */
#refugium-info-panel[hidden] {
    display: none !important;
}

#refugium-info-panel {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    background: #111;
}

#refugium-info-back {
    flex-shrink: 0;
    align-self: flex-start;
    margin: 16px;
    padding: 8px 12px;
    color: #ddd;
    background: transparent;
    border: 1px solid #555;
    border-radius: 5px;
    cursor: pointer;
}

#refugium-info-frame {
    flex: 1;
    width: 100%;
    min-height: 0;
    border: 0;
}

/* REFUGIUM — položaj unutarnjeg informativnog prikaza */
#refugium-view {
    position: relative;
}

#refugium-info-panel:not([hidden]) {
    inset: auto;
    width: min(900px, calc(100vw - 40px));
    height: min(760px, calc(100dvh - 100px));
    margin: auto;
    border: 1px solid #333;
    border-radius: 8px;
    overflow: hidden;
}

/* REFUGIUM — podnožje */
.refugium-footer {
    width: min(900px, calc(100vw - 40px));
    margin: 8px auto 16px;
    text-align: center;
    font-size: 12px;
    color: #777;
}

.refugium-footer .refugium-info-link {
    margin: 0 0 6px;
}

.refugium-footer a {
    color: #888;
    text-decoration: none;
}

.refugium-footer a:hover {
    color: #ddd;
    text-decoration: underline;
}

/* REFUGIUM — podnožje ispod razgovora */
#refugium-view {
    flex-direction: column;
}

#refugium-workshop {
    flex-shrink: 1;
    min-height: 0;
    margin: auto auto 0;
}

.refugium-footer {
    flex-shrink: 0;
    margin: 12px auto 18px;
}

/* REFUGIUM — podnožje lijevo/desno */
.refugium-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.refugium-footer .refugium-info-link {
    margin: 0;
    text-align: left;
}

.refugium-footer > a {
    text-align: right;
}

@media (max-width: 480px) {
    .refugium-footer {
        flex-wrap: wrap;
    }
}

/* REFUGIUM — plave poveznice u podnožju */
.refugium-footer a,
#refugium-info-open {
    color: #6caaff;
}

.refugium-footer a:hover,
#refugium-info-open:hover {
    color: #a8ceff;
}

/* REFUGIUM — završna boja podnožja */
body.refugium-mode .refugium-footer a,
body.refugium-mode #refugium-info-open {
    color: #6caaff !important;
}

/* REFUGIUM — povezano podnožje s crticom */
.refugium-footer {
    justify-content: center !important;
    gap: 8px !important;
}

.refugium-footer .refugium-info-link::after {
    content: " – ";
    color: #888;
    margin-left: 8px;
}

/* REFUGIUM — obje poveznice zajedno lijevo */
.refugium-footer {
    justify-content: flex-start !important;
}
