@media(min-width:751px){
 html body dialog:not(#snake-dialog){width:min(500px,calc(100vw - 48px))!important;min-width:0!important;max-width:500px!important;max-height:min(680px,calc(100dvh - 80px))!important;padding:22px!important;margin:auto;overflow:auto}
 html body dialog:not(#snake-dialog) h2{font-size:21px;margin-bottom:14px}
 html body dialog:not(#snake-dialog) textarea{min-height:80px!important;max-height:150px}
 html body dialog:not(#snake-dialog) .field{margin-bottom:12px}
 html body dialog:not(#snake-dialog) .table-wrap{max-width:100%;overflow:auto}
 html body dialog#snake-dialog:not(.snake-fullscreen){width:440px;max-width:calc(100vw - 48px);max-height:min(620px,calc(100dvh - 80px));padding:16px}
 #snake-dialog:not(.snake-fullscreen) #snake-board{width:min(100%,300px,calc(100dvh - 370px))}
 #snake-dialog:not(.snake-fullscreen) .snake-scores{padding:10px 2px}
 #snake-dialog:not(.snake-fullscreen) .snake-help{display:none}
}
dialog [data-modal-error]{color:#ae1234;background:#fff0f2;border:1px solid #ffd1db;margin:12px 0 0;padding:12px;display:block}
.snake-window-actions{display:flex;align-items:center;gap:8px}.snake-window-actions button{height:38px;width:38px;display:grid;place-items:center;background:#ffffff0c;color:white;border:1px solid #ffffff25;border-radius:50%;font-size:24px;cursor:pointer}
.snake-scores #snake-arena{color:#d7f4ad;font-weight:700}.snake-directions button{min-height:44px}.snake-directions{grid-template-rows:repeat(2,44px)}
dialog#snake-dialog.snake-fullscreen{position:fixed;inset:0;margin:0!important;width:100vw!important;height:100dvh!important;max-width:none!important;max-height:none!important;border-radius:0;padding:max(10px,env(safe-area-inset-top)) 12px max(10px,env(safe-area-inset-bottom));display:flex;flex-direction:column;justify-content:center;overflow:hidden;gap:4px}
dialog#snake-dialog.snake-fullscreen .snake-scores{padding:7px 2px}.snake-fullscreen .snake-heading h2{font-size:23px}.snake-fullscreen .snake-scores strong{font-size:23px}
dialog#snake-dialog.snake-fullscreen #snake-board{width:min(calc(100vw - 24px),calc(100dvh - 270px));flex:none}
.snake-fullscreen .snake-actions{margin-top:5px}.snake-fullscreen .snake-directions{margin-top:5px}.snake-fullscreen .snake-help{display:none}
@media(max-width:750px){dialog#snake-dialog{padding:14px;max-height:calc(100dvh - 20px)}#snake-board{width:min(100%,calc(100dvh - 340px))}.snake-actions .button{font-size:11px;padding:10px 12px}.snake-help{font-size:10px}}
@media(max-height:580px) and (orientation:landscape){dialog#snake-dialog.snake-fullscreen{display:grid;grid-template-columns:minmax(160px,1fr) minmax(160px,1fr);grid-template-rows:auto auto auto auto;gap:6px 16px}.snake-fullscreen .snake-heading,.snake-fullscreen .snake-scores,.snake-fullscreen .snake-actions,.snake-fullscreen .snake-directions{grid-column:2}.snake-fullscreen .snake-heading{grid-row:1}.snake-fullscreen .snake-scores{grid-row:2}.snake-fullscreen .snake-actions{grid-row:3}.snake-fullscreen .snake-directions{grid-row:4}dialog#snake-dialog.snake-fullscreen #snake-board{grid-column:1;grid-row:1/5;width:min(100%,calc(100dvh - 24px));margin:auto}}
.is-busy{cursor:progress!important}.is-busy>svg,.button[aria-busy="true"]>svg{animation:action-spin 1s linear infinite;transform-origin:center;flex-shrink:0}.action-spinner{display:inline-block;width:16px;height:16px;flex:0 0 16px;border:2px solid currentColor;border-right-color:transparent;border-radius:50%;animation:action-spin .8s linear infinite}.is-busy{opacity:.8}.stat-v2[role="button"]{cursor:pointer}.stat-v2[role="button"]:focus-visible{outline:3px solid #167aff;outline-offset:3px}@keyframes action-spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.is-busy>svg,.action-spinner{animation-duration:2.5s}}
.history-detail{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;max-height:55dvh;overflow:auto}.history-detail>div{min-width:0;background:#f5f7fb;padding:10px;border-radius:8px}.history-detail dt{font-size:11px;color:#6b7890;margin-bottom:5px}.history-detail dd{font-size:13px;margin:0;overflow-wrap:anywhere;white-space:pre-wrap}@media(max-width:600px){.history-detail{grid-template-columns:minmax(0,1fr)}}
.top-account-switch{display:flex;flex-direction:column;gap:3px;min-width:0;max-width:205px;padding:5px 10px;border:1px solid #e4eaf3;border-radius:10px;background:#fff}.top-account-switch small{font-size:10px;color:#65758d}.top-account-switch select{max-width:185px;width:100%;min-width:0;border:0;background:none;font-size:12px;font-weight:600;color:#172638;overflow:hidden;text-overflow:ellipsis;cursor:pointer}.account-button>img{width:36px;height:36px;object-fit:cover;border-radius:50%}.account-button{padding:0!important;overflow:hidden}.saved-accounts{padding:20px;margin-bottom:20px}.saved-accounts>p{font-size:12px;color:#6c7b90}.saved-account-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:12px}.saved-account-grid article{display:flex;gap:12px;align-items:center;justify-content:space-between;padding:14px;border:1px solid #e2e9f2;border-radius:10px;min-width:0}.saved-account-grid article>div{min-width:0}.saved-account-grid strong{font-size:13px;overflow-wrap:anywhere}.saved-account-grid small{display:block;margin-top:5px;font-size:11px;color:#65768d}@media(max-width:760px){.top-account-switch{max-width:125px;padding:4px 6px}.top-account-switch small{display:none}.top-account-switch select{font-size:16px;max-width:112px}.account-button>img{width:32px;height:32px}.global-search{min-width:0!important}.saved-account-grid{grid-template-columns:minmax(0,1fr)}}
/* Keep the account picker inside the fixed header's content box. */
.v2-shell .topbar .top-account-switch{box-sizing:border-box;flex:0 1 205px;width:205px;min-width:0;max-width:205px;height:38px;max-height:100%;margin:0;padding:3px 9px;gap:0;justify-content:center;align-self:center;overflow:hidden}
.v2-shell .top-account-switch small{display:block;font-size:9px;line-height:11px;margin:0}
.v2-shell .top-account-switch select{box-sizing:border-box;display:block;width:100%;min-width:0;max-width:100%;height:20px;min-height:0;margin:0;padding:0 18px 0 0;border:0;border-radius:0;line-height:20px;font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;box-shadow:none}
.v2-shell .topbar .global-search{min-width:0}
@media(min-width:761px) and (max-width:1200px){.v2-shell .topbar .top-account-switch{flex-basis:170px;width:170px;max-width:170px}.v2-shell .topbar .global-search{flex:1 1 140px;width:auto}.v2-shell .topbar .top-spacer{flex:0 1 0;min-width:0}}
@media(max-width:760px){.v2-shell .topbar .top-account-switch{flex:0 1 125px;width:125px;max-width:32vw;height:36px;padding:4px 6px}.v2-shell .top-account-switch small{display:none}.v2-shell .top-account-switch select{height:26px;line-height:26px;font-size:16px;padding-right:15px}}
@media(max-width:380px){.v2-shell .topbar .top-account-switch{flex-basis:94px;max-width:29vw}.v2-shell .topbar{gap:5px}}

.snake-speed { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-weight: 700; }
.snake-speed select { font-size: 16px; padding: 5px; border-radius: 7px; max-width: 100%; }
.snake-actions { flex-wrap: wrap; }
@media (max-width: 750px), (hover: none) and (pointer: coarse) {
  .snake-dialog .snake-directions { display: none; }
}

@media (min-width: 751px) {
  #snake-dialog:not(.snake-fullscreen)[open] {
    box-sizing: border-box;
    width: min(1050px, calc(100vw - 32px));
    max-width: none;
    max-height: calc(100dvh - 24px);
    padding: clamp(8px, 2vh, 20px);
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(205px, 255px);
    grid-template-rows: repeat(5, auto);
    align-items: center;
    gap: 6px 16px;
  }
  #snake-dialog:not(.snake-fullscreen) #snake-board {
    grid-area: 1 / 1 / 6 / 2;
    width: min(100%, calc(100dvh - 72px));
    height: auto;
    justify-self: center;
    min-width: 0;
  }
  #snake-dialog:not(.snake-fullscreen) .snake-heading { grid-area: 1 / 2; }
  #snake-dialog:not(.snake-fullscreen) .snake-scores { grid-area: 2 / 2; padding: 6px 0; }
  #snake-dialog:not(.snake-fullscreen) .snake-actions { grid-area: 3 / 2; margin: 0; }
  #snake-dialog:not(.snake-fullscreen) .snake-directions { grid-area: 4 / 2; margin: 0; }
  #snake-dialog:not(.snake-fullscreen) .snake-help { grid-area: 5 / 2; display: block; margin: 0; }
}
@media (min-width: 751px) and (max-height: 430px) {
  #snake-dialog:not(.snake-fullscreen) .snake-help { display: none; }
  #snake-dialog:not(.snake-fullscreen) .snake-directions { grid-template-rows: repeat(2, 32px); }
  #snake-dialog:not(.snake-fullscreen) .snake-directions button { min-height: 0; }
  #snake-dialog:not(.snake-fullscreen) .snake-actions .button { min-height: 34px; padding: 5px 8px; }
}

.topbar .connector-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: none;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid #f2cbd4;
  border-radius: 10px;
  background: #fff4f6;
  color: #b8173b;
  text-decoration: none;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 700;
}
.topbar .connector-download:hover { background: #ffe4ea; }
.topbar .connector-download:focus-visible { outline: 2px solid #b8173b; outline-offset: 2px; }
.topbar .connector-download svg { width: 17px; height: 17px; fill: none; stroke: currentColor; }
@media (max-width: 960px) {
  .topbar .connector-download { width: 34px; min-height: 34px; padding: 0; }
  .topbar .connector-download span { display: none; }
}
