@import url('https://fonts.googleapis.com/css2?family=Jost:wght@400;500;600;700;800&family=Sen:wght@700;800&display=swap');

:root {
    --bg: #f5f7fb;
    --surface: rgba(255, 255, 255, 0.96);
    --surface-soft: #eef3f8;
    --text: #17202b;
    --muted: #6b7280;
    --line: #d7dee8;
    --blue: #3b82f6;
    --blue-dark: #2563eb;
    --success: #119a6d;
    --danger: #c54c37;
    --shadow-soft: 0 12px 30px rgba(20, 28, 45, 0.08);
    --shadow-strong: 0 12px 28px rgba(20, 28, 45, 0.12);
    --radius-xl: 22px;
    --radius-lg: 18px;
    --dock-space: 150px;
    --keyboard-offset: 0px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    font-family: "Jost", sans-serif;
    color: var(--text);
    overflow-x: hidden;
    background:
        linear-gradient(180deg, rgba(245, 247, 251, 0.95), rgba(245, 247, 251, 0.98));
}

.game-screen {
    min-height: 100dvh;
}

/* HEADER */

.game-header {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    z-index: 40;
    width: 100%;
    margin: 0;
    padding: 0;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 10px 24px rgba(20, 28, 45, 0.12);
}

.game-header-inner {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0 0 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.header-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.meta-pill {
    min-height: 38px;
    padding: 0 12px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--surface-soft);
    color: var(--text);
    font-size: 14px;
    font-weight: 800;
}

.meta-pill-accent {
    background: #eff6ff;
    color: var(--blue-dark);
}

.timer {
    min-width: 84px;
    height: 52px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #edf8f4;
    border-left: 1px solid #caebde;
    flex-shrink: 0;
}

.timer span {
    font-family: "Sen", sans-serif;
    font-size: 22px;
    font-weight: 800;
    color: var(--success);
}

.timer.fin {
    background: #fff2ef;
    border-color: #f0d0c8;
}

.timer.fin span {
    color: var(--danger);
}

/* CONTENT */

.game-content {
    width: 100%;
    max-width: 980px;
    margin: 0 auto;
    padding: 14px 0 calc(var(--dock-space) + 18px);
    position: sticky;
    top: 50px;
}

.side-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    /*border-radius: var(--radius-xl);*/
    box-shadow: var(--shadow-soft);
    overflow: hidden;
}

.side-panel-head {
    padding: 16px 16px 10px;
    border-bottom: 1px solid var(--line);
}

.side-panel-head h2 {
    margin: 0;
    font-family: "Sen", sans-serif;
    font-size: 18px;
}

.side-panel-body {
    padding: 12px;
    max-height: calc(100svh - 265px);
    overflow: hidden;
    overflow-Y: auto;
}

/* ANSWERING / REVEAL */

.answer-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.answer-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 28px;
    gap: 10px;
    align-items: center;
    padding: 12px 14px;
    border-radius: 16px;
    background: var(--surface-soft);
    border: 1px solid transparent;
}

