

body {
	background: #222;
	color: white;
	font-family: Montserrat, sans-serif;
	padding: 30px;
}

input {
	padding: 10px;
	font-size: 16px;
	margin-right: 10px;
	
}

button {
	padding: 10px 15px;
	font-size: 16px;
	cursor: pointer;
}

.game {
	width:100%;
	max-width: 1150px;
	padding: 20px;
	background: #333;
	border-radius: 0 0 12px 12px;
	margin: 0 auto;
	
}

.viv {
	margin-top: 10px;
	
}

.correct{
	background: #2f7d32;
	color: lightgreen;
}

.wrong{
	background: #7d2f2f;
	color: salmon;
}

.mybi{
	background: #997520;
	color: #f5bf42;
}


#attempts {
  white-space: pre-line;
}

.attempts-header,
.attempt-row {
	display: grid;
	grid-template-columns:repeat(9, 116px);	
	gap: 8px;
	width: max-content;
	
}

.attempts-header {
	margin-top: 16px;
	font-weight: bold;
	
}

.attempt-row {
	margin-top: 6px;
}


.attempts-header span,
.attempt-row span{
	width:100%;
	min-width:0;
	padding: 8px;
	border-radius: 6px;
	background: #555;
	
}

.attempt-row span.correct{
	background: #2f7d32;
	color: white;
}

.attempt-row span.wrong{
	background: #7d2f2f;
	color: white;
}

.attempt-row span.partial {
  background: #c77700;
  color: white;
}

.attempt-row span.unknown {
  display: grid;
  place-items: center;
  font-size: 32px;
}

.attempts-scroll {
	max-width: 100%;
	overflow-x: auto;
	padding-bottom:8px;
	
}

* {
	box-sizing: border-box;
}

.agent-avatar {
	width:100px;
	height:100px;
	object-fit:cover;
	Border-radius: 8px;
	display:block;
	
}



.suggestion-item{
	display: flex;
	align-items: center;
	gap: 10px;
	width: 212px;
	background: #444;
	color: white;
	border: none;
	text-align: left;
}

.suggestion-avatar {
	width: 40px;
	height: 40px;
	object-fit: cover;
	border-radius: 6px;
	
}

.search-box {
	position: relative;
	display: inline-block;
	margin-right: 10px;
	vertical-align: top;
	
}

.search-box input{
	margin-right: 0;
}

.suggestions {
	position: absolute;
	top: calc(100% + 4px);
	left: 0;
	width:100%;
	z-index: 10;
	background: #444;
	Border-radius:6px;
	max-height: 220px;
	overflow-y: auto;
}

.suggestion-item{
	width: 100%;
}

.suggestions-empty{
	max-height: 220px;
	padding: 12px;
	
	color:#bbb;
	background: #444;
	
}

.suggestion-item.is-selected{
	background: #777;
	outline: 2px solid #aaa;
}

.category-icon {
	width: 100px;
	height: 100px;
	object-fit: contain;
	display: block;
	margin: 0 auto;
}

.game-navigation {
  width: 100%;
  max-width: 1150px;
  margin: 0 auto -1px;
}

.category-tab,
.mode-tab {
  transition:
    background 0.15s ease,
    color 0.15s ease,
    opacity 0.15s ease;
}

.category-tab:not(.active),
.mode-tab:not(.active) {
  opacity: 0.65;
}

.category-tab.active,
.mode-tab.active {
  color: white;
  box-shadow: inset 0 -3px 0 #f5c542;
}

.category-tabs,
.mode-tabs {
  display: flex;
  gap: 8px;
}

.mode-tabs[hidden] {
  display: none;
}

.category-tabs {
  align-items: flex-end;
}

.category-tab {
  padding: 14px 28px;
  border: none;
  border-radius: 12px 12px 0 0;
  background: #181818;
  color: #999;
}

.category-tab.active {
  background: #333;
  color: white;
}

