.s3x-app,
.s3x-app * { box-sizing: border-box; }
.s3x-app {
  --s3x-ink: #17251d;
  --s3x-muted: #66756b;
  --s3x-green: #145f3f;
  --s3x-green-2: #0d4930;
  --s3x-gold: #e5b851;
  --s3x-cream: #fbf8e9;
  --s3x-card: rgba(255,255,255,.88);
  position: relative;
  min-height: 720px;
  color: var(--s3x-ink);
  font-family: Tahoma, Arial, sans-serif;
  line-height: 1.55;
  background-color: #dfe9ac;
  background-image: linear-gradient(rgba(250,252,222,.18), rgba(232,240,178,.22)), var(--s3x-bg);
  background-size: auto, cover;
  background-position: center;
  border-radius: 26px;
  overflow: hidden;
  isolation: isolate;
}
.s3x-app::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(circle at 20% 0%, rgba(255,255,255,.55), transparent 35%), radial-gradient(circle at 90% 80%, rgba(43,94,54,.12), transparent 38%);
}
.s3x-app button, .s3x-app input, .s3x-app select { font: inherit; }
.s3x-app button { cursor: pointer; }
.s3x-app button:disabled { cursor: not-allowed; opacity: .55; }
.s3x-app [hidden] { display: none !important; }
.s3x-shell { max-width: 1180px; margin: 0 auto; padding: 28px; }
.s3x-hero, .s3x-game-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.s3x-hero { padding: 16px 6px 30px; }
.s3x-hero h2 { margin: 1px 0 4px; font-size: clamp(32px, 5vw, 54px); line-height: 1.12; color: var(--s3x-green-2); }
.s3x-hero p { margin: 0; color: #506157; }
.s3x-kicker { color: #9a690a; font-size: 12px; font-weight: 800; letter-spacing: .08em; }
.s3x-online-pill, .s3x-live { background: rgba(255,255,255,.75); border: 1px solid rgba(20,95,63,.15); border-radius: 999px; padding: 9px 14px; white-space: nowrap; box-shadow: 0 7px 24px rgba(43,67,47,.08); }
.s3x-online-pill span { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #2bc56d; margin-left: 6px; box-shadow: 0 0 0 5px rgba(43,197,109,.12); }
.s3x-layout { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 20px; align-items: start; }
.s3x-layout > main, .s3x-layout > aside, .s3x-side-panel { display: grid; gap: 18px; }
.s3x-card, .s3x-code-search, .s3x-big-action, .s3x-arena {
  background: var(--s3x-card); border: 1px solid rgba(31,83,51,.13); border-radius: 22px; box-shadow: 0 18px 55px rgba(31,64,40,.10); backdrop-filter: blur(12px);
}
.s3x-card { padding: 20px; }
.s3x-card h3, .s3x-section-head h3 { margin: 0; font-size: 19px; }
.s3x-identity label, .s3x-create-modal label { display: grid; gap: 7px; font-weight: 700; }
.s3x-inline { display: flex; gap: 9px; margin-top: 9px; }
.s3x-app input, .s3x-app select {
  width: 100%; min-width: 0; border: 1px solid #c9d2bc; border-radius: 13px; background: rgba(255,255,255,.9); padding: 11px 13px; color: var(--s3x-ink); outline: 0;
}
.s3x-app input:focus, .s3x-app select:focus { border-color: var(--s3x-green); box-shadow: 0 0 0 3px rgba(20,95,63,.12); }
.s3x-identity select { flex: 0 0 170px; }
.s3x-btn { border: 1px solid rgba(20,95,63,.18); color: var(--s3x-green-2); background: #fff; border-radius: 12px; padding: 10px 15px; font-weight: 800; white-space: nowrap; transition: .18s ease; }
.s3x-btn:hover { transform: translateY(-1px); box-shadow: 0 8px 18px rgba(26,70,42,.12); }
.s3x-btn-primary { color: #fff; background: linear-gradient(135deg, var(--s3x-green), var(--s3x-green-2)); border-color: transparent; }
.s3x-btn-ghost { background: rgba(255,255,255,.67); }
.s3x-full { width: 100%; }
.s3x-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.s3x-big-action { border: 0; padding: 21px; display: grid; grid-template-columns: 50px 1fr; text-align: right; color: #fff; background: linear-gradient(135deg, #18704a, #0a422a); }
.s3x-big-action span { grid-row: span 2; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 14px; font-size: 27px; background: rgba(255,255,255,.13); }
.s3x-big-action b { font-size: 19px; }
.s3x-big-action small { opacity: .74; }
.s3x-code-search { padding: 17px 19px; }
.s3x-code-search > small { display: block; color: var(--s3x-muted); font-size: 11px; }
.s3x-code-search .s3x-inline { margin-top: 7px; }
.s3x-code-search input { text-align: right; }
.s3x-section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.s3x-icon-btn { border: 0; background: #eef3df; color: var(--s3x-green); width: 36px; height: 36px; border-radius: 50%; font-size: 21px; }
.s3x-room-list, .s3x-people, [data-s3x-social] { display: grid; gap: 9px; }
.s3x-room { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; padding: 14px; border: 1px solid #dfe5d4; border-radius: 16px; background: rgba(255,255,255,.64); }
.s3x-room h4 { margin: 0 0 4px; font-size: 16px; }
.s3x-room p { margin: 0; color: var(--s3x-muted); font-size: 13px; }
.s3x-bot-badge { display: inline-flex; vertical-align: middle; padding: 1px 6px; border-radius: 999px; color: #53607b; background: #e9edf6; font-size: 9px; font-weight: 800; }
.s3x-auto-mark { color: #66758a; font-size: 10px; font-style: normal; }
.s3x-flag { display: inline-block; font-size: 13px; line-height: 1; vertical-align: -1px; }
.s3x-status { display: inline-flex; gap: 5px; align-items: center; padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 800; margin-right: 5px; }
.s3x-status.waiting { color: #8a5d00; background: #fff2c4; }
.s3x-status.playing { color: #0e7043; background: #d8f6e5; }
.s3x-status.round_end { color: #76550b; background: #fff0bd; }
.s3x-status.finished { color: #6d5762; background: #eee7eb; }
.s3x-person-row, .s3x-request { display: flex; gap: 9px; align-items: center; border: 0; width: 100%; text-align: right; padding: 9px; border-radius: 13px; background: rgba(246,248,237,.8); color: inherit; }
.s3x-person-row:hover { background: #eef3df; }
.s3x-avatar { flex: 0 0 34px; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, #e6c165, #ab7819); color: #fff; font-weight: 900; }
.s3x-person-row span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; }
.s3x-person-row small { display: block; color: var(--s3x-muted); }
.s3x-dot { width: 8px; height: 8px; border-radius: 50%; background: #24bd64; margin-right: auto; }
.s3x-badge { min-width: 25px; height: 25px; display: grid; place-items: center; padding: 0 6px; border-radius: 999px; background: #ba3c4d; color: #fff; font-size: 12px; font-weight: 900; }
.s3x-empty { padding: 22px 10px; text-align: center; color: var(--s3x-muted); border: 1px dashed #cbd5bd; border-radius: 14px; }
.s3x-activity { display: grid; gap: 8px; }
.s3x-activity-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid #e0e5d7; border-radius: 14px; background: rgba(255,255,255,.68); }
.s3x-activity-row i { flex: 0 0 34px; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 11px; background: #eef3df; font-style: normal; }
.s3x-activity-row p { margin: 0; color: var(--s3x-muted); font-size: 13px; }
.s3x-activity-row b, .s3x-activity-row strong { color: var(--s3x-green-2); }
.s3x-request { align-items: flex-start; border: 1px solid #e3e6d6; background: #fff; }
.s3x-request > div:first-of-type { flex: 1; }
.s3x-request b, .s3x-request small { display: block; }
.s3x-request small { color: var(--s3x-muted); }
.s3x-request-actions { display: flex; gap: 5px; }
.s3x-request-actions button { border: 0; border-radius: 9px; padding: 6px 8px; font-weight: 800; }
.s3x-accept { color: #fff; background: var(--s3x-green); }
.s3x-reject { color: #7b3440; background: #f8e4e7; }

.s3x-game-head { padding: 0 0 20px; }
.s3x-game-head > div:nth-child(2) { text-align: center; font-weight: 900; font-size: 20px; }
.s3x-game-head small { display: block; color: var(--s3x-muted); font-size: 11px; direction: ltr; letter-spacing: .12em; }
.s3x-game-head .s3x-code-help { direction: rtl; letter-spacing: 0; font-size: 10px; font-weight: 400; }
.s3x-live { color: #a91f32; font-size: 12px; font-weight: 900; }
.s3x-game-layout { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 20px; align-items: start; }
.s3x-arena { padding: 22px; }
.s3x-scorebar { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 12px; align-items: center; margin-bottom: 18px; }
.s3x-player { display: flex; gap: 9px; align-items: center; border: 1px solid #d6dec9; border-radius: 16px; padding: 9px; background: rgba(255,255,255,.72); color: inherit; text-align: right; min-width: 0; }
.s3x-player:last-child { flex-direction: row-reverse; text-align: left; }
.s3x-player img { width: 42px; height: 42px; object-fit: contain; }
.s3x-player b, .s3x-player small, .s3x-player em { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 160px; }
.s3x-player small { color: var(--s3x-muted); font-size: 11px; }
.s3x-player em { color: #9a690a; font-size: 11px; font-style: normal; font-weight: 900; }
.s3x-turn { max-width: 150px; text-align: center; color: var(--s3x-green-2); background: #eef5d8; border-radius: 999px; padding: 8px 12px; font-weight: 900; font-size: 12px; }
.s3x-match-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: -7px 0 12px; }
.s3x-match-meta span { padding: 4px 9px; border-radius: 999px; background: rgba(255,255,255,.72); border: 1px solid #d8dfcc; color: var(--s3x-muted); font-size: 11px; font-weight: 800; }
.s3x-board-wrap { max-width: 520px; margin: 0 auto; border-radius: 30px; padding: clamp(12px, 3vw, 24px); background: linear-gradient(145deg, rgba(29,53,34,.94), rgba(8,25,15,.97)); box-shadow: inset 0 0 0 2px rgba(229,184,81,.34), 0 23px 40px rgba(14,37,23,.23); }
.s3x-board { display: grid; grid-template-columns: repeat(var(--s3x-size, 3), minmax(0, 1fr)); grid-template-rows: repeat(var(--s3x-size, 3), minmax(0, 1fr)); gap: var(--s3x-gap, 14px); aspect-ratio: 1; width: 100%; }
.s3x-cell { position: relative; display: grid; place-items: center; width: 100%; height: 100%; min-width: 0; min-height: 0; padding: 0 !important; margin: 0 !important; line-height: 1; appearance: none; -webkit-appearance: none; border: 0; border-radius: 18%; overflow: hidden; background-color: #252827; background-image: var(--s3x-cell); background-size: 100% 100%; box-shadow: inset 0 0 0 1px rgba(255,255,255,.05); transition: transform .15s, filter .15s; }
.s3x-cell:hover { filter: brightness(1.12); }
.s3x-cell img { width: 76%; height: 76%; object-fit: contain; filter: drop-shadow(0 8px 7px rgba(0,0,0,.45)); pointer-events: none; }
.s3x-board[data-size="5"] .s3x-cell img, .s3x-board[data-size="6"] .s3x-cell img { width: 88%; height: 88%; }
.s3x-cell.is-selected { transform: translateY(-3px); box-shadow: 0 0 0 3px var(--s3x-gold), 0 0 22px rgba(229,184,81,.55); }
.s3x-cell.is-target::after { content: ""; width: 24%; aspect-ratio: 1; border-radius: 50%; background: rgba(229,184,81,.8); box-shadow: 0 0 0 7px rgba(229,184,81,.12); }
.s3x-game-tools { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 48px; padding-top: 13px; color: var(--s3x-muted); font-size: 13px; }
.s3x-like { border: 1px solid #efbbc3; border-radius: 999px; background: #fff; color: #bb3348; padding: 8px 14px; font-weight: 900; }
.s3x-like.is-liked { background: #bb3348; color: #fff; }
.s3x-rematch { max-width: 520px; margin: 4px auto 0; padding: 13px; text-align: center; border: 1px solid #dfc477; border-radius: 16px; background: #fff7d9; }
.s3x-rematch p { margin: 0 0 9px; font-weight: 900; }
.s3x-rematch small { display: block; color: var(--s3x-muted); font-weight: 400; }
.s3x-rematch-actions { display: flex; justify-content: center; gap: 7px; }
.s3x-chat { min-height: 420px; display: flex; flex-direction: column; }
.s3x-messages { flex: 1; height: 240px; overflow-y: auto; display: flex; flex-direction: column; gap: 7px; padding: 4px 2px 10px; }
.s3x-message { align-self: flex-start; max-width: 88%; background: #eef1e5; border-radius: 14px 14px 14px 4px; padding: 8px 10px; }
.s3x-message.mine { align-self: flex-end; color: #fff; background: var(--s3x-green); border-radius: 14px 14px 4px 14px; }
.s3x-message b { display: block; font-size: 10px; opacity: .72; }
.s3x-message p { margin: 1px 0 0; overflow-wrap: anywhere; }
.s3x-emojis { display: flex; gap: 5px; overflow-x: auto; padding: 7px 0; }
.s3x-emojis button { flex: 0 0 auto; width: 33px; height: 33px; border: 0; border-radius: 9px; background: #f2f3e9; font-size: 18px; }
.s3x-chat form { display: flex; gap: 6px; }
.s3x-chat form .s3x-btn { padding-inline: 10px; }

.s3x-modal { position: fixed; z-index: 999999; inset: 0; display: grid; place-items: center; padding: 18px; background: rgba(8,22,13,.58); backdrop-filter: blur(5px); }
.s3x-modal-card { position: relative; width: min(440px, 100%); max-height: calc(100svh - 36px); overflow-y: auto; padding: 26px; border-radius: 24px; background: var(--s3x-cream); box-shadow: 0 30px 80px rgba(0,0,0,.3); }
.s3x-settings-modal { width: min(680px, 100%); }
.s3x-modal-card h3 { margin: 0 0 18px; }
.s3x-modal-close { position: absolute; left: 15px; top: 12px; border: 0; background: transparent; font-size: 28px; color: #657066; }
.s3x-modal fieldset { border: 0; padding: 0; margin: 18px 0; }
.s3x-modal legend { font-weight: 900; margin-bottom: 8px; }
.s3x-radio { display: flex !important; grid-template-columns: auto 1fr; align-items: center; border: 1px solid #d7ddca; background: #fff; border-radius: 14px; padding: 10px; margin-top: 8px; }
.s3x-radio input { width: auto; }
.s3x-radio span { display: block; }
.s3x-radio b, .s3x-radio small { display: block; }
.s3x-radio small { color: var(--s3x-muted); font-weight: 400; }
.s3x-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.s3x-form-grid label { align-content: start; padding: 10px; border-radius: 14px; background: rgba(255,255,255,.66); }
.s3x-form-grid small { color: var(--s3x-muted); font-size: 11px; font-weight: 400; }
.s3x-popover { position: fixed; z-index: 1000000; width: min(290px, calc(100vw - 24px)); padding: 14px; border: 1px solid #d8decf; border-radius: 17px; background: #fffef7; box-shadow: 0 20px 60px rgba(16,35,22,.25); }
.s3x-popover h4 { margin: 0 0 2px; }
.s3x-popover p { color: var(--s3x-muted); margin: 0 0 12px; font-size: 12px; }
.s3x-popover .s3x-btn { width: 100%; margin-top: 7px; }
.s3x-toast { position: fixed; z-index: 1000001; right: 50%; bottom: 24px; transform: translateX(50%); max-width: min(440px, calc(100vw - 28px)); padding: 11px 16px; border-radius: 13px; color: #fff; background: #163d29; box-shadow: 0 16px 40px rgba(0,0,0,.25); font-weight: 800; text-align: center; }
.s3x-toast.is-error { background: #8e2938; }
.s3x-achievements { display: grid; gap: 18px; }
.s3x-profile-card { overflow: hidden; }
.s3x-profile-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.s3x-profile-head h2, .s3x-profile-head p { margin: 0; }
.s3x-profile-head p { color: var(--s3x-muted); }
.s3x-profile-avatar { width: 64px; height: 64px; display: grid; place-items: center; border-radius: 22px; color: #fff; background: linear-gradient(135deg, #d7a736, #8b5a09); font-size: 26px; font-weight: 900; }
.s3x-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 9px; }
.s3x-stat { padding: 13px 8px; text-align: center; border-radius: 15px; background: #f2f5e6; }
.s3x-stat b, .s3x-stat small { display: block; }
.s3x-stat b { color: var(--s3x-green-2); font-size: 21px; }
.s3x-stat small { color: var(--s3x-muted); font-size: 10px; }
.s3x-history { display: grid; gap: 8px; }
.s3x-history-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 11px; padding: 11px; border: 1px solid #e0e5d7; border-radius: 14px; background: rgba(255,255,255,.7); }
.s3x-history-result { min-width: 52px; padding: 5px 8px; text-align: center; border-radius: 999px; font-size: 11px; font-weight: 900; }
.s3x-history-result.win { color: #0d7142; background: #d9f5e5; }
.s3x-history-result.loss { color: #963243; background: #f8e0e4; }
.s3x-history-row b, .s3x-history-row small { display: block; }
.s3x-history-row small { color: var(--s3x-muted); }
.s3x-history-points { color: #9a690a; font-weight: 900; white-space: nowrap; }

@media (max-width: 850px) {
  .s3x-layout, .s3x-game-layout { grid-template-columns: 1fr; }
  .s3x-layout > aside { grid-template-columns: 1fr 1fr; }
  .s3x-side-panel { grid-template-columns: 1fr 1fr; }
	.s3x-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .s3x-app { border-radius: 0; min-height: 100svh; margin-inline: calc(50% - 50vw); }
  .s3x-shell { padding: 16px 12px 24px; }
  .s3x-hero { align-items: flex-start; padding: 7px 2px 19px; }
  .s3x-hero p { font-size: 13px; }
  .s3x-online-pill { padding: 7px 9px; font-size: 11px; }
  .s3x-actions, .s3x-layout > aside, .s3x-side-panel { grid-template-columns: 1fr; }
  .s3x-card { padding: 15px; border-radius: 18px; }
  .s3x-inline { align-items: stretch; }
  .s3x-identity .s3x-inline { flex-direction: column; }
	.s3x-identity select { flex-basis: auto; }
  .s3x-game-head { gap: 8px; }
  .s3x-game-head .s3x-btn { padding: 8px 9px; font-size: 12px; }
  .s3x-live { padding: 6px 8px; }
  .s3x-arena { padding: 12px 8px; border-radius: 20px; }
  .s3x-scorebar { gap: 6px; }
  .s3x-player { padding: 6px; gap: 4px; }
  .s3x-player img { width: 34px; height: 34px; }
  .s3x-player small { display: none; }
  .s3x-player b { max-width: 80px; font-size: 12px; }
  .s3x-turn { max-width: 100px; padding: 6px 7px; font-size: 10px; }
  .s3x-board-wrap { border-radius: 22px; padding: 12px; }
  .s3x-board { gap: 8px; }
	.s3x-board[data-size="5"], .s3x-board[data-size="6"] { gap: 4px; }
	.s3x-form-grid { grid-template-columns: 1fr; }
	.s3x-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .s3x-room { padding: 11px; }
  .s3x-room .s3x-btn { padding: 8px 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .s3x-app *, .s3x-app *::before, .s3x-app *::after { scroll-behavior: auto !important; transition: none !important; }
}