.answer-name {
    font-weight: 700;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.answer-status {
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: #e5e7eb;
    color: transparent;
    font-size: 13px;
}

.answer-row.is-sent .answer-status {
    background: rgba(17, 154, 109, 0.14);
    color: var(--success);
}

.answer-value {
    display: none;
}

/* REVEAL */
.side-panel[data-state="reveal"] .answer-row {
    grid-template-columns: minmax(0, 120px) minmax(0, 1fr);
}

.side-panel[data-state="reveal"] .answer-status {
    display: none;
}

.side-panel[data-state="reveal"] .answer-value {
    display: block;
    font-weight: 700;
    color: var(--text);
    text-align: right;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* RANKING */
.panel-view-ranking[hidden] {
    display: none;
}

/*.side-panel[data-state="ranking"] .panel-view-answers {
    display: none;
}

.side-panel[data-state="ranking"] .panel-view-ranking {
    display: none;
}*/



ul.ranking {
    list-style: none;
    margin: 0;
    padding: 0;
}

ul.ranking li {
    display: grid;
    grid-template-columns: 40px 1fr 40px;
    gap: 10px;
    align-items: center;
    margin-bottom: 8px;
    padding: 0;
    border-radius: 16px;
    background: var(--surface-soft);
}

ul.ranking li:last-child {
    margin-bottom: 0;
}

ul.ranking li .pos {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: #c1dcff;
    color: var(--blue-dark);
    font-size: 13px;
    font-weight: 800;
}
ul.ranking li .nom {
    font-size: 13px;
    font-weight: bolder;
}
ul.ranking li .pt {
    font-size: 13px;
    font-weight: 800;
    color: var(--muted);
    text-align: right;
    padding-right: 10px;
}

ul.ranking li.active {
    background: var(--success);
    color: #fff;
}

ul.ranking li.active .pos {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
}

ul.ranking li.active em {
    color: rgba(255, 255, 255, 0.92);
}

/* FOOTER */

.answer-dock {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(env(safe-area-inset-bottom, 0) + var(--keyboard-offset));
    z-index: 60;
    padding: 0;
    background: transparent;
}

.answer-dock-inner {
    width: 100%;
    margin: 0;
    padding: 10px 12px calc(12px + env(safe-area-inset-bottom, 0));
    background: rgba(255, 255, 255, 0.98);
    border-top: 1px solid var(--line);
    border-radius: 0;
    box-shadow: 0 -12px 28px rgba(20, 28, 45, 0.12);
    position: relative;
}

/* LETTERS */

.lettre {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 8px;
    position: relative;
    z-index: 2;
}

.lettre button {
    min-height: 46px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: var(--blue-dark);
    font-family: "Sen", sans-serif;
    font-size: 17px;
    font-weight: 800;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    appearance: none;
    -webkit-appearance: none;
    padding: 0;
    outline: none;
    transition: 0.15s ease;
}

.lettre button:active {
    transform: scale(0.98);
}

.lettre button.active {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}

.lettre button.is-disabled {
    opacity: 0.45;
    pointer-events: none;
}

/* COMPOSER */

.composer-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 58px;
    gap: 0;
    align-items: stretch;
    border: 1px solid var(--line);
    border-radius: 18px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 4px 14px rgba(20, 28, 45, 0.05);
    position: relative;
    z-index: 1;
}

textarea {
    width: 100%;
    min-height: 72px;
    max-height: 128px;
    padding: 15px 16px;
    border: 0;
    border-right: 1px solid var(--line);
    border-radius: 0;
    background: #fff;
    font: inherit;
    font-size: 16px;
    line-height: 1.35;
    color: var(--text);
    resize: none;
    outline: none;
    overflow-y: auto;
    box-shadow: none;
}

textarea::placeholder {
    color: #98a2b3;
}

textarea:focus {
    box-shadow: none;
}

textarea:disabled {
    background: #f3f4f6;
    color: #6b7280;
}

/* BUTTON */

.btn {
    min-height: 56px;
    width: 58px;
    padding: 0;
    border: 0;
    border-radius: 0;
    color: #fff;
    display: grid;
    place-items: center;
    position: relative;
    cursor: pointer;
    transition: background 0.2s ease, opacity 0.2s ease;
}

.btn.is-blue {
    background: var(--blue);
}

.btn.is-green {
    background: var(--success);
}

.btn.is-red {
    background: var(--danger);
}

.btn[disabled] {
    cursor: not-allowed;
    opacity: 1;
}

.btn .icon,
.btn .spinner {
    display: none;
    position: absolute;
}

.btn.is-blue .icon-send {
    display: block;
}

.btn.is-blue.is-loading .icon-send {
    display: none;
}

.btn.is-blue.is-loading .spinner {
    display: block;
}

.btn.is-green .icon-success {
    display: block;
}

.btn.is-red .icon-danger {
    display: block;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2.5px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* TABLETTE */

@media (min-width: 700px) {
    .game-header-inner {
        padding: 12px 18px;
    }

    .game-content {
        padding: 18px 18px calc(var(--dock-space) + 22px);
    }

    .answer-dock-inner {
        padding: 12px 18px calc(14px + env(safe-area-inset-bottom, 0));
    }

    .lettre button {
        min-height: 50px;
        font-size: 18px;
    }

    .composer-row {
        grid-template-columns: minmax(0, 1fr) 64px;
    }

    .btn {
        width: 64px;
    }

    .timer {
        min-width: 96px;
        height: 56px;
    }

    .timer span {
        font-size: 24px;
    }
}

.pause-indicator {
	display: none;
	align-items: center;
	justify-content: center;
	gap: 10px;
	padding: 10px 14px;
	border-radius: 14px;
	background: #f59e0b;
	color: #fff;
	font-weight: 800;
	box-shadow: 0 8px 20px rgba(245, 158, 11, 0.22);
}

.pause-indicator.is-visible {
	display: inline-flex;
}

.timer.is-paused {
	border-color: #f59e0b;
	background: #fff7ed;
}

.timer.is-paused span {
	color: #d97706;
}

.answer-area {
	position: relative;
}

.answer-lock {
	position: absolute;
	inset: 0;
	display: none;
	align-items: center;
	justify-content: center;
	flex-direction: column;
	gap: 8px;
	border-radius: 18px;
	background: rgba(15, 23, 42, 0.55);
	color: #fff;
	font-weight: 800;
	text-align: center;
	z-index: 20;
}

.answer-lock.is-visible {
	display: flex;
}

#panel-ranking .ranking-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

#panel-ranking .ranking-list li {
	position: relative;
	display: grid;
	grid-template-columns: 50px minmax(0, 1fr) 26px 60px;
	align-items: center;
	gap: 10px;
	min-height: 50px;
	/*padding: 8px 12px;*/
	border-radius: 14px;
	background: #f8fafc;
	border: 1px solid #e2e8f0;
	transition: background 0.15s ease, border-color 0.15s ease;
}

#panel-ranking .ranking-list li .pos {
	width: 50px;
	height: 50px;
	display: grid;
	place-items: center;
	border-radius: 14px;
	background: #e2e8f0;
	color: #475569;
	font-size: 12px;
	font-weight: 800;
	line-height: 1;
}
#panel-ranking .ranking-list li .meta .time {
    font-size: 10px;
}
#panel-ranking .ranking-list li .response {
    font-size: 11px;
}

