:root {
	--ink: #153b35;
	--deep: #123b35;
	--green: #2f7563;
	--mint: #e4f1e8;
	--paper: #f7f6ef;
	--line: #d8e2d8;
	--yellow: #f3c84b;
	--yellow-soft: #fff4c9;
	--white: #ffffff;
	font-family: "DM Sans", sans-serif;
	color: var(--ink);
	background: var(--paper);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: radial-gradient(circle at 86% 8%, #e6f1e6 0, transparent 28rem), var(--paper); }
button { font: inherit; cursor: pointer; }
.page-shell { width: min(1240px, calc(100% - 40px)); margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 28px 0 22px; }
.brand { color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 11px; font-size: 11px; line-height: 1.05; letter-spacing: .08em; text-transform: uppercase; }
.brand strong { font-size: 14px; letter-spacing: .02em; text-transform: none; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: var(--white); background: var(--green); font-size: 25px; font-weight: 400; line-height: 1; }
.info-button, .close-button { border: 1px solid var(--line); color: var(--ink); background: rgba(255,255,255,.7); border-radius: 50%; display: grid; place-items: center; }
.info-button { width: 44px; height: 44px; font-size: 20px; font-weight: 700; transition: .2s ease; }
.info-button:hover, .info-button:focus-visible { color: var(--white); background: var(--deep); transform: translateY(-2px); }
.top-actions { display: flex; align-items: center; gap: 12px; }
.player-chip { max-width: 190px; overflow: hidden; padding: 9px 13px; border: 1px solid #c7ddd0; border-radius: 999px; color: var(--green); background: #edf6ee; font-size: 11px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.change-player-button { padding: 8px 10px; border: 0; color: var(--green); background: transparent; font-size: 11px; font-weight: 700; }
.change-player-button:hover, .change-player-button:focus-visible { color: var(--deep); text-decoration: underline; }
.intro { display: flex; justify-content: space-between; align-items: end; padding: 34px 0 32px; }
.eyebrow { margin: 0 0 13px; color: var(--green); font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.status-dot { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: #7bbd69; }
h1, h2 { font-family: "Manrope", sans-serif; margin: 0; letter-spacing: -.04em; }
h1 { font-size: clamp(36px, 5vw, 66px); line-height: .98; }
.intro-copy { max-width: 540px; margin: 18px 0 0; color: #5d726c; font-size: 16px; line-height: 1.55; }
.intro-side { display: flex; align-items: center; gap: 13px; color: #627c73; font-size: 12px; line-height: 1.45; }
.intro-side strong { color: var(--ink); font-size: 13px; }
.leaf-symbol { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid #bdd6c5; border-radius: 50%; color: var(--green); font-size: 20px; }
.scoreboard { display: flex; align-items: stretch; margin-bottom: 32px; padding: 13px 16px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.72); box-shadow: 0 12px 35px rgba(26, 76, 60, .05); }
.score-item { min-width: 135px; padding: 5px 22px; border-right: 1px solid var(--line); }
.score-label { display: block; margin-bottom: 3px; color: #779087; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.score-item strong { font-family: "Manrope", sans-serif; font-size: 21px; letter-spacing: -.04em; }
.record-item strong { color: var(--green); }
.reset-button { margin-left: auto; padding: 0 14px; border: 0; color: var(--green); background: transparent; font-weight: 700; font-size: 13px; }
.reset-button span { margin-right: 5px; font-size: 20px; vertical-align: -1px; }
.reset-button:hover { color: var(--deep); }
.leaderboard-preview { margin: 4px auto 34px; padding: 22px 26px 16px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.58); }
.section-heading { display: flex; align-items: center; justify-content: space-between; }
.section-heading .eyebrow { margin-bottom: 5px; }
.section-heading h2 { font-size: 25px; text-transform: uppercase; }
.sync-status { padding: 5px 9px; border-radius: 999px; color: var(--green); background: var(--mint); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.sync-status.is-online { color: #456e29; background: #e5f2c9; }
.top-ranking-wrap { margin: 18px 0 15px; overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: var(--white); }
.top-ranking { width: 100%; border-collapse: collapse; font-size: 12px; text-align: left; }
.top-ranking th { padding: 11px 13px; color: #80958d; background: #f0f5ef; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.top-ranking td { padding: 12px 13px; border-top: 1px solid #e8eee8; }
.top-ranking td:first-child { color: var(--green); font-weight: 800; }
.top-ranking .top-player { font-weight: 700; }
.top-ranking .top-time { font-family: "Manrope", sans-serif; font-weight: 700; }
.top-ranking tr.is-new { animation: ranking-highlight .8s ease; }
.podium-empty { padding: 20px 13px; color: #789087; font-size: 13px; text-align: center; }
.ranking-link { display: block; margin: 0 auto; border: 0; color: var(--green); background: transparent; font-size: 12px; font-weight: 700; }
.ranking-link span { margin-left: 5px; font-size: 16px; }
@keyframes ranking-highlight { 0%, 100% { background: transparent; } 35% { background: var(--yellow-soft); } }
.board-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 15px; }
.board-heading h2 { font-size: 20px; }
.board-heading p { margin: 0; color: #71867f; font-size: 12px; font-weight: 600; }
.yellow-key { display: inline-block; width: 10px; height: 10px; margin-right: 6px; border-radius: 50%; background: var(--yellow); vertical-align: -1px; box-shadow: 0 0 0 4px rgba(243,200,75,.15); }
.board { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: clamp(9px, 1.4vw, 16px); max-width: 1160px; margin: 0 auto; }
.card { position: relative; aspect-ratio: 1.32; border: 0; padding: 0; background: transparent; perspective: 900px; -webkit-tap-highlight-color: transparent; }
.card-inner { position: absolute; inset: 0; transition: transform .48s cubic-bezier(.2,.75,.25,1); transform-style: preserve-3d; }
.card.is-flipped .card-inner, .card.is-matched .card-inner { transform: rotateY(180deg); }
.card-face { position: absolute; inset: 0; display: flex; backface-visibility: hidden; border-radius: 11px; overflow: hidden; }
.card-back { align-items: center; justify-content: center; border: 1px solid #427c6b; color: #b4d7bd; background: var(--deep); box-shadow: 0 5px 0 #0b2c28, 0 12px 22px rgba(18,59,53,.13); }
.card-back::before { content: ""; position: absolute; inset: 9px; border: 1px solid rgba(185, 221, 189, .32); border-radius: 7px; }
.card-back::after { content: "+"; position: relative; font-size: 31px; font-weight: 300; }
.card-front { transform: rotateY(180deg); flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 14px; border: 1px solid #d0ded4; color: var(--ink); background: var(--white); box-shadow: 0 5px 0 #dbe5dd; text-align: center; }
.card-front .word { font-family: "Manrope", sans-serif; font-size: clamp(13px, 1.8vw, 18px); line-height: 1.1; letter-spacing: -.035em; }
.card-front .card-label { color: #738b82; font-size: 9px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.card.is-yellow .card-front { border-color: #ecc34b; background: var(--yellow-soft); box-shadow: 0 5px 0 #e6c45b, 0 0 28px rgba(243,200,75,.2); }
.card.is-yellow .card-front .card-label { color: #9a7414; }
.card.is-yellow.is-flipped .card-front, .card.is-yellow.is-matched .card-front { animation: highlight .8s ease-out; }
.card:focus-visible { outline: 3px solid #73aa86; outline-offset: 4px; border-radius: 13px; }
.card:not(.is-flipped):not(.is-matched):hover .card-inner { transform: translateY(-4px); }
.card.is-matched { pointer-events: none; }
@keyframes highlight { 0%, 100% { filter: brightness(1); } 45% { filter: brightness(1.08); } }
.board-hint { min-height: 20px; margin: 21px 0 32px; color: #759087; font-size: 13px; text-align: center; }
footer { display: flex; align-items: center; gap: 12px; margin-top: auto; padding: 25px 0 20px; color: #8b9d96; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.footer-line { width: 28px; height: 1px; background: #b5c8bc; }
.modal-backdrop { position: fixed; z-index: 10; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(12, 40, 35, .48); backdrop-filter: blur(5px); animation: fade-in .2s ease; }
.modal-backdrop[hidden] { display: none; }
.modal { position: relative; width: min(100%, 480px); padding: 38px; border-radius: 18px; background: var(--paper); box-shadow: 0 25px 80px rgba(7, 35, 29, .28); animation: rise-in .28s ease; }
.profile-modal { width: min(100%, 430px); }
.welcome-mark { display: grid; place-items: center; width: 42px; height: 42px; margin-bottom: 18px; border-radius: 50%; color: var(--white); background: var(--green); font-size: 28px; font-weight: 300; }
.profile-intro { margin: -10px 0 22px; color: #5d726c; font-size: 14px; }
.profile-modal form { display: grid; gap: 13px; }
.profile-modal label { display: grid; gap: 6px; color: var(--ink); font-size: 12px; font-weight: 700; }
.profile-modal input { width: 100%; padding: 12px 13px; border: 1px solid #c9d9ce; border-radius: 7px; outline: 0; color: var(--ink); background: var(--white); font: inherit; }
.profile-modal input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(47,117,99,.12); }
.profile-modal .primary-button { margin-top: 8px; }
.privacy-note { margin: 18px 0 0; color: #80958d; font-size: 11px; line-height: 1.5; }
.form-error { margin: 0; color: #a23f32; font-size: 12px; }
.ranking-modal { width: min(100%, 700px); }
.ranking-modal h2 { margin-bottom: 5px; }
.ranking-updated { margin: 0 0 20px; color: #80958d; font-size: 12px; }
.ranking-table-wrap { max-height: 380px; overflow: auto; border: 1px solid var(--line); border-radius: 9px; background: var(--white); }
.ranking-modal table { width: 100%; border-collapse: collapse; font-size: 12px; text-align: left; }
.ranking-modal th { padding: 11px 13px; color: #80958d; background: #f0f5ef; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.ranking-modal td { padding: 12px 13px; border-top: 1px solid #e8eee8; }
.ranking-modal td:first-child { color: var(--green); font-weight: 800; }
.ranking-modal td:nth-child(2) { font-weight: 700; }
.ranking-modal td:last-child { font-family: "Manrope", sans-serif; font-weight: 700; }
.close-button { position: absolute; top: 18px; right: 18px; width: 34px; height: 34px; border: 0; font-size: 25px; font-weight: 300; }
.modal h2 { margin-bottom: 23px; font-size: 32px; }
.rules-list { display: grid; gap: 14px; margin: 0 0 22px; padding: 0; list-style: none; }
.rules-list li { display: flex; align-items: center; gap: 15px; color: #5d726c; font-size: 13px; line-height: 1.4; }
.rules-list li > span { color: #91ad99; font-family: "Manrope", sans-serif; font-size: 13px; }
.rules-list strong, .important-note strong { color: var(--ink); }
.important-note, .remember-reminder { display: flex; gap: 12px; padding: 15px; border: 1px solid #ecd06d; border-radius: 10px; color: #78631d; background: var(--yellow-soft); font-size: 12px; line-height: 1.45; }
.note-icon { display: grid; flex: 0 0 22px; place-items: center; width: 22px; height: 22px; border-radius: 50%; color: #806418; background: var(--yellow); font-weight: 800; }
.primary-button { width: 100%; margin-top: 25px; padding: 14px 20px; border: 0; border-radius: 8px; color: var(--white); background: var(--deep); font-weight: 700; transition: .2s ease; }
.primary-button:hover, .primary-button:focus-visible { background: var(--green); transform: translateY(-2px); }
.results-modal { text-align: center; }
.success-mark { display: grid; place-items: center; width: 48px; height: 48px; margin: 0 auto 17px; border-radius: 50%; color: var(--white); background: var(--green); font-size: 25px; animation: pop .5s ease; }
.results-modal h2 { margin-bottom: 7px; font-size: 38px; }
.result-lead { margin: 0 0 23px; color: #71867f; font-size: 13px; }
.result-grid { display: grid; grid-template-columns: repeat(3, 1fr); margin-bottom: 19px; padding: 17px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.result-grid div + div { border-left: 1px solid var(--line); }
.result-grid span { display: block; margin-bottom: 5px; color: #80958d; font-size: 10px; text-transform: uppercase; }
.result-grid strong { font-family: "Manrope", sans-serif; font-size: 20px; }
.record-message { color: #ac7d08; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.remember-reminder { text-align: left; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(.5); } 70% { transform: scale(1.12); } 100% { transform: scale(1); } }
@media (min-width: 700px) and (max-height: 900px) {
	.topbar { padding: 16px 0 12px; }
	.intro { padding: 16px 0 17px; }
	.intro-copy { margin-top: 10px; font-size: 14px; }
	.scoreboard { margin-bottom: 16px; padding: 9px 13px; }
	.leaderboard-preview { margin-bottom: 18px; padding: 14px 20px 10px; }
	.top-ranking-wrap { margin: 10px 0 9px; }
	.top-ranking th, .top-ranking td { padding: 8px 11px; }
	.board-heading { margin-bottom: 9px; }
	.board { gap: 10px; }
	.card-front { padding: 8px; gap: 4px; }
	.card-front .word { font-size: clamp(12px, 1.55vw, 17px); }
	.board-hint { margin: 12px 0 16px; }
	footer { padding: 12px 0; }
}
@media (max-width: 620px) {
	.page-shell { width: min(100% - 24px, 500px); }
	.topbar { padding-top: 18px; }
	.intro { display: block; padding: 27px 0 25px; }
	.intro-side { margin-top: 20px; }
	.scoreboard { flex-wrap: wrap; gap: 12px 0; padding: 12px 8px; }
	.score-item { min-width: 33%; padding: 3px 10px; }
	.score-item strong { font-size: 18px; }
	.player-chip { max-width: 130px; }
	.change-player-button { padding-inline: 3px; font-size: 10px; }
	.leaderboard-preview { padding: 18px 10px 14px; }
	.top-ranking { font-size: 11px; }
	.top-ranking th, .top-ranking td { padding: 10px 7px; }
	.top-ranking th:first-child, .top-ranking td:first-child { width: 66px; }
	.ranking-modal { padding-inline: 14px; }
	.reset-button { width: 100%; padding: 8px 0 2px; border-top: 1px solid var(--line); }
	.board { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
	.card-front { padding: 7px; }
	.card-front .word { font-size: clamp(11px, 3vw, 15px); }
	.modal { padding: 32px 22px 24px; }
	footer { font-size: 8px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
