@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700;800&family=Noto+Sans+SC:wght@400;500;600;700;800&display=swap');

:root {
  color-scheme: light;
  --ink: #263048;
  --muted: #7b8295;
  --orange: #ff7b4c;
  --orange-dark: #f0653b;
  --cream: #fffaf4;
  --line: #eee8e2;
  --shadow: 0 22px 64px rgba(55, 53, 67, .08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: #fffdf9;
  color: var(--ink);
  font-family: 'DM Sans', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
a { color: inherit; text-decoration: none; }
.page-shell { overflow: hidden; }
.site-header, main, .site-footer { max-width: 1216px; margin: 0 auto; }

.site-header {
  height: 88px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
}
.brand { display: flex; align-items: center; gap: 11px; flex: none; }
.brand-mark, .modal-mark {
  width: 41px; height: 41px;
  border-radius: 12px;
  display: grid; place-items: center;
  color: white; background: var(--orange);
  font-size: 19px; font-weight: 800;
  box-shadow: 0 7px 16px rgba(255, 123, 76, .25);
}
.brand-name { font-size: 23px; font-weight: 800; letter-spacing: -.6px; }
.brand-name span { color: #a6a9b2; font-size: 11px; letter-spacing: 1.4px; font-weight: 800; vertical-align: 2px; }
.top-nav { display: flex; gap: 39px; margin-left: auto; align-items: center; }
.top-nav a { color: #666f82; font-size: 14px; font-weight: 700; transition: color .2s; }
.top-nav a:hover { color: var(--orange); }
.header-actions { display: flex; align-items: center; gap: 10px; min-width: 139px; justify-content: flex-end; }
.username { color: #4a5368; font-size: 13px; font-weight: 700; white-space: nowrap; }
.pill-button, .primary-button {
  border: 0; background: var(--orange); color: white;
  font-weight: 800; box-shadow: 0 10px 20px rgba(255, 123, 76, .2);
  transition: transform .2s, background .2s, box-shadow .2s;
}
.pill-button:hover, .primary-button:hover:not(:disabled) { transform: translateY(-2px); background: var(--orange-dark); box-shadow: 0 14px 24px rgba(255, 123, 76, .26); }
.pill-button { border-radius: 999px; padding: 10px 19px; font-size: 13px; }
.text-button { border: 0; background: transparent; color: #9a9dab; font-size: 13px; font-weight: 700; }
.text-button:hover { color: var(--orange); }

.hero {
  min-height: 457px;
  border-radius: 30px;
  background: radial-gradient(circle at 82% 48%, #ffe9d7 0, #fff1e3 35%, transparent 67%), linear-gradient(110deg, #fff5ec, #fff8ef);
  display: grid; grid-template-columns: 1fr 480px;
  position: relative; overflow: hidden;
  margin: 0 24px 79px;
}
.hero-copy { padding: 80px 0 65px 68px; position: relative; z-index: 2; }
.eyebrow { font-size: 13px; letter-spacing: 3px; color: #fa8059; font-weight: 800; display: flex; align-items: center; gap: 10px; }
.eyebrow-dot { width: 8px; height: 8px; background: var(--orange); border-radius: 50%; box-shadow: 0 0 0 5px rgba(255, 123, 76, .11); }
.hero h1 { font-size: clamp(40px, 4.1vw, 60px); line-height: 1.24; letter-spacing: -2.5px; margin: 26px 0 17px; color: #293148; font-weight: 800; }
.hero h1 span { color: var(--orange); display: block; }
.hero-description { color: #747c8e; font-size: 15px; line-height: 1.9; max-width: 470px; margin: 0; }
.hero-badges { display: flex; flex-wrap: wrap; gap: 8px; margin: 25px 0 30px; }
.hero-badges span { background: rgba(255,255,255,.78); border: 1px solid #f4e9de; border-radius: 30px; color: #9b7969; font-size: 11px; font-weight: 700; padding: 7px 11px; }
.hero-link { display: inline-flex; align-items: center; gap: 18px; font-size: 15px; color: white; background: var(--ink); padding: 13px 19px; border-radius: 10px; font-weight: 800; transition: transform .2s; }
.hero-link:hover { transform: translateY(-3px); }
.hero-link span { font-size: 20px; line-height: 1; }
.hero-art { position: relative; min-height: 410px; }
.orbit { position: absolute; width: 400px; height: 400px; border-radius: 50%; border: 1px solid rgba(255,155,109,.22); top: 21px; left: 35px; }
.orbit-two { width: 304px; height: 304px; top: 68px; left: 83px; background: rgba(255,255,255,.16); }
.hero-tile { position: absolute; width: 121px; height: 121px; border-radius: 25px; display: grid; place-items: center; color: #fff; font-size: 57px; font-weight: 800; box-shadow: 0 18px 30px rgba(188, 100, 75, .19), inset 0 2px 2px rgba(255,255,255,.35); animation: floating 5s ease-in-out infinite; }
.hero-tile-one { top: 92px; left: 82px; background: linear-gradient(145deg, #ffab87, #ff805d); transform: rotate(-13deg); }
.hero-tile-two { top: 205px; left: 147px; background: linear-gradient(145deg, #ffbd8b, #ff9d69); transform: rotate(10deg); animation-delay: .5s; }
.hero-tile-three { top: 120px; left: 258px; background: linear-gradient(145deg, #ffc3a5, #ff926f); transform: rotate(14deg); animation-delay: 1s; }
.hero-plus { position: absolute; top: 263px; left: 308px; font-size: 31px; font-weight: 800; color: #ff9270; transform: rotate(-12deg); }
.hero-spark { position: absolute; color: #ff9d72; font-size: 32px; }
.hero-spark-one { top: 60px; left: 240px; }.hero-spark-two { top: 344px; left: 80px; font-size: 22px; }
@keyframes floating { 50% { translate: 0 -9px; } }

.game-section, .rules-section, .ranking-section { padding: 0 24px; scroll-margin-top: 25px; }
.section-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 27px; }
.section-kicker { display: block; color: var(--orange); letter-spacing: 2.3px; font-weight: 800; font-size: 12px; margin-bottom: 10px; }
.section-heading h2 { font-size: 31px; letter-spacing: -.9px; margin: 0 0 8px; line-height: 1.35; }
.section-heading p { margin: 0; color: #8990a0; font-size: 14px; }
.live-chip { white-space: nowrap; color: #4bb58b; background: #eaf9f0; border-radius: 30px; padding: 9px 13px; font-size: 11px; font-weight: 800; }
.game-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 22px; align-items: start; }
.game-card, .tip-card, .mini-rank-card, .rule-card, .ranking-card { border: 1px solid #f0eeeb; background: white; box-shadow: var(--shadow); }
.game-card { border-radius: 23px; padding: 23px; }
.score-strip { display: grid; grid-template-columns: 1.3fr 1fr 1.2fr; gap: 10px; margin-bottom: 19px; }
.stat { border-radius: 15px; min-height: 103px; padding: 15px 18px; background: #f8f9fc; display: flex; flex-direction: column; justify-content: center; }
.stat-score { background: #fff1e9; }
.stat-label { color: #8f95a2; font-size: 11px; font-weight: 700; margin-bottom: 5px; }
.stat-score .stat-label { color: #e58166; }
.stat strong { font-size: 27px; line-height: 1.2; letter-spacing: -.5px; }
.stat-score strong { color: #f27651; }
.stat-score .score-value { display: inline-block; transform-origin: left center; animation: score-bump .28s ease-out; }
@keyframes score-bump { 40% { transform: scale(1.16); color: #df593d; } }
.stat-hint { color: #a7abb4; font-size: 10px; margin-top: 4px; }
.action-dots { display: flex; gap: 6px; height: 33px; align-items: center; }
.action-dot { display: block; width: 14px; height: 14px; border-radius: 50%; background: #dce0e8; }
.action-dot.active { background: #ff9d69; box-shadow: 0 3px 7px rgba(255, 157, 105, .32); }
.board-wrap { position: relative; max-width: 545px; margin: 0 auto; }
.board { aspect-ratio: 1; border-radius: 19px; background: #f0e4d7; padding: 6px; position: relative; display: grid; grid-template-columns: repeat(5, 1fr); grid-template-rows: repeat(5, 1fr); }
.board-slot { margin: 5px; border-radius: 11px; background: rgba(255,255,255,.43); box-shadow: inset 0 1px 3px rgba(109, 91, 86, .04); }
.tile-position { position: absolute; width: 20%; height: 20%; border: 0; padding: 10px; background: transparent; transition: top .2s cubic-bezier(.2,.8,.2,1), left .2s cubic-bezier(.2,.8,.2,1), opacity .29s ease-in, transform .29s cubic-bezier(.45,0,.55,1); z-index: 1; }
.tile-position:not(:disabled):hover { transform: translateY(-3px) scale(1.035); z-index: 3; }
.tile-position:focus-visible { outline: 3px solid #5d67b2; outline-offset: -4px; border-radius: 15px; }
.tile-face { display: grid; place-items: center; width: 100%; height: 100%; border-radius: 11px; background: white; color: #5c5961; font-size: clamp(22px, 4vw, 38px); font-weight: 800; box-shadow: 0 5px 9px rgba(98, 76, 68, .07), inset 0 1px 2px rgba(255,255,255,.7); }
.tile-value-1 { background: #fffaf2; color: #b7a18d; }
.tile-value-2 { background: #ffdfcc; color: #d87e5e; }
.tile-value-3 { background: #ffc6a5; color: #c95e48; }
.tile-value-4 { background: #ffad82; color: #a94c39; }
.tile-value-5 { background: #ff906e; color: white; }
.tile-value-6 { background: #ee6f66; color: white; }
.tile-value-7 { background: #d46d91; color: white; }
.tile-value-8 { background: #997dc2; color: white; }
.tile-value-high { background: #5d68ad; color: white; }
.tile-merge-ready .tile-face { outline: 3px solid #fff6bd; box-shadow: 0 0 0 5px rgba(255, 166, 86, .48), 0 7px 22px rgba(233, 115, 73, .32); }
.tile-merge-target { z-index: 3; }
.tile-merge-target .tile-face { animation: merge-target-pulse .36s ease-in-out infinite; }
.tile-merging { transform: translate(var(--merge-x), var(--merge-y)) scale(.18); opacity: .18; z-index: 4; pointer-events: none; }
.tile-upgraded .tile-face { animation: upgrade-pop .3s cubic-bezier(.2,1.3,.3,1); }
.merge-score { position: absolute; z-index: 5; pointer-events: none; transform: translate(-50%, -30%); padding: 5px 10px; border-radius: 999px; background: #fff9dd; color: #df744d; box-shadow: 0 4px 15px rgba(164, 96, 46, .22); font-weight: 900; font-size: clamp(14px, 2vw, 20px); white-space: nowrap; animation: merge-score-rise .3s ease-out both; }
.tile-new .tile-face { animation: tile-pop .17s cubic-bezier(.2,1.7,.3,1); }
@keyframes tile-pop { from { transform: translateY(-22px) scale(.7); opacity: .3; } to { transform: translateY(0) scale(1); opacity: 1; } }
@keyframes merge-target-pulse { 50% { filter: brightness(1.13); box-shadow: 0 0 0 9px rgba(255, 166, 86, .28), 0 7px 25px rgba(233, 115, 73, .4); } }
@keyframes upgrade-pop { 0% { transform: scale(.8); filter: brightness(1.25); } 60% { transform: scale(1.17); filter: brightness(1.15); } 100% { transform: scale(1); filter: brightness(1); } }
@keyframes merge-score-rise { from { opacity: 0; translate: 0 13px; } 25% { opacity: 1; } 75% { opacity: 1; } to { opacity: 0; translate: 0 -17px; } }
.board-overlay { position: absolute; inset: 0; z-index: 4; border-radius: 19px; background: rgba(255, 251, 245, .92); backdrop-filter: blur(5px); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 28px; }
.overlay-icon { width: 54px; height: 54px; border-radius: 17px; display: grid; place-items: center; background: #fff0e4; color: var(--orange); font-size: 27px; margin-bottom: 14px; }
.board-overlay h3 { margin: 0 0 9px; font-size: 24px; }
.board-overlay p { margin: 0 0 21px; color: #7d8492; line-height: 1.7; font-size: 13px; }
.primary-button { border-radius: 10px; font-size: 13px; padding: 13px 22px; }
.primary-button:disabled { opacity: .6; }
.subtle-button { margin-top: 13px; background: transparent; border: 0; color: #767f90; font-size: 13px; font-weight: 700; }
.subtle-button:hover { color: var(--orange); }
.uploaded-badge { color: #329b71; background: #e8f8ed; border-radius: 20px; font-size: 12px; font-weight: 800; padding: 8px 14px; }
.board-footer { min-height: 40px; display: flex; align-items: end; justify-content: space-between; gap: 16px; color: #999dab; font-size: 12px; padding: 10px 2px 0; }
.new-game-button { background: transparent; border: 0; color: #e78870; font-size: 12px; font-weight: 800; white-space: nowrap; }
.new-game-button:hover { color: #d75d40; }
.game-side { display: grid; gap: 19px; }
.tip-card { border-radius: 21px; padding: 26px 24px 22px; }
.card-kicker { color: #f18666; font-size: 11px; font-weight: 800; letter-spacing: 2px; }
.tip-card h3 { font-size: 21px; line-height: 1.4; margin: 10px 0 22px; }
.tip-row { display: flex; gap: 13px; margin: 0 0 20px; }
.tip-number { display: grid; place-items: center; background: #fff0e7; color: #ed8b67; font-size: 11px; font-weight: 800; width: 29px; height: 29px; border-radius: 9px; flex: none; }
.tip-row strong { display: block; font-size: 13px; margin: 2px 0 5px; }
.tip-row p { font-size: 11px; line-height: 1.7; color: #979ba7; margin: 0; }
.tip-note { padding: 12px; border-radius: 10px; background: #fff9ee; color: #bc855a; font-size: 11px; font-weight: 700; display: flex; gap: 8px; align-items: center; }
.tip-note span { font-size: 16px; }
.mini-rank-card { border-radius: 20px; padding: 21px 24px; background: linear-gradient(130deg, #fffbf4, #fff1e3); border-color: #fff1de; }
.mini-rank-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.mini-rank-top span { font-size: 13px; font-weight: 800; }
.mini-rank-top a { color: #e38462; font-size: 10px; font-weight: 800; }
.mini-rank-card strong { display: block; margin-top: 15px; color: #f27b56; font-size: 25px; }
.mini-rank-card p { color: #a99589; font-size: 11px; margin: 5px 0 0; }

.rules-section { margin-top: 80px; }
.rule-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.rule-card { border-radius: 20px; padding: 22px; min-height: 194px; transition: transform .2s; }
.rule-card:hover { transform: translateY(-4px); }
.rule-top { display: flex; justify-content: space-between; align-items: flex-start; color: #e0e2e7; font-size: 12px; font-weight: 800; }
.rule-icon { display: grid; place-items: center; width: 43px; height: 43px; background: #fff0e7; color: #ee8b67; border-radius: 14px; font-size: 25px; }
.rule-card h3 { font-size: 18px; margin: 20px 0 7px; }
.rule-card p { color: #9499a5; font-size: 12px; line-height: 1.75; margin: 0; }
.ranking-section { margin-top: 79px; margin-bottom: 90px; }
.rank-crown { color: #e5a65c; background: #fff4e3; font-size: 11px; font-weight: 800; padding: 9px 14px; border-radius: 30px; }
.ranking-card { border-radius: 20px; overflow: hidden; }
.ranking-head, .ranking-row { display: grid; grid-template-columns: 90px 1fr 105px 105px; align-items: center; padding: 0 25px; }
.ranking-head { height: 49px; background: #fcfaf8; color: #a5a8b0; font-size: 11px; font-weight: 800; }
.ranking-row { height: 68px; border-top: 1px solid #f3f2f0; color: #78808f; font-size: 13px; }
.ranking-row.top-three { background: #fffdf9; }
.rank-number { font-size: 18px; font-weight: 800; color: #9298a4; }
.rank-player { display: flex; align-items: center; gap: 11px; font-weight: 800; color: #394156; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: #ffe4d5; color: #de8565; font-size: 12px; }
.me-tag { background: #ecf3ff; color: #7489c1; border-radius: 5px; font-size: 10px; padding: 2px 5px; }
.ranking-row strong { font-size: 16px; color: #f17753; }
.ranking-empty { height: 194px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.ranking-empty span { color: #fac2a5; font-size: 27px; }
.ranking-empty h3 { margin: 6px 0 3px; font-size: 17px; }
.ranking-empty p { color: #a0a4ae; font-size: 12px; margin: 0; }
.site-footer { min-height: 88px; border-top: 1px solid #f0eeea; padding: 26px 24px; display: flex; justify-content: space-between; align-items: center; color: #a4a7af; font-size: 11px; }
.site-footer span:first-child { font-size: 15px; font-weight: 800; color: #d88567; }

.modal-backdrop, .loading-cover { position: fixed; inset: 0; z-index: 20; background: rgba(36, 40, 57, .46); backdrop-filter: blur(5px); display: grid; place-items: center; padding: 20px; }
.auth-modal { width: min(100%, 390px); padding: 31px; position: relative; border-radius: 24px; background: white; box-shadow: 0 30px 80px rgba(17, 25, 48, .2); display: flex; flex-direction: column; }
.modal-close { position: absolute; right: 19px; top: 12px; background: transparent; border: 0; color: #a4a7b0; font-size: 27px; }
.modal-mark { width: 48px; height: 48px; margin-bottom: 19px; }
.auth-modal h2 { font-size: 25px; margin: 0 0 6px; }
.auth-modal p { font-size: 12px; color: #979ca9; margin: 0 0 24px; }
.auth-modal label { color: #636b7e; font-size: 12px; font-weight: 800; margin-bottom: 8px; }
.auth-modal input { border: 1px solid #e9e9ed; background: #fafafb; border-radius: 10px; padding: 12px 13px; outline: none; margin-bottom: 16px; color: var(--ink); font-size: 13px; }
.auth-modal input:focus { border-color: #f2a384; box-shadow: 0 0 0 3px rgba(255, 123, 76, .1); }
.auth-submit { width: 100%; margin-top: 5px; }
.auth-switch { border: 0; background: transparent; font-size: 12px; font-weight: 800; color: #e88464; margin-top: 17px; }
.error-toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 30; display: flex; align-items: center; gap: 20px; min-width: 280px; max-width: min(90vw, 600px); background: #34394c; color: white; box-shadow: 0 15px 35px rgba(30, 35, 52, .23); padding: 11px 14px; border-radius: 10px; font-size: 12px; }
.error-toast button { margin-left: auto; background: transparent; color: white; font-size: 20px; border: 0; }
.loading-cover { z-index: 35; color: white; font-size: 15px; font-weight: 800; }

@media (max-width: 900px) {
  .top-nav { gap: 18px; }
  .hero { grid-template-columns: 1fr 360px; }
  .hero-copy { padding-left: 45px; }
  .hero-art { transform: scale(.8); transform-origin: 20% center; }
  .game-layout { grid-template-columns: minmax(0, 1fr) 270px; }
  .tip-card { padding: 20px; }
}
@media (max-width: 720px) {
  .site-header { height: 74px; }
  .top-nav { display: none; }
  .brand-name span { display: none; }
  .hero { min-height: 640px; grid-template-columns: 1fr; margin-bottom: 60px; }
  .hero-copy { padding: 46px 34px 0; }
  .hero h1 { font-size: 44px; }
  .hero-art { min-height: 275px; transform: scale(.63); transform-origin: top center; margin-top: 20px; }
  .game-layout { grid-template-columns: 1fr; }
  .game-side { grid-template-columns: 1fr 1fr; }
  .rule-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 520px) {
  .site-header { padding: 0 16px; }
  .brand-name { font-size: 21px; }
  .username { max-width: 95px; overflow: hidden; text-overflow: ellipsis; }
  .hero { margin-left: 12px; margin-right: 12px; border-radius: 22px; min-height: 610px; }
  .hero-copy { padding: 40px 22px 0; }
  .hero h1 { font-size: 38px; letter-spacing: -1.6px; }
  .hero-description { font-size: 13px; }
  .hero-badges { gap: 6px; margin-bottom: 23px; }
  .hero-badges span { font-size: 10px; }
  .hero-art { margin-top: 14px; }
  .game-section, .rules-section, .ranking-section { padding: 0 12px; }
  .section-heading h2 { font-size: 25px; }
  .section-heading p { font-size: 12px; line-height: 1.6; }
  .live-chip, .rank-crown { display: none; }
  .game-card { padding: 12px; border-radius: 16px; }
  .score-strip { gap: 6px; margin-bottom: 10px; }
  .stat { padding: 10px; min-height: 81px; }
  .stat strong { font-size: 22px; }
  .stat-label { font-size: 10px; }
  .stat-hint { display: none; }
  .action-dots { gap: 4px; height: 26px; }
  .action-dot { width: 10px; height: 10px; }
  .tile-position { padding: 6px; }
  .tile-face { border-radius: 8px; font-size: clamp(18px, 7vw, 31px); }
  .board-slot { margin: 3px; border-radius: 8px; }
  .board { padding: 3px; border-radius: 12px; }
  .board-overlay { border-radius: 12px; }
  .game-side { grid-template-columns: 1fr; }
  .rule-grid { gap: 10px; }
  .rule-card { padding: 16px; min-height: 195px; }
  .rule-card p { font-size: 11px; }
  .ranking-head, .ranking-row { grid-template-columns: 50px 1fr 54px 65px; padding: 0 12px; }
  .rank-player { gap: 6px; font-size: 12px; }
  .avatar { width: 25px; height: 25px; }
  .site-footer { padding: 25px 14px; }
  .site-footer span:nth-child(2) { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