#panel-ranking .ranking-list li .nom {
	min-width: 0;
	font-size: 15px;
	font-weight: bolder;
	color: #0f172a;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	text-align: left;
}

#panel-ranking .ranking-list li .points {
	font-style: normal;
	font-size: 14px;
	font-weight: 800;
	color: #1d4ed8;
	white-space: nowrap;
    position: relative;
    text-align: right;
    padding-right: 10px;
}
#panel-ranking .ranking-list li .points::before {
    content: "";
    position: absolute;
    top: -5px;
    left: 0;
    height: 30px;
    width: 1px;
    border-left: 1px solid #e2e8f0;
}


#panel-ranking .ranking-list .live-state {
	width: 22px;
	height: 22px;
	display: grid;
	place-items: center;
	border-radius: 999px;
	background: transparent;
	color: transparent;
	transition: all 0.15s ease;
}

#panel-ranking .ranking-list li.is-sent .live-state {
	background: #dcfce7;
	color: #16a34a;
}

#panel-ranking .ranking-list li.is-sent .live-state::before {
	content: "\f00c";
	font: var(--fa-font-solid);
	font-weight: 900;
	font-size: 11px;
}

#panel-ranking .ranking-list li.me {
	background: #eef6ff;
	border-color: #93c5fd;
}

#panel-ranking .ranking-list li.me .pos {
	background: #2563eb;
	color: #fff;
}

#panel-ranking .ranking-list li.me .nom {
	color: #1d4ed8;
	font-weight: 800;
}

#panel-ranking .ranking-list li:first-child:not(.me) .pos {
	background: #f59e0b;
	color: #fff;
}

#panel-ranking .ranking-list li.is-bump {
	background: #f1f5f9;
	border-color: #bfdbfe;
}

#panel-ranking .ranking-list li .score-delta {
	position: absolute;
	right: 10px;
	top: -8px;
	padding: 3px 8px;
	border-radius: 999px;
	font-size: 11px;
	font-weight: 900;
	line-height: 1;
	color: #fff;
	box-shadow: 0 6px 16px rgba(15, 23, 42, 0.14);
}

#panel-ranking .ranking-list li .score-delta.is-plus {
	background: #16a34a;
}

#panel-ranking .ranking-list li .score-delta.is-minus {
	background: #dc2626;
}

#panel-ranking .ranking-list li .score-delta.is-show {
	animation: ranking-delta-in 180ms ease forwards;
}

@keyframes ranking-delta-in {
	from {
		opacity: 0;
		transform: translateY(6px) scale(0.92);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}