/* TorahSphere Games */
.tsg {
	--tsg-g: #2e7d32;
	--tsg-y: #b07d00;
	--tsg-b: #6b6f73;
	--tsg-line: #c9ccd1;
	--tsg-ink: currentColor;
	--tsg-accent: var(--wp--preset--color--primary, #1f4e79);
	font-size: 1rem;
	line-height: 1.5;
	margin: 1.5em 0;
}
.tsg h3 { margin: 1.4em 0 .4em; }
.tsg h4 { margin: 1.2em 0 .4em; }
.tsg-small { font-size: .9em; opacity: .85; }
.tsg-btns { display: flex; flex-wrap: wrap; gap: .6em; }
.tsg-btn {
	display: inline-block; padding: .65em 1.3em; border-radius: 8px; border: 2px solid var(--tsg-accent);
	background: var(--tsg-accent); color: #fff !important; font-weight: 700; font-size: 1.05rem; text-decoration: none !important;
	cursor: pointer; line-height: 1.2;
}
.tsg-btn:hover, .tsg-btn:focus-visible { filter: brightness(1.1); }
.tsg-btn-2 { background: transparent; color: var(--tsg-accent) !important; }

/* Game */
.tsg-wordle { max-width: 520px; margin-left: auto; margin-right: auto; text-align: center; }
.tsg-kicker { font-weight: 800; font-size: 1.35rem; margin: 0; letter-spacing: .02em; }
.tsg-sub { margin: .25em 0 1em; }
.tsg-msg { min-height: 1.6em; font-weight: 700; margin-bottom: .4em; }
.tsg-msg.is-on { animation: tsg-fade .2s ease; }
.tsg-board { display: grid; gap: 6px; justify-content: center; margin: 0 auto 1em; }
.tsg-row { display: grid; grid-template-columns: repeat(var(--tsg-len, 5), 1fr); gap: 6px; }
.tsg-tile {
	width: min(15vw, 62px); height: min(15vw, 62px); box-sizing: border-box; border: 2px solid var(--tsg-line);
	display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: min(8vw, 2rem);
	text-transform: uppercase; user-select: none;
}
.tsg-board.len-7 .tsg-tile { width: min(11.5vw, 56px); height: min(11.5vw, 56px); font-size: min(6.5vw, 1.8rem); }
.tsg-board.len-6 .tsg-tile { width: min(13vw, 58px); height: min(13vw, 58px); }
.tsg-tile.filled { border-color: #8a8f96; }
.tsg-tile.g, .tsg-tile.y, .tsg-tile.b { color: #fff; border-color: transparent; }
.tsg-tile.g, .tsg-key.g, .tsg-mini.g { background: var(--tsg-g); }
.tsg-tile.y, .tsg-key.y, .tsg-mini.y { background: var(--tsg-y); }
.tsg-tile.b, .tsg-key.b, .tsg-mini.b { background: var(--tsg-b); }
.tsg-tile.flip { animation: tsg-flip .45s ease both; }
.tsg-row.shake { animation: tsg-shake .4s ease; }
@keyframes tsg-flip { 0% { transform: rotateX(0); } 50% { transform: rotateX(90deg); } 100% { transform: rotateX(0); } }
@keyframes tsg-shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
@keyframes tsg-fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .tsg-tile.flip, .tsg-row.shake { animation: none; } }

.tsg-keys { display: flex; flex-direction: column; gap: 7px; margin: 0 auto 1em; max-width: 500px; }
.tsg-keys.is-done { opacity: .6; }
.tsg-krow { display: flex; gap: 5px; justify-content: center; }
.tsg-key {
	flex: 1 1 0; min-width: 0; height: 56px; border: 0; border-radius: 6px; background: #dfe2e6; color: #111;
	font-weight: 700; font-size: 1.05rem; cursor: pointer; padding: 0; touch-action: manipulation;
}
.tsg-key.wide { flex: 1.6 1 0; font-size: .85rem; }
.tsg-key.g, .tsg-key.y, .tsg-key.b { color: #fff; }
.tsg-key:focus-visible { outline: 3px solid var(--tsg-accent); outline-offset: 1px; }

.tsg-result { text-align: left; border: 1px solid var(--tsg-line); border-radius: 10px; padding: 1em 1.2em; margin: 1em 0; }
.tsg-result h3 { margin-top: 0; }
.tsg-answer { font-size: 1.15rem; }
.tsg-answer strong { letter-spacing: .08em; }
.tsg-verse { margin: 1em 0; padding: .4em 1em; border-left: 4px solid var(--tsg-g); }
.tsg-verse p { margin: 0 0 .3em; }
.tsg-verse mark { background: #e3f1e4; color: inherit; padding: 0 .15em; font-weight: 700; }
.tsg-verse cite { font-style: normal; font-size: .9em; }
.tsg-signup { background: rgba(31, 78, 121, .07); border-radius: 8px; padding: .8em 1em; margin: 1em 0; }

.tsg-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5em; text-align: center; margin: 1em 0; }
.tsg-stats b { display: block; font-size: 1.7rem; line-height: 1.1; }
.tsg-stats span { font-size: .85em; }

.tsg-how { text-align: left; margin-top: 1em; }
.tsg-how summary { cursor: pointer; font-weight: 700; }
.tsg-how ul { list-style: none; padding-left: 0; }
.tsg-how li { margin: .4em 0; }
.tsg-mini { display: inline-flex; width: 1.7em; height: 1.7em; align-items: center; justify-content: center; color: #fff; font-weight: 800; margin-right: .4em; border-radius: 3px; }

/* Archive */
.tsg-archive { max-width: 520px; margin-left: auto; margin-right: auto; }
.tsg-archive ul { list-style: none; padding: 0; margin: 0; }
.tsg-archive li { display: flex; justify-content: space-between; gap: .6em; padding: .55em 0; border-bottom: 1px solid var(--tsg-line); }
.tsg-archive li.is-active { font-weight: 700; }
.tsg-archive .tsg-date { display: block; font-size: .85em; opacity: .8; }
.tsg-num { font-weight: 700; }
.tsg-res { font-weight: 700; white-space: nowrap; }

/* Profile + leaderboard */
.tsg-dist { max-width: 420px; }
.tsg-bar { display: flex; align-items: center; gap: .5em; margin: 4px 0; }
.tsg-bar-n { width: 1em; font-weight: 700; }
.tsg-bar-v { background: var(--tsg-g); color: #fff; font-weight: 700; text-align: right; padding: 0 .5em; border-radius: 3px; min-width: 1.6em; }
.tsg-table { width: 100%; border-collapse: collapse; }
.tsg-table th, .tsg-table td { text-align: left; padding: .5em .4em; border-bottom: 1px solid var(--tsg-line); vertical-align: top; }
.tsg-table tr.is-me td { background: rgba(46, 125, 50, .1); font-weight: 700; }
.tsg-grid { font-size: .8em; line-height: 1.1; margin: .3em 0 0; padding: 0; background: none; border: 0; white-space: pre; }
.tsg-score { font-weight: 800; }
.tsg-settings label { display: block; margin: .6em 0; }
.tsg-settings input[type="text"] { display: block; width: 100%; max-width: 320px; padding: .55em; font-size: 1rem; margin-top: .25em; }
.tsg-check input { width: 1.2em; height: 1.2em; vertical-align: middle; margin-right: .4em; }
.tsg-saved { margin-left: .8em; font-weight: 700; }

/* Card on daily posts */
.tsg-card { display: flex; align-items: center; gap: 1em; flex-wrap: wrap; border: 2px solid var(--tsg-g); border-radius: 10px; padding: .9em 1.1em; }
.tsg-card-tiles { display: flex; gap: 4px; }
.tsg-card-tiles span { width: 22px; height: 22px; border-radius: 3px; background: var(--tsg-b); }
.tsg-card-tiles span:nth-child(1), .tsg-card-tiles span:nth-child(4) { background: var(--tsg-g); }
.tsg-card-tiles span:nth-child(3) { background: var(--tsg-y); }
.tsg-card-text { flex: 1 1 200px; }
.tsg-note { border: 1px solid var(--tsg-line); border-radius: 10px; padding: 1em 1.2em; }

/* Games hub */
.tsg-hub-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1em; margin-bottom: 2em; }
.tsg-hub-card { border: 1px solid var(--tsg-line); border-radius: 12px; padding: 1em 1.2em; background: rgba(255, 255, 255, .6); }
.tsg-hub-card h3 { margin-top: 0; }
.tsg-hub .tsg-archive { max-width: none; }
.tsg-hub .tsg-archive li a { text-decoration: none; }

/* Filter chips (same look as the search page) */
.tsg .ts-filters { margin: 1em 0 1.5em; }
.tsg .ts-filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5em; margin: .5em 0; }
.tsg .ts-filter-label { width: 5.5em; font-size: .8em; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; opacity: .75; }
.tsg .ts-chip { display: inline-flex; align-items: center; gap: .35em; padding: .45em 1em; border: 1px solid #d9d6cf; border-radius: 999px; background: #fff; color: inherit; text-decoration: none; font-size: .95em; }
.tsg .ts-chip.is-active { background: var(--tsg-accent); border-color: var(--tsg-accent); color: #fff; }
.tsg .ts-chip-n { font-size: .8em; opacity: .7; }

/* Search results that have a game */
.ts-has-wordle .wp-block-post-title a::after { content: " \1F9E9"; font-size: .8em; }

/* Weekly Crossword */
.tsg-xw { max-width: 980px; margin-left: auto; margin-right: auto; container: tsgxw / inline-size; }
.tsg-xw .tsg-head { text-align: center; }
.tsg-xw .tsg-msg { text-align: center; }
.tsg-xw-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6em; margin-bottom: .6em; }
.tsg-xw-timer { font-weight: 800; font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.tsg-xw-tools { display: flex; flex-wrap: wrap; gap: .4em; }
.tsg-tool { border: 1px solid var(--tsg-line); background: #fff; color: inherit; border-radius: 999px; padding: .4em .9em; font-size: .9rem; cursor: pointer; }
.tsg-tool:hover { border-color: var(--tsg-accent); }
.tsg-xw-clue { display: flex; align-items: center; gap: .5em; background: #eef3f8; border-radius: 8px; padding: .55em .6em; margin-bottom: .6em; min-height: 3.2em; position: sticky; top: 0; z-index: 3; }
.tsg-xw-cluetext { flex: 1; }
.tsg-xw-prev, .tsg-xw-next { border: 0; background: none; font-size: 1.6rem; line-height: 1; cursor: pointer; padding: 0 .3em; color: inherit; }
.tsg-xw-wrap { position: relative; max-width: calc(var(--w, 13) * 40px); margin: 0 auto 1em; }
.tsg-xw-grid { display: grid; grid-template-columns: repeat(var(--w), 1fr); border: 2px solid #222; background: #222; gap: 1px; user-select: none; }
.tsg-xw-wrap { width: 100%; }
.tsg-xw-grid { width: 100%; }
.tsg-xw-cell { position: relative; aspect-ratio: 1 / 1; background: #fff; cursor: pointer; }
.tsg-xw-cell.blk { background: #222; cursor: default; }
.tsg-xw-cell .n { position: absolute; top: 1px; left: 2px; font-size: clamp(7px, 1.6vw, 11px); line-height: 1; font-weight: 600; }
.tsg-xw-cell .l { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: clamp(12px, 3.6vw, 22px); text-transform: uppercase; padding-top: 3px; }
.tsg-xw-cell.word { background: #dbe8f5; }
.tsg-xw-cell.cur { background: #ffd666; }
.tsg-xw-cell.bad .l { color: #c62828; text-decoration: line-through; }
.tsg-xw-cell.rev::after { content: ""; position: absolute; top: 0; right: 0; border-style: solid; border-width: 0 7px 7px 0; border-color: transparent #c62828 transparent transparent; }
.tsg-xw-input { position: absolute; opacity: 0; border: 0; padding: 0; margin: 0; font-size: 16px; caret-color: transparent; background: transparent; color: transparent; z-index: 2; pointer-events: none; }
.tsg-xw-lists { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2em; }
.tsg-xw-lists ol { list-style: none; padding: 0; margin: 0; }
.tsg-xw-lists li { padding: .35em .5em; border-radius: 6px; cursor: pointer; margin: 2px 0; }
.tsg-xw-lists li b { display: inline-block; min-width: 1.6em; }
.tsg-xw-lists li.is-active { background: #dbe8f5; }
.tsg-xw-lists li.is-done { opacity: .55; }
.tsg-xw.is-done .tsg-xw-tools, .tsg-xw.is-done .tsg-xw-clue { display: none; }
.tsg-xw-answers { padding-left: 1.1em; }
.tsg-xw-answers li { margin: .3em 0; }
@container tsgxw (min-width: 860px) {
	.tsg-xw-play { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); grid-template-areas: "bar bar" "clue clue" "grid lists"; column-gap: 1.5em; }
	.tsg-xw-bar { grid-area: bar; }
	.tsg-xw-clue { grid-area: clue; }
	.tsg-xw-wrap { grid-area: grid; margin: 0; }
	.tsg-xw-lists { grid-area: lists; grid-template-columns: 1fr; max-height: 620px; overflow: auto; }
	.tsg-xw-lists > div { max-height: none; }
}
@media (max-width: 600px) { .tsg-xw-lists { grid-template-columns: 1fr; } }
.tsg-card-grid { display: grid; grid-template-columns: repeat(3, 10px); gap: 2px; }
.tsg-card-grid span { width: 10px; height: 10px; background: #fff; outline: 1px solid #555; }
.tsg-card-grid span:nth-child(3), .tsg-card-grid span:nth-child(7) { background: #222; }
.tsg-card-xw { margin-top: .8em; }
.ts-has-xword .wp-block-post-title a::after { content: " \270F\FE0F"; font-size: .8em; }
.ts-has-wordle.ts-has-xword .wp-block-post-title a::after { content: " \1F9E9 \270F\FE0F"; }

/* Reading links under the game titles */
.tsg-links { display: block; margin-top: .6em; padding: .55em .9em; background: rgba(31, 58, 95, .06); border-radius: 10px; font-size: .95em; line-height: 1.6; }
.tsg-links a { font-weight: 600; }
.tsg-note-line { display: block; margin-top: .5em; }
@media (max-width: 600px) { .tsg-links .tsg-dot { display: block; height: 0; overflow: hidden; } }

/* Parsha badges */
.tsg-badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .7em; margin-bottom: 1.5em; }
.tsg-badge { border: 1px dashed var(--tsg-line); border-radius: 12px; padding: .8em; text-align: center; display: flex; flex-direction: column; gap: .2em; opacity: .85; }
.tsg-badge.is-done { border: 2px solid #b8860b; background: #fff8e6; opacity: 1; }
.tsg-badge-icon { font-size: 1.8rem; line-height: 1; }
.tsg-badge-msg { background: #fff8e6; border: 1px solid #e6c46a; border-radius: 10px; padding: .6em .9em; }
