/*

* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
	user-select: none;
	-webkit-user-select: none;
	-webkit-touch-callout: none;
}
*/

.cm-game-container {
	font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
	/*background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);*/
	min-height: 100vh;
	display: flex;
	justify-content: center;
	align-items: center;
	touch-action: pan-y pinch-zoom;
	padding: 10px;
}


.word-definition {
    display: inline-block;
    margin: 2px;
    padding: 2px 5px 2px 5px;
    border-radius: 8px;
    back: repeat-x;
    background-color: lightgray;
    background: linear-gradient(135deg, #ececec, #d9d9d9);
}

.word-definitions {
	display: flow;
}

.container {
	/*background: white;*/
	border-radius: 2px;
	padding: 15px;
	/*box-shadow: 0 20px 60px rgba(0,0,0,0.4);*/
	max-width: 400px;
	width: 100%;
}
.dict-selector {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 10px;
  box-shadow: 0 4px 16px rgba(30,60,114, 0.07);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.dict-title{
  cursor: default;
}
.dict-title summary{
  cursor: pointer;
}
.dict-title summary{
  cursor: pointer;
}

.dict-title {
  font-size: 0.9em;
  font-weight: bold;
  color: white;
  background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
  border-radius: 6px;
  padding: 5px;
  margin-bottom: 10px;

}

.dict-checkbox-group {
  display: -webkit-inline-box;
}

/* Style personnalisé pour chaque case */
.dict-checkbox-item {
  display: flex;
  align-items: center;
  gap: 7px;
  position: relative;
  cursor: pointer;
  font-size: 1em;
  color: #1e3c72;
  padding: 3px 0;
  transition: color 0.18s;
}

.dict-checkbox-item input[type="checkbox"] {
  appearance: none;
  margin: 0;
  width: 19px;
  height: 19px;
  border: 2.5px solid #667eea;
  border-radius: 7px;
  background: #fff;
  transition: border-color 0.18s, background 0.18s;
  cursor: pointer;
  position: relative;
}

.dict-checkbox-item input[type="checkbox"]:checked {
  border-color: #45a049;
  background: linear-gradient(135deg, #4caf50 0%, #8bc34a 100%);
}

.dict-checkbox-item input[type="checkbox"]:checked::after {
  content: '';
  display: block;
  position: absolute;
  left: 4px;
  top: 0px;
  width: 8px;
  height: 14px;
  border: solid #fff;
  border-width: 0 3px 3px 0;
  transform: rotate(45deg) scale(1.1);
}

.dict-checkbox-item:hover,
.dict-checkbox-item input[type="checkbox"]:focus + label {
  color: #764ba2;
}

.dict-checkbox-label {
  cursor: pointer;
  transition: color 0.18s;
  user-select: text;
}

.dict-desc {
  font-size: 0.92em;
  color: white;
  font-weight: bold;  
  border-radius: 5px;
  padding: 2px 8px;
  font-weight: 400;
  letter-spacing: 0.01em;
  user-select: text;
}

@media (max-width: 500px) {
  .dict-checkbox-group {
    flex-direction: column;
    gap: 7px 0;
  }
}

h1 {
	text-align: center;
	color: #1e3c72;
	margin-bottom: 10px;
	font-size: 2.2em;
}

.loading {
	text-align: center;
	padding: 40px;
}

.loading-spinner {
	border: 4px solid #f3f3f3;
	border-top: 4px solid #667eea;
	border-radius: 50%;
	width: 50px;
	height: 50px;
	animation: spin 1s linear infinite;
	margin: 0 auto 20px;
}

@keyframes spin {
	0% { transform: rotate(0deg); }
	100% { transform: rotate(360deg); }
}

.error-message {
	background: #f8d7da;
	color: #721c24;
	padding: 20px;
	border-radius: 12px;
	border: 2px solid #f44336;
	text-align: center;
}

.error-message h2 {
	margin-bottom: 10px;
}

.share-box {
	text-align: center;
	cursor: pointer;
}
.share-box a {
	text-decoration: none;
    color: black;
	font-size: x-small;
    font-weight: bold;
}

.share-btn {
	max-width: 100px;
	max-height: 100px;
}

.share-links {
	display: inline-grid;
	grid-template-columns: repeat(3, 1fr);
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 15px;
	margin-bottom: 10px;
	max-width: 200px;
}

.share-content {
	text-align: center;
}


.share-btn.link {
	align-items: center;
	gap: 0.5rem;
	position: relative;
	overflow: hidden;
}

/* Groupe d'icônes : superposées (absolu sur un container inline-block) */
.share-btn.link .icon-group {
	position: relative;
	display: inline-block;
	width: 56px;
	height: 56px;
}

/* Icônes superposées */
.share-btn.link .icon {
	position: absolute;
	top: 0;
	left: 0;
	width: 56px;
	height: 56px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: opacity 0.2s, transform 0.2s;
	pointer-events: none;
}

.share-btn.link .icon svg {
	width: 100%;
	height: 100%;
	fill: currentColor;
}

/* Les deux icônes s’empilent, seule la bonne est visible */
.share-btn.link .icon-check {
	opacity: 0;
	transform: scale(0.5);
	z-index: 2;
}

.share-btn.link .icon-copy {
	opacity: 1;
	transform: scale(1);
	z-index: 1;
}

/* État copié : cache copy et montre coche */
.share-btn.link.copied .icon-check {
	opacity: 1;
	transform: scale(1.1);
}

.share-btn.link.copied .icon-copy {
	opacity: 0;
	transform: scale(0.5);
}

.share-btn.link.copied {
	animation: copied-pulse 0.4s;
}

@keyframes copied-pulse {
	0%   { transform: scale(1); }
	50%  { transform: scale(1.07); }
	100% { transform: scale(1); }
}

/* Pour garder le texte lisible et aligné */
.share-btn.link .label {
	margin-left: 0.6em;
	vertical-align: middle;
}

.stats {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 5px;
	margin-bottom: 15px;
}

.top-actions {
		grid-column: 2 / span 2;
}
.actions {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 5px;
	margin-bottom: 	5px;
}

.stat-card {
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
	padding: 10px;
	border-radius: 12px;
	text-align: center;
	color: white;
}

.top-share {    
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 10px;
    border-radius: 12px;
    text-align: center;
    color: white;
}


.progress-bar {
	background: #e0e0e0;
	height: 8px;
	border-radius: 4px;
	overflow: hidden;
	margin-top: 8px;
}

.progress-fill {
	background: linear-gradient(90deg, #4CAF50, #8BC34A);
	height: 100%;
	transition: width 0.3s ease;
	border-radius: 4px;
}

.grid-container {
	position: relative;
	margin-bottom: 25px;
	background: #f5f5f5;
	padding: 8px;
	border-radius: 15px;
	touch-action: none;
}

.grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 30px;
	position: relative;
}

.letter-cell {
	aspect-ratio: 1;
	background: #584170;
	border: none;
	border-radius: 6px;
	font-size: 2em;
	font-weight: bold;
	color: white;
	cursor: pointer;
	transition: all 0.1s ease;
	text-transform: uppercase;
	position: relative;
	box-shadow: 0px 0px 1px 14px #584170;
	display: flex;
	align-items: center;
	justify-content: center;
	touch-action: none;
	padding: 4px;
}

.letter-cell:hover {
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.letter-cell.selected {
	background: linear-gradient(135deg, #FF6B6B, #EE5A6F);
	transform: scale(0.95);
}

.letter-cell.suggested {
	background: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 100%);
	animation: pulse 1.5s ease-in-out infinite;
	box-shadow: 0 0 20px rgba(253, 203, 110, 0.6);
}

.letter-cell .points {
	display: none;
	position: absolute;
	bottom: -4px;
	right: -4px;
	font-size: 0.4em;
	background: rgba(255,255,255,0.3);
	padding: 2px 5px;
	border-radius: 4px;
}

.current-word-display {
	background: #f7f7f7;
	padding: 15px;
	border-radius: 12px;
	margin-bottom: 15px;
	text-align: center;
	min-height: 100px;
	display: flex;
	flex-direction: column;
	justify-content: center;
	position: relative;
}

.message {
	text-align: center;
	padding: 8px 12px;
	border-radius: 8px;
	font-weight: bold;
	font-size: 0.9em;
	position: absolute;
	top: 5px;
	left: 50%;
	transform: translateX(-50%);
	width: calc(100% - 30px);
	animation: fadeIn 0.3s ease;
}

.message.info {
	background: #d1ecf1;
	color: #0c5460;
	border: 2px solid #17a2b8;
}

.current-word {
	font-size: 2em;
	font-weight: bold;
	color: #1e3c72;
	letter-spacing: 3px;
	text-transform: uppercase;
	margin-bottom: 5px;
}

.word-points {
	display: none;
	font-size: 1em;
	color: #4CAF50;
	font-weight: bold;
}

.buttons {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px;
	margin-bottom: 20px;
}

button {
	padding: 5px;
	font-size: 1.1em;
	border: none;
	border-radius: 12px;
	cursor: pointer;
	font-weight: bold;
	transition: all 0.2s ease;
	text-transform: uppercase;
}

button:hover {
	transform: translateY(-2px);
	box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.btn-validate {
	background: linear-gradient(135deg, #4CAF50, #45a049);
	color: white;
	width: 100%;
}

.btn-clear {
	background: linear-gradient(135deg, #f44336, #da190b);
	color: white;
	width: 100%;
}

.btn-share {
	width: 100%;
	height: 100%;
	background-color: transparent;
}

.btn-new-grid {
	background: linear-gradient(135deg, #2196F3, #1976D2);
	color: white;
	width: 100%;
	margin-bottom: 5px;
}

.btn-show-words {
	background: linear-gradient(135deg, #FF9800, #F57C00);
	color: white;
	width: 100%;
}

.found-words {
	background: #f7f7f7;
	padding: 15px;
	border-radius: 12px;
	max-height: 200px;
	overflow-y: auto;
	display:none;
}

.found-words h3 {
	color: #1e3c72;
	margin-bottom: 15px;
	font-size: 1.2em;
}

.words-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
	gap: 8px;
}

.word-tag {
	background: linear-gradient(135deg, #667eea, #764ba2);
	color: white;
	padding: 8px 12px;
	border-radius: 8px;
	font-size: 0.9em;
	text-align: center;
	font-weight: 600;
	text-transform: uppercase;
}

@keyframes fadeIn {
	from { opacity: 0; transform: translate(-50%, -10px); }
	to { opacity: 1; transform: translate(-50%, 0); }
}

.message.success {
	background: #d4edda;
	color: #155724;
	border: 2px solid #4CAF50;
}

.message.error {
	background: #f8d7da;
	color: #721c24;
	border: 2px solid #f44336;
}

.hidden {
	display: none;
}

.share-modal, .all-words-modal {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0,0,0,0.7);
	display: none;
	justify-content: center;
	align-items: center;
	z-index: 1000;
	padding: 20px;
}

.all-words-modal:not(.hidden) {
	display: flex;
}
.all-words-modal:not(.hidden), .share-modal:not(.hidden) {
	display: flex;
}

.modal-content {
	background: white;
	border-radius: 12px;
	padding: 30px;
	max-width: 500px;
	max-height: 80vh;
	overflow-y: auto;
	width: 100%;
}

.modal-content h2 {
	color: #1e3c72;
	margin-bottom: 20px;
	font-size: large;
}

.words-by-length {
	margin-bottom: 20px;
}

.length-group h4 {
	color: #667eea;
	margin-bottom: 10px;
}

.btn-close-modal {
	background: linear-gradient(135deg, #f44336, #da190b);
	color: white;
	width: 100%;
	margin-top: 20px;
}

::-webkit-scrollbar {
	width: 8px;
}

::-webkit-scrollbar-track {
	background: #f1f1f1;
	border-radius: 10px;
}

::-webkit-scrollbar-thumb {
	background: #667eea;
	border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
	background: #764ba2;
}
.completion-message {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    text-align: center;
}

.completion-message h2 {
    margin: 0 0 10px 0;
    font-size: 24px;
}

.completion-message p {
    margin: 0;
    font-size: 16px;
}

.completion-message strong {
    font-size: 20px;
    text-decoration: underline;
}
.suggestion-stats {
    margin-top: 10px;
    font-size: 14px;
    opacity: 0.9;
}

.suggestion-stats.perfect {
    font-size: 16px;
    font-weight: bold;
    color: #FFD700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

/* Styles spécifiques pour la modal de bienvenue */
.welcome-rules-list {
    list-style: none;
    padding-left: 0;
    margin: 0.5rem 0;
}

.welcome-rules-list li {
    padding-left: 1.5rem;
    position: relative;
    line-height: 1.6;
}

.welcome-rules-list li:before {
    content: "→";
    position: absolute;
    left: 0;
    color: #2196F3;
    font-weight: bold;
}

.welcome-actions {
    margin: 1.5rem 0;
    text-align: center;
}

.welcome-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0.5rem;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.welcome-checkbox:hover {
    background-color: rgba(33, 150, 243, 0.1);
}

.welcome-checkbox input[type="checkbox"] {
    cursor: pointer;
    width: 18px;
    height: 18px;
}

#welcomeModal h2 {
    color: #2196F3;
    margin-bottom: 1.5rem;
}

#welcomeModal .words-by-length {
    margin-bottom: 1.5rem;
}

#welcomeModal .words-by-length h4 {
    color: #333;
    margin-bottom: 0.75rem;
    border-left: 4px solid #2196F3;
    padding-left: 0.75rem;
}

#welcomeModal .words-by-length p {
    color: #666;
    line-height: 1.6;
    margin: 0.5rem 0;
}

#welcomeModal .btn-close-modal {
    background: linear-gradient(135deg, #2196F3, #1976D2);
    margin-top: 0.5rem;
}

#welcomeModal .btn-close-modal:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(33, 150, 243, 0.4);
}
/* Styles pour la sélection des dictionnaires avec sources */
.dict-checkbox-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.dict-checkbox-item:hover {
    background-color: rgba(33, 150, 243, 0.05);
}

.dict-checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

.dict-checkbox-wrapper input[type="checkbox"] {
    cursor: pointer;
    width: 18px;
    height: 18px;
}

.dict-checkbox-wrapper label {
    cursor: pointer;
    flex: 1;
}

.btn-sources {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.btn-sources:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 10px rgba(76, 175, 80, 0.4);
}

.btn-sources:active {
    transform: scale(0.95);
}

/* Style pour le drapeau dans les labels */
.dict-desc .flag {
    height: 1em;
    vertical-align: middle;
    margin-left: 0.25rem;
}

/* Styles pour la modal des sources */
.sources-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 1rem 0;
    max-height: 60vh;
    overflow-y: auto;
}

.source-item {
    border-left: 4px solid #2196F3;
    background: rgba(33, 150, 243, 0.05);
    border-radius: 4px;
    transition: all 0.2s ease;
}

.source-item:hover {
    background: rgba(33, 150, 243, 0.1);
    border-left-width: 6px;
}

.source-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    text-decoration: none;
    color: #333;
    transition: color 0.2s;
}

.source-link:hover {
    color: #2196F3;
}

.source-number {
    font-weight: bold;
    color: #2196F3;
    min-width: 24px;
}

.source-url {
    flex: 1;
    word-break: break-all;
    font-size: 0.9rem;
    line-height: 1.4;
}

.source-icon {
    font-size: 1.2rem;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.source-link:hover .source-icon {
    opacity: 1;
}

.no-sources {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 2rem;
}

/* Responsive */
@media (max-width: 768px) {
.sources-link {
    font-size: 0.9rem;
}

.source-link {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
}

.source-url {
    font-size: 0.85rem;
}
}
.grid-4x4 {
    grid-template-columns: repeat(4, 1fr);
}

.grid-5x5 {
    grid-template-columns: repeat(5, 1fr);
}

.grid-6x6 {
    grid-template-columns: repeat(6, 1fr);
}

.grid-7x7 {
    grid-template-columns: repeat(7, 1fr);
}

.grid-size-selector {
    margin-bottom: 1rem;
    background: white;
    border-radius: 8px;
    padding: 0.5rem;
}

.grid-size-options {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    flex-wrap: wrap;
}

.grid-size-options label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.5rem 1rem;
    border: 2px solid #ddd;
    border-radius: 4px;
    transition: all 0.2s;
}

.grid-size-options label:hover {
    border-color: #2196F3;
    background: #E3F2FD;
}

.grid-size-options input[type="radio"]:checked + label,
.grid-size-options label:has(input:checked) {
    border-color: #2196F3;
    background: #2196F3;
    color: white;
    font-weight: bold;
}