:root{
	--bg: #f3f4f6;
	--panel: #ffffff;
	--text: #111827;
	--muted: #6b7280;
	--tile-border: #d3d6da;
	--correct: rgb(16, 185, 129);
	--present: rgb(168, 85, 247);
	--elsewhere: rgb(234, 179, 8);
	--absent: #787c7e;
	--revealed: rgb(156, 163, 175);
	--white: #ffffff;
	--black: rgb(0, 0, 0);
	--keyboard-absent: #d1d5db;
}

body { font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
.container { max-width: 560px; margin: 20px auto; background: var(--panel); padding: 20px 28px; border-radius: 10px; box-shadow: 0 6px 20px rgba(15,23,42,0.08); }
.app-header { text-align: center; margin-bottom: 8px; }
.brand { font-size: 26px; letter-spacing: 0.6px; margin: 0; font-weight: 700; }

.game-meta { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 10px 0 6px; }
.game-links { font-size: 14px; color: var(--muted); text-align: center; }
.game-links a { color: var(--text); font-weight: 600; text-decoration: none; }
.game-links a:hover { text-decoration: underline; }
.game-links .sep { color: var(--muted); margin: 0 6px; }

.cube-grid { display: grid; gap: 8px; margin: 16px 0 12px; }
.cube-row { display: flex; justify-content: center; }
.board-title { text-align: left; font-size: 16px; letter-spacing: 0.3px; text-transform: uppercase; color: var(--muted); margin: 10px 0 6px; }
.tile { width: 64px; height: 64px; line-height: 64px; text-align: center; margin: 4px; font-size: 28px; font-weight: 700; text-transform: uppercase; border-radius: 6px; background: var(--white); border: 2px solid var(--tile-border); box-sizing: border-box; }
.tile.hidden { color: var(--muted); background: transparent; border-style: dashed; }
.tile.revealed { background: var(--revealed); color: var(--white); }

.attempts { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.attempt-grid { display: inline-block; padding: 4px; border-radius: 6px; background: #f9fafb; }
.attempt-row { display: flex; justify-content: center; gap: 3px; margin: 3px 0; }
.attempt-tile { width: 18px; height: 18px; border-radius: 3px; background: var(--white); border: 1px solid #e5e7eb; box-sizing: border-box; font-size: 9px; font-weight: 700; display: flex; align-items: center; justify-content: center; color: var(--white); text-transform: uppercase; }
.attempt-tile.correct { background: var(--correct); border: none; }
.attempt-tile.present { background: var(--present); border: none; }
.attempt-tile.elsewhere { background: var(--elsewhere); border: none; }
.attempt-tile.revealed { background: var(--revealed); border: none; }
.attempt-tile.absent { background: var(--white); border: 1px solid #e5e7eb; color: var(--black); }
.tile.correct { background: var(--correct); color: var(--white); border: none; }
.tile.present { background: var(--present); color: var(--white); border: none; }
.tile.absent { background: var(--white); color: transparent; border: 2px solid #e5e7eb; }

/* input tiles */
.tile-input { width: 64px; height: 64px; font-size: 28px; text-align:center; font-weight:700; text-transform:uppercase; border-radius:6px; border:2px solid var(--tile-border); margin:4px; box-sizing:border-box; }
.tile-input:focus { outline: none; box-shadow: 0 0 0 3px rgba(66,153,225,0.12); border-color:#9ca3af; }

/* shake animation for wrong submissions */
.shake { animation: shake 600ms; }
@keyframes shake {
	0% { transform: translateX(0); }
	20% { transform: translateX(-10px); }
	40% { transform: translateX(8px); }
	60% { transform: translateX(-6px); }
	80% { transform: translateX(4px); }
	100% { transform: translateX(0); }
}

/* board input feedback styles */
.board-input { width: 64px; height: 64px; font-size: 28px; text-align:center; font-weight:700; text-transform:uppercase; border-radius:6px; border:2px solid var(--tile-border); margin:4px; box-sizing:border-box; background: var(--white); appearance: none; -webkit-appearance: none; -webkit-font-smoothing: antialiased; color-adjust: exact; -webkit-print-color-adjust: exact; print-color-adjust: exact; background-clip: padding-box; transform: translateZ(0); will-change: background-color; display: flex; align-items: center; justify-content: center; line-height: 1; caret-color: transparent; }
.board-input:focus { outline: none; box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.5); border-color:#3b82f6; }
.board-input.revealed { background: var(--revealed) !important; color: var(--white); border: none; }
.board-input.correct { background: var(--correct) !important; color: var(--white); border: none; }
.board-input.present { background: var(--present) !important; color: var(--white); border: none; }
.board-input.elsewhere { background: var(--elsewhere) !important; color: var(--white); border: none; }
.board-input.absent { background: var(--white); color: var(--black); border: 2px solid #e5e7eb; }
.board-input.empty { background: var(--white); color: var(--black); }

.row-input { margin: 8px 0; display:flex; align-items:center; gap:10px; }
label { width: 64px; }
input { padding: 8px 10px; font-size: 16px; width: 160px; border: 1px solid #e5e7eb; border-radius: 6px; }
.success { color: var(--correct); font-weight: bold; }

.keyboard { margin: 18px 0 8px; display: flex; flex-direction: column; gap: 4px; align-items: center; }
.key-row { display: flex; gap: 4px; justify-content: center; flex-wrap: nowrap; }
.key { flex: 1 1 auto; max-width: 40px; min-width: 32px; height: 44px; padding: 0 8px; border-radius: 6px; border: 1px solid #e5e7eb; background: #f3f4f6; color: var(--text); font-weight: 700; font-size: 14px; cursor: pointer; text-transform: uppercase; box-shadow: 0 2px 6px rgba(15,23,42,0.08); appearance: none; -webkit-appearance: none; -webkit-font-smoothing: antialiased; color-adjust: exact; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.key:hover { transform: translateY(-1px); }
.key:active { transform: translateY(0); box-shadow: 0 1px 4px rgba(15,23,42,0.1); }
.key-wide { flex: 1.4 1 auto; max-width: 56px; }
.key.correct { background: var(--correct) !important; color: var(--white); border: none; }
.key.present { background: var(--present) !important; color: var(--white); border: none; }
.key.elsewhere { background: var(--elsewhere) !important; color: var(--white); border: none; }
.key.absent { background: var(--keyboard-absent); color: var(--muted); border: none; }

@media (min-width: 480px) {
	.key { max-width: 48px; height: 50px; font-size: 15px; gap: 5px; }
	.key-wide { max-width: 68px; }
}

@media (min-width: 640px) {
	.keyboard { gap: 6px; }
	.key-row { gap: 6px; }
	.key { max-width: 56px; height: 52px; font-size: 16px; padding: 0 12px; }
	.key-wide { max-width: 80px; }
}

.timer {
	margin: 8px 0 14px;
	font-weight: 600;
	color: var(--muted);
	text-align: right;
}

#celebration-canvas {
	position: fixed;
	inset: 0;
	width: 100vw;
	height: 100vh;
	pointer-events: none;
	z-index: 50;
}

.guessed-letters { margin-top: 16px; padding: 12px; background: #f9fafb; border-radius: 6px; }
.guessed-letters h4 { margin: 0 0 8px 0; font-size: 14px; color: var(--muted); text-transform: uppercase; font-weight: 600; }
.guessed-list { display: flex; flex-wrap: wrap; gap: 6px; }
.guessed-letter { padding: 6px 10px; background: var(--white); color: var(--black); border: 2px solid #d1d5db; border-radius: 4px; font-size: 14px; font-weight: 700; }

/* difficulty selection */
.difficulty-grid { display: grid; grid-template-columns: 1fr; gap: 12px; margin: 16px 0 8px; }
.difficulty-card { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 14px 16px; border-radius: 10px; border: 1px solid #e5e7eb; background: #fff; text-align: left; cursor: pointer; transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease; }
.difficulty-card:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(15,23,42,0.08); border-color: #d1d5db; }
.difficulty-title { font-size: 16px; font-weight: 700; color: var(--text); }
.difficulty-subtitle { font-size: 13px; color: var(--muted); }

@media (min-width: 520px) {
	.difficulty-grid { grid-template-columns: 1fr 1fr; }
}

/* Welcome Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.7); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal { background: var(--panel); max-width: 480px; margin: 20px; padding: 28px; border-radius: 12px; box-shadow: 0 20px 50px rgba(0,0,0,0.3); }
.modal h2 { margin: 0 0 16px 0; font-size: 24px; }
.modal p { margin: 12px 0; line-height: 1.6; }
.example-tile { display: inline-block; width: 32px; height: 32px; line-height: 32px; text-align: center; border-radius: 4px; font-weight: 700; color: var(--white); margin: 0 4px; vertical-align: middle; }
.example-tile.correct { background: var(--correct); }
.example-tile.present { background: var(--present); }
.example-tile.elsewhere { background: var(--elsewhere); }
.modal button { width: 100%; padding: 12px; background: var(--text); color: var(--white); border: none; border-radius: 6px; font-size: 16px; font-weight: 600; cursor: pointer; margin-top: 16px; }
.modal button:hover { opacity: 0.9; }

/* Help Button */
.help-button { position: absolute; top: 16px; right: 16px; width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--muted); background: var(--white); color: var(--muted); font-size: 24px; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s; z-index: 50; }
.help-button:hover { color: var(--text); border-color: var(--text); background: #f9fafb; }
.help-button:active { transform: scale(0.95); }

/* Credit Footer */
.credit-footer { text-align: center; font-size: 12px; color: #000000; margin-top: 12px; padding: 8px 0; }
.credit-footer a { color: #000000; text-decoration: none; }
.credit-footer a:hover { text-decoration: underline; }
