/* Sixordle's game owns the play area; Journey owns the separate ad areas. */
:root {
  --sixordle-ad-space: 110px;
  --sixordle-viewport: 100dvh;
}
html.ad-free { --sixordle-ad-space: 0px; }
html, body { margin: 0; min-height: 100%; width: 100%; height: auto; overflow-x: clip; overflow-y: auto; }
#sixordle-layout { display: block; width: min(100% - 24px, 550px); margin: 0 auto; padding-top: 8px; }
#sixordle-main { min-width: 0; }
#body { width: 100%; height: auto !important; min-height: 0 !important; margin: 0 auto !important; }
#game {
  flex: none !important;
  height: calc(var(--sixordle-viewport) - var(--sixordle-ad-space) - 16px);
  min-height: 340px !important;
  max-height: none;
  gap: 6px;
  padding: 4px;
  box-sizing: border-box;
}
#game > table:first-child { flex: 0 0 auto; height: 42px; font-size: 16px; }
#game > table:first-child .box { padding: 4px; }
#game > table:first-child img { width: 24px; height: 24px; }
#game #game_title { font-size: 15px !important; }
#game .game-subscribe-banner { box-sizing: border-box; width: 100%; flex: 0 0 auto; margin: 0; padding: 6px 8px; font-size: 12px; line-height: 1.3; }
#game .game-subscribe-banner button { padding: 6px 10px; font-size: 12px; }
#normal-container, #widescreen-container {
  flex: 1 1 0 !important;
  min-height: 80px !important;
  height: auto !important;
  max-height: none;
  overflow: auto !important;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
#keyboard { border-collapse: collapse !important; border-spacing: 0 !important; flex: 0 0 auto; margin: 0 auto !important; table-layout: fixed; }
#keyboard td { width: 10% !important; box-sizing: border-box; height: clamp(34px, 6dvh, 46px); font-size: clamp(18px, 4vw, 26px); line-height: 1; touch-action: manipulation; }
#post_game { flex: 0 1 auto; min-height: 0; overflow: auto; font-size: 18px; }
#widescreen-question, #widescreen-reset, #widescreen-feedback { flex: 0 0 auto; font-size: 14px; }
#widescreen-question .button, #widescreen-reset .button, #widescreen-feedback .button { width: auto; height: auto; padding: 5px 8px; }
#journey-sidebar { display: none; }
#sixordle-guide {
  display: block;
  margin: calc(var(--sixordle-ad-space) + 32px) auto 0;
  padding: 24px 20px;
  border-top: 1px solid #343a36;
  background: #141a17;
  color: #e0e7e2;
  font: 16px/1.75 system-ui, sans-serif;
  overflow-wrap: anywhere;
}
#sixordle-guide h1 { font-size: 26px; line-height: 1.25; margin: 0 0 16px; }
#sixordle-guide h2 { font-size: 20px; line-height: 1.4; margin-top: 28px; }
#sixordle-guide a, #sixordle-footer a { color: #6ce1b8; }
#sixordle-footer {
  clear: both;
  max-width: 940px;
  margin: 24px auto 0;
  padding: 20px 16px calc(var(--sixordle-ad-space) + 24px);
  text-align: center;
  color: #b5c1b9;
  font: 13px/1.8 system-ui, sans-serif;
}
html[data-sixordle-page="guide"] #sixordle-guide { display: none; }
@media (min-width: 1100px) {
  #sixordle-layout { display: grid; grid-template-columns: minmax(0, 550px) 300px; gap: 32px; width: min(100% - 48px, 882px); align-items: stretch; }
  #journey-sidebar { display: block; position: static; width: 300px; min-width: 300px; min-height: 650px; padding: 0; border: 0; }
  #journey-sidebar .ad-space-label { display: none; padding: 8px 0 12px; color: #a8b4ac; font: 10px/1.4 system-ui, sans-serif; letter-spacing: .12em; text-align: center; text-transform: uppercase; }
  html.sixordle-wide #sixordle-layout { grid-template-columns: minmax(0, 1fr) 300px; width: min(100% - 48px, 1800px); }
  html[data-sixordle-page="home"] #sixordle-layout, html.ad-free #sixordle-layout { display: block; width: min(100% - 24px, 550px); }
  html.ad-free.sixordle-wide #sixordle-layout { width: min(100% - 24px, 1800px); }
  html[data-sixordle-page="home"] #journey-sidebar, html.ad-free #journey-sidebar { display: none; }
}
@media (max-width: 600px) {
  html, body { height: auto !important; overflow-y: auto !important; }
  #sixordle-layout { width: 100%; padding-top: 0; }
  #body { height: auto !important; overflow: visible !important; }
  #game { height: calc(var(--sixordle-viewport) - var(--sixordle-ad-space) - 8px); padding: 4px; }
  #game > table:first-child { height: 38px; font-size: 14px; }
  #game #game_title { font-size: 12px !important; line-height: 1.2; }
  #game > table:first-child #restart, #game > table:first-child #reset_free { width: 15% !important; }
  #game > table:first-child td:has(button[data-open-subscription]) { display: none; }
  #game .game-subscribe-banner { font-size: 11px; }
  #sixordle-guide { margin-top: calc(var(--sixordle-ad-space) + 20px); padding: 20px 16px; }
}
/* Keep the keyboard usable when a phone rotates or browser chrome reduces height. */
@media (max-height: 480px) {
  #game { min-height: 0 !important; gap: 3px; }
  #game .game-subscribe-banner { display: none; }
  #game > table:first-child { height: 32px; }
  #keyboard td { height: 30px; font-size: 18px; }
  #normal-container, #widescreen-container { min-height: 32px !important; }
  #widescreen-question, #widescreen-reset, #widescreen-feedback { display: none !important; }
}