.mode-tabs {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 14px 16px;
  background: #333;
    border-radius: 0 12px 0 0;
}

.mode-tab {
  padding: 12px 28px;
  border: none;
  border-radius: 6px;
  background: #444;
  color: #bbb;
}

.mode-tab.active {
  background: #5a5a5a;
  color: white;
}


.stats-dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

#statsDialog h2,
#statsDialog h3 {
  margin-bottom: 12px;
}

#resetStatsButton {
  border: 1px solid #a94b4b;
  background: #5f2929;
  color: white;
}

#resetStatsButton:hover {
  background: #7d2f2f;
}

.mode-tab.active {
  background: #5a5a5a;
  color: white;
  border-radius: 6px 6px 0 0;
}

#statsDialog {
  width: min(500px, calc(100% - 32px));
  padding: 24px;
  border: none;
  border-radius: 12px;
  background: #333;
  color: white;
}

#statsDialog::backdrop {
  background: rgba(0, 0, 0, 0.7);
}

.stats-grid p:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.stats-grid p {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  margin: 0;
  border-radius: 8px;
  background: #555;
}

.stats-grid .stats-label {
    font-size: 16px;
    font-weight: normal;
}

.stats-grid .stats-value {
    font-size: 24px;
    font-weight: bold;
}

.save-transfer {
  margin-top: 10px;
}

.save-buttons {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.mode-panel {
  display: none;
}

.mode-panel.active {
  display: block;
}

.mode-panel[data-panel="bangbo"] .game {
  border-radius: 12px;
}

.endless-search-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.endless-round-status {
    display: flex;
    align-items: center;
    gap: 32px;
}

.endless-attempt-squares {
    display: flex;
    gap: 6px;
}

.endless-attempt-square {
    width: 28px;
    height: 28px;
    border-radius: 5px;
    background: #666;
    transition:
        background-color 0.2s ease,
        transform 0.2s ease;
}

.endless-attempt-square.failed {
    background: #8f3434;
    transform: scale(0.94);
}

.endless-score-counter {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 12px;
    border-radius: 6px;
    background: #555;
    white-space: nowrap;
}

.endless-score-counter strong {
    font-size: 22px;
}





/* Основной блок Bangboo */
.bangboo-game {
  max-width: 1150px;
}

/* Верхняя карточка */
.bangboo-question-card {
  display: grid;
  grid-template-columns: 260px 1fr;
  align-items: center;
  gap: 32px;

  padding: 24px;
  background: #2b2b2b;
  border-radius: 10px;
}

/* Портрет */
.bangboo-portrait {
  display: block;
  width: 100%;
  height: 260px;
  object-fit: contain;
}

/* Правая часть верхней карточки */
.bangboo-question-content h1 {
  margin-top: 0;
  margin-bottom: 4px;
}

.bangboo-masked-name {
  margin-top: 0;
  margin-bottom: 24px;

  font-size: 28px;
  font-weight: bold;
  text-transform: uppercase;
}

.bangboo-search-box {
  width: 100%;
  max-width: 320px;
}

.bangboo-search-box input {
  width: 100%;
  box-sizing: border-box;
}

/* Четыре подсказки */
.bangboo-hints {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;

  margin-top: 20px;
  padding: 20px;

  background: #2b2b2b;
  border-radius: 10px;
}

.bangboo-hint {
  display: grid;
  place-items: center;

  min-width: 0;
  min-height: 130px;

  background: #3b3b3b;
  border-radius: 8px;
  overflow: hidden;

  font-size: 64px;
  font-weight: bold;
}

.bangboo-hint img {
  display: block;
  width: 100%;
  height: 110px;
  object-fit: contain;
}


/* Оформления для каточек попыток банбу */
.bangboo-attempts {
  display: flex;
  flex-direction: column;
  gap: 8px;

  margin-top: 20px;
}

.bangboo-attempt {
  display: flex;
  align-items: center;
  gap: 14px;

  padding: 10px 14px;
  border-radius: 8px;

  background: #3b3b3b;
}

.bangboo-attempt img {
  width: 64px;
  height: 64px;
  object-fit: contain;
}

.bangboo-attempt span {
  font-size: 20px;
  font-weight: bold;
}

.bangboo-attempt-wrong {
  border-left: 6px solid #a83b3b;
}

.bangboo-attempt-correct {
  border-left: 6px solid #3b9b4f;
}

.category-tabs {
  width: 100%;
  align-items: flex-end;
}

.global-stats-button {
  align-self: center;
  margin-left: auto;

  border: 1px solid #555;
  border-radius: 8px;

  background: #333;
  color: white;
}

.global-stats-button:hover {
  background: #444;
}

.global-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  margin-bottom: 8px;
}

.global-actions button,
.global-actions a {
  border: 1px solid #555;
  border-radius: 8px;
  background: #333;
  color: white;
}

.global-actions button:hover,
.global-actions a:hover {
  background: #444;
}

.global-actions .kofi-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 42px;
    height: 42px;
    padding: 0;
    flex-shrink: 0;

    line-height: 1;
    text-decoration: none;
}

#rulesDialog {
  width: min(760px, calc(100% - 32px));
  max-height: calc(100vh - 40px);
  padding: 24px;

  overflow-y: auto;

  border: none;
  border-radius: 12px;

  background: #333;
  color: white;
}

#rulesDialog::backdrop {
  background: rgba(0, 0, 0, 0.7);
}

.rules-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.rules-dialog-header h2 {
  margin: 0;
}

.rules-content section {
  margin-top: 20px;
  padding: 16px;

  border-radius: 10px;
  background: #444;
}

.rule-color-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.rule-color-card {
  display: flex;
  align-items: center;
  gap: 12px;

  min-width: 0;
  padding: 12px;

  border-radius: 8px;
  background: #353535;
}

.rule-color-card p {
  margin: 4px 0 0;
  color: #ccc;
}

.rule-color-square {
  flex: 0 0 52px;
  width: 52px;
  height: 52px;
  border-radius: 6px;
}

.rule-correct {
  background: #2f7d32;
}

.rule-wrong {
  background: #7d2f2f;
}

.rule-partial {
  background: #c77700;
}

.rules-section h4 {
  margin-bottom: 8px;
}

.rule-race-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.rule-race-card {
  margin: 0;
  padding: 12px;

  text-align: center;

  border-radius: 8px;
  background: #353535;
}

.rule-race-card img {
  display: block;
  width: 72px;
  height: 72px;
  margin: 0 auto 8px;

  object-fit: contain;
}

.rule-race-card figcaption {
  font-weight: bold;
}

.rule-note {
  margin-bottom: 0;
  color: #ccc;
}

.endless-rules-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.endless-rule-card {
    padding: 16px;
    border-radius: 8px;
    background: #353535;
}

.endless-rule-card p {
    margin: 12px 0 0;
    color: #ccc;
}

.attempt-example {
    display: flex;
    gap: 6px;
    margin-top: 12px;
}

.attempt-example span {
    width: 28px;
    height: 28px;
    border-radius: 5px;
    background: #666;
}

.score-example {
    width: fit-content;
    margin-top: 12px;
    padding: 6px 18px;
    border-radius: 6px;
    background: #555;
    font-size: 24px;
    font-weight: bold;
}

