/* Shared popup system for the game, homepage and all static pages. */
body:has(dialog.sm-dialog[open]) { overflow: hidden; }
:is(#root,body) dialog.sm-dialog {
  box-sizing: border-box; position: fixed; inset: 0; width: min(400px,calc(100% - 32px)); min-width: 0;
  max-width: 440px; height: fit-content; max-height: calc(100dvh - 32px); margin: auto; padding: 26px;
  overflow: auto; overscroll-behavior: contain; border: 1px solid #d4e1d2; border-radius: 18px;
  background: #fffefb; color: #223b2c; box-shadow: 0 24px 72px #042f1b40;
  font: 400 16px/1.5 "Sofia Sans",system-ui,sans-serif; text-align: left; text-transform: none;
  letter-spacing: normal; color-scheme: light; transform: none; opacity: 1; visibility: visible;
}
:is(#root,body) dialog.sm-dialog:not([open]) { display: none !important; }
:is(#root,body) dialog.sm-dialog[open] { animation: sm-dialog-enter 160ms ease-out; }
:is(#root,body) dialog.sm-dialog::backdrop { background: #042f1b99; backdrop-filter: blur(3px); }
:is(#root,body) dialog.sm-dialog *, :is(#root,body) dialog.sm-dialog *::before, :is(#root,body) dialog.sm-dialog *::after { box-sizing: border-box; }
:is(#root,body) dialog.sm-dialog h2, :is(#root,body) dialog.sm-dialog .caption { margin: 14px 32px 12px 0; color: #223b2c; font: 650 25px/1.2 "Sofia Sans",system-ui,sans-serif; letter-spacing: -.3px; text-transform: none; text-align: left; overflow-wrap: anywhere; }
:is(#root,body) dialog.sm-dialog p { margin: 0 0 18px; padding: 0; color: #47614f; font: inherit; letter-spacing: normal; text-transform: none; }
:is(#root,body) dialog.sm-dialog .sm-dialog-symbol { display: grid; place-items: center; width: 40px; height: 40px; margin: 0 0 16px; border-radius: 12px; background: #f9e7bb; color: #785313; }
:is(#root,body) dialog.sm-dialog .sm-dialog-symbol svg { width: 23px; height: 23px; }
:is(#root,body) dialog.sm-dialog .sm-dialog-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
:is(#root,body) dialog.sm-dialog button:not(.sm-dialog-close), :is(#root,body) dialog.sm-dialog .btn, :is(#root,body) dialog.sm-dialog button.link-button {
  position: static; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  flex: 1 1 130px; width: auto; min-width: 0; min-height: 46px; height: auto; margin: 0; padding: 11px 16px;
  border: 1px solid transparent; border-radius: 10px; background: #f4bd53; color: #4d330d;
  box-shadow: 0 2px 0 #073b231a; font: 600 16px/1.25 "Sofia Sans",system-ui,sans-serif;
  text-align: center; text-indent: 0; text-shadow: none; text-decoration: none; letter-spacing: normal;
  white-space: normal; overflow-wrap: anywhere; cursor: pointer; appearance: none;
}
:is(#root,body) dialog.sm-dialog button::before, :is(#root,body) dialog.sm-dialog button::after { content: none; }
:is(#root,body) dialog.sm-dialog button:not(:disabled):hover { filter: brightness(.97); transform: none; }
:is(#root,body) dialog.sm-dialog button:disabled { opacity: .55; cursor: not-allowed; }
:is(#root,body) dialog.sm-dialog button.sm-dialog-secondary, :is(#root,body) dialog.sm-dialog .btn.outline, :is(#root,body) dialog.sm-dialog button.link-button {
  border-color: #b8cebd; background: transparent; color: #226943; box-shadow: none;
}
:is(#root,body) dialog.sm-dialog button.sm-dialog-danger { background: #bc4641; color: #fffefb; }
:is(#root,body) dialog.sm-dialog .sm-dialog-close {
  position: absolute; inset: 10px 10px auto auto; display: grid; place-items: center; width: 44px; height: 44px; min-height: 44px;
  margin: 0; padding: 10px; border: 0; border-radius: 10px; background: transparent; color: #47614f; box-shadow: none; cursor: pointer;
}
:is(#root,body) dialog.sm-dialog .sm-dialog-close svg { display: block; width: 20px; height: 20px; stroke: currentColor; stroke-width: 1.8; }
:is(#root,body) dialog.sm-dialog .sm-dialog-close:hover { background: #edf3ec; filter: none; }
:is(#root,body) dialog.sm-dialog :focus-visible { outline: 3px solid #226943; outline-offset: 3px; }
:is(#root,body) dialog.sm-dialog input, :is(#root,body) dialog.sm-dialog select { width: 100%; min-width: 0; min-height: 46px; padding: 10px 12px; border: 1px solid #b8cebd; border-radius: 9px; background: #fffefb; color: #223b2c; font: inherit; }
:is(#root,body) dialog.sm-dialog .auth-error, :is(#root,body) dialog.sm-dialog [role="alert"] { margin-top: 14px; padding: 12px; border: 1px solid #efd2cc; border-radius: 10px; background: #fff0eb; color: #923b32; font-size: 14px; text-align: left; }
:is(#root,body) dialog.sm-dialog [role="alert"] p { margin-bottom: 10px; color: inherit; }
:is(#root,body) dialog.sm-dialog .login-reminder { margin: 14px 0; color: #47614f; font-size: 15px; line-height: 1.5; text-align: left; }
:is(#root,body) dialog.sm-dialog button.ggl { width: 100%; background: #fffefb; color: #223b2c; border-color: #b8cebd; box-shadow: none; }
:is(#root,body) dialog.sm-dialog .ggl p { display: inline-flex; align-items: center; gap: 10px; min-height: 22px; margin: 0; padding: 0; background: none; color: inherit; font: inherit; }
:is(#root,body) dialog.sm-dialog .ggl p::before { content: ''; display: block; width: 20px; height: 20px; background: currentColor; mask: url('/assets/layout/img/icon-google.svg') center/contain no-repeat; -webkit-mask: url('/assets/layout/img/icon-google.svg') center/contain no-repeat; }
:is(#root,body) dialog.sm-dialog .avatar { display: grid; place-items: center; width: 64px; height: 64px; margin: 0 0 16px; overflow: hidden; border: 2px solid #f4bd53; border-radius: 18px; background: #edf3ec; }
:is(#root,body) dialog.sm-dialog .avatar img { width: 100%; height: 100%; object-fit: cover; }
:is(#root,body) dialog.sm-dialog .default-avatar { font-size: 32px; }
:is(#root,body) dialog.sm-dialog .level, :is(#root,body) dialog.sm-dialog .coins { display: inline-flex; align-items: center; gap: 8px; width: auto; height: auto; min-height: 32px; margin: 0 8px 16px 0; padding: 5px 10px; border-radius: 8px; background: #edf3ec; color: #223b2c; font: 500 15px/1.3 "Sofia Sans",system-ui,sans-serif; }
:is(#root,body) dialog.sm-dialog .level span { color: inherit; font: inherit; }
:is(#root,body) dialog.sm-dialog .level span::before, :is(#root,body) dialog.sm-dialog .coins::before { content: none; }
:is(#root,body) dialog.sm-dialog .coins svg { width: 20px; height: 20px; color: #a97616; }
:is(#root,body) dialog.sm-dialog .sm-dialog-reward { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 20px 0; padding: 16px; border: 1px solid #efdaab; border-radius: 12px; background: #fff5db; color: #785313; font-size: 32px; font-weight: 650; }
:is(#root,body) dialog.sm-dialog .sm-dialog-reward .coin-icon { width: 32px; height: 32px; }
:is(#root,body) dialog.sm-dialog .sm-dialog-stacked { display: grid; gap: 10px; }
:is(#root,body) dialog.sm-dialog .sm-dialog-stacked > button { width: 100%; }
:is(#root,body) dialog.sm-dialog .link { margin: 10px 0 0; }
:is(#root,body) dialog.sm-dialog .link > button, :is(#root,body) dialog.sm-dialog.pop-profile > .btn { width: 100%; }
/* Legacy static-page scripts still toggle md-show; native dialogs now own the backdrop. */
:is(#root,body) dialog.sm-dialog.pop-login h2 { margin-top: 4px; }
:is(#root,body) dialog.sm-dialog .sm-auth-divider { display: flex; align-items: center; gap: 12px; margin: 12px 0; color: #627467; font-size: 14px; }
:is(#root,body) dialog.sm-dialog .sm-auth-divider::before, :is(#root,body) dialog.sm-dialog .sm-auth-divider::after { content: ''; flex: 1; height: 1px; background: #dce7dc; }
:is(#root,body) dialog.sm-dialog .sm-auth-form { display: grid; gap: 6px; margin: 0; }
:is(#root,body) dialog.sm-dialog .sm-auth-form label { display: block; margin: 0; color: #223b2c; font: 600 15px/1.4 "Sofia Sans",system-ui,sans-serif; }
:is(#root,body) dialog.sm-dialog .sm-auth-form > input { margin-bottom: 6px; }
:is(#root,body) dialog.sm-dialog .sm-auth-form > button { width: 100%; margin-top: 8px; }
:is(#root,body) dialog.sm-dialog .sm-auth-password { position: relative; }
:is(#root,body) dialog.sm-dialog .sm-auth-password input { margin: 0; padding-right: 48px; }
:is(#root,body) dialog.sm-dialog button.sm-auth-reveal { position: absolute; inset: 1px 1px auto auto; width: 44px; min-height: 44px; padding: 12px; border: 0; background: transparent; color: #47614f; box-shadow: none; }
:is(#root,body) dialog.sm-dialog .sm-auth-reveal svg { width: 20px; height: 20px; stroke: currentColor; stroke-width: 1.7; }
:is(#root,body) dialog.sm-dialog p.sm-auth-help { margin: 2px 0 0; color: #627467; font-size: 13px; line-height: 1.4; }
:is(#root,body) dialog.sm-dialog button.sm-auth-switch { display: flex; width: 100%; margin-top: 12px; padding: 8px 0; background: transparent; color: #226943; box-shadow: none; font-size: 14px; }
.wrapper > .md-overlay { display: none !important; }
@keyframes sm-dialog-enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@media(max-width:420px) {
  :is(#root,body) dialog.sm-dialog { padding: 22px 20px; width: calc(100% - 24px); max-height: calc(100dvh - 24px); border-radius: 16px; }
  :is(#root,body) dialog.sm-dialog h2, :is(#root,body) dialog.sm-dialog .caption { font-size: 23px; }
  :is(#root,body) dialog.sm-dialog .sm-dialog-actions { flex-direction: column; }
  :is(#root,body) dialog.sm-dialog .sm-dialog-actions > button { flex: auto; width: 100%; }
}
@media(prefers-reduced-motion:reduce) { :is(#root,body) dialog.sm-dialog[open] { animation: none; } :is(#root,body) dialog.sm-dialog::backdrop { backdrop-filter: none; } }