.bangboo-rule-hints {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.bangboo-rule-hint {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 16px 10px;
    text-align: center;
    border-radius: 8px;
    background: #353535;
}

.bangboo-rule-number {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #666;
    font-size: 20px;
    font-weight: bold;
}

.endless-result-card {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 20px;
    padding: 16px;
    border-radius: 10px;
    background: #444;
}

/* Сохраняет скрытие карточки, несмотря на display: flex. */
.endless-result-card[hidden] {
    display: none;
}

.endless-result-portrait {
    width: 80px;
    height: 80px;
    object-fit: contain;
}

.endless-result-info {
    flex: 1;
    min-width: 140px;
}

.endless-result-info p {
    margin: 0 0 6px;
    color: #ddd;
}

.endless-result-info strong {
    font-size: 20px;
}

.classic-result-card {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 20px;
    padding: 16px;
    border-radius: 10px;
    background: #444;
}

.classic-result-card[hidden] {
    display: none;
}

.classic-result-portrait {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    object-fit: contain;
}

.classic-result-info {
    min-width: 0;
}

.classic-result-info p {
    margin: 6px 0;
    color: #ddd;
}

.classic-result-info strong {
    font-size: 20px;
}
.classic-result-card {
    flex-wrap: wrap;
}

.classic-result-info {
    flex: 1;
}

#classicShareButton {
    margin-left: auto;
}

.classic-share-feedback {
    flex-basis: 100%;
}

#classicShareStatus {
    margin: 0;
}

#classicShareText {
    width: 100%;
    margin-top: 10px;
    padding: 10px;
    resize: vertical;
}

.bangboo-input-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
    max-width: 470px;
}

.bangboo-search-box {
    flex: 1;
    min-width: 0;
    max-width: 320px;
}

.bangboo-share-controls {
    flex-shrink: 0;
}

.bangboo-share-feedback {
    max-width: 470px;
    margin-top: 12px;
}

.bangboo-share-feedback p {
    margin: 0;
}



#bangbooShareText {
    width: 100%;
    padding: 10px;
    resize: vertical;
}

.daily-reset-timer {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    color: #ddd;
}

.daily-reset-timer[hidden] {
    display: none;
}

.daily-reset-time {
    padding: 5px 9px;
    border-radius: 6px;
    background: #555;
    color: white;
    font-variant-numeric: tabular-nums;
}

.daily-reset-reload {
    margin-left: 4px;
}

#statsDialog {
    max-height: calc(100vh - 32px);
    overflow-y: auto;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 3px solid #f2c94c;
    outline-offset: 3px;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
.global-actions a:focus-visible {
    outline: 3px solid #f2c94c;
    outline-offset: 3px;
}

.kofi-link img {
    display: block;
    width: 27px;
    height: 27px;
    object-fit: contain;
}

#supportDialog {
    width: min(520px, calc(100% - 32px));
    padding: 24px;

    border: none;
    border-radius: 12px;

    background: #333;
    color: white;
}

#supportDialog::backdrop {
    background: rgba(0, 0, 0, 0.7);
}

.support-dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.support-dialog-header h2 {
    margin: 0;
}

.support-dialog-text {
    margin: 22px 0;
    line-height: 1.6;
    color: #eee;
}

.support-dialog-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 11px 16px;
    border-radius: 8px;

    background: #ff6433;
    color: white;

    font-weight: 700;
    text-decoration: none;
}

.support-dialog-link:hover {
    background: #ff7a52;
}














/* для телефона */
@media (max-width: 700px) {
  .bangboo-question-card {
    grid-template-columns: 1fr;
  }

  .bangboo-portrait {
    height: 220px;
  }

  .bangboo-hints {
    grid-template-columns: repeat(2, 1fr);
  }

  .bangboo-result {
    flex-direction: column;
    text-align: center;
  }
}


@media (max-width: 480px){
	body {
		margin: 0;
		padding: 12px;
	}
	
	.game{
		width:100%;
		padding: 16px;
		
	}
	
	.search-box {
		display: block;
		width: 100%;
		margin-right: 0;
		
	}
	
	.search-box input{
		width: 100%
		
	}
	
}

@media (max-width: 600px) {
  .rule-color-grid {
    grid-template-columns: 1fr;
  }

  .rule-race-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
    .endless-rules-grid {
        grid-template-columns: 1fr;
    }
}


@media (max-width: 600px) {
    .bangboo-rule-hints {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}


@media (max-width: 700px) {
    .endless-search-row {
        flex-wrap: wrap;
    }

    .endless-round-status {
        width: 100%;
        justify-content: space-between;
    }
}

@media (max-width: 500px) {
    .bangboo-input-row {
        flex-wrap: wrap;
    }
}

@media (max-width: 600px) {
    .category-tabs {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
    }

    .global-actions {
        order: -1;
        width: 100%;
        margin-left: 0;
        justify-content: flex-end;
    }

    .global-actions button,
	.global-actions a {
        padding: 9px 11px;
        font-size: 14px;
		flex-wrap: wrap;
    }

    .category-tab {
        flex: 1;
        min-width: 0;
        padding: 12px 10px;
    }

    .mode-tabs {
        padding: 10px;
    }

    .mode-tab {
        flex: 1;
        min-width: 0;
        padding: 11px 10px;
    }
}

.splash-game {
    text-align: center;
}

.splash-image-frame {
    width: min(100%, 800px, calc(65vh * var(--splash-ratio, 1.7778)));
    aspect-ratio: 16 / 9;
    margin: 0 auto 20px;
}

#splashCanvas {
    display: block;
    width: 100%;
    height: 100%;
}

.splash-game .search-box {
    width: min(100%, 360px);
    margin-right: 0;
}

.splash-game .search-box input {
    width: 100%;
}

#splashAttempts {
    display: grid;
    gap: 8px;
    margin-top: 20px;
    text-align: left;
}

#splashDailyTimer {
    justify-content: center;
}

#splashShareButton,
#splashReloadButton {
    display: block;
    margin: 16px auto 0;
}

#splashShareButton[hidden],
#splashReloadButton[hidden] {
    display: none;
}

#splashShareText {
    width: 100%;
    max-width: 480px;
    padding: 10px;
    resize: vertical;
}

.mode-tabs {
    flex-wrap: wrap;
}

.pixel-game {
    text-align: center;
}

.pixel-portrait-frame {
    width: min(100%, 360px);
    aspect-ratio: 3 / 4;
    margin: 0 auto 16px;
}

#pixelCanvas {
    display: block;
    width: 100%;
    height: 100%;
}

#pixelFeedback {
    margin-top: 12px;
}

#pixelAttempts {
    margin-top: 20px;
    display: grid;
    gap: 8px;
    text-align: left;
}

.pixel-game .search-box {
    width: min(100%, 360px);
    margin-right: 0;
}

.pixel-game .search-box input {
    width: 100%;
}

#pixelDailyTimer {
    justify-content: center;
}

#pixelShareButton,
#pixelReloadButton {
    display: block;
    margin: 16px auto 0;
}

#pixelShareButton[hidden],
#pixelReloadButton[hidden] {
    display: none;
}

#pixelShareText {
    width: 100%;
    max-width: 480px;
    padding: 10px;
    resize: vertical;
}

.pixel-attempt {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    background: #444;
    border-left: 5px solid #a83b3b;
    overflow-wrap: anywhere;
}

.pixel-attempt-correct {
    border-left-color: #3b9b4f;
}

.pixel-attempt img {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

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

    .mode-tab {
        flex: 1 0 auto;
        padding: 10px 6px;
        font-size: 14px;
    }

    .pixel-attempt {
        gap: 8px;
        grid-template-columns: 40px minmax(0, 1fr);
    }

    .pixel-attempt img {
        width: 40px;
        height: 40px;
    }

}









@media (max-width: 600px) {
    #rulesDialog,
    #statsDialog,
	#supportDialog	{
        width: calc(100% - 16px);
        max-height: calc(100vh - 16px);
        padding: 16px;
    }

    .stats-dialog-actions {
        flex-wrap: wrap;
        gap: 10px;
    }

    #resetStatsButton {
        margin-left: auto;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid p:last-child:nth-child(odd) {
        grid-column: auto;
    }

    .save-buttons {
        flex-wrap: wrap;
    }

    .save-buttons button {
        flex: 1;
        min-width: 130px;
    }
}
