/* Cutoff Poker as a phone app (iPhone and Android): the notch and home-bar safe areas, the installed full-screen
   mode, the "Get the app" bar and sheet, and touch behaviour. Loaded last, after styles.css and fx.css. */

:root { --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px); --sal: env(safe-area-inset-left, 0px); --sar: env(safe-area-inset-right, 0px); }

/* ---------- touch behaviour ---------- */
html { -webkit-tap-highlight-color: transparent; }
button, a, label, input, select, summary, [data-player] { touch-action: manipulation; }
body.on-table { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
body.on-table input, body.on-table textarea, body.on-table .log { -webkit-user-select: text; user-select: text; }
img { -webkit-user-drag: none; }

/* ---------- the strip behind the clock and the notch ----------
   With viewport-fit=cover the page runs under the iPhone status bar when it is installed. A fixed strip in the page
   colour keeps scrolled content out from under the clock; the page itself starts below it. */
.safe-top { position: fixed; left: 0; right: 0; top: 0; height: var(--sat); background: var(--bg); z-index: 70; pointer-events: none; }
body { padding-top: var(--sat); padding-left: var(--sal); padding-right: var(--sar); }
header.top { top: var(--sat); }
.multi { top: calc(49px + var(--sat)); }
main.view:not(.full) { padding-bottom: calc(60px + var(--sab)); }
.modal-bg { padding: calc(16px + var(--sat)) 16px calc(16px + var(--sab)); }
.toasts { bottom: calc(16px + var(--sab)); }
#user-menu .um-panel { padding-top: var(--sat); padding-bottom: var(--sab); }

@media (max-width: 640px) {
  .toasts { top: calc(8px + var(--sat)); bottom: auto; }
  /* the table is the whole screen: its bottom buttons stay clear of the home bar */
  body.on-table { height: 100vh; height: 100dvh; padding-bottom: 0; }
  body.on-table main.view.full, body.multi-on.on-table main.view.full { padding-bottom: calc(6px + var(--sab)); }
  .table-page.side-open .side { padding-bottom: var(--sab); }
  /* installed: there is no browser bar to bring the page back from a bounce, so the page never rubber-bands */
  html.standalone, html.standalone body { overscroll-behavior-y: none; }
  /* bigger, easier targets where thumbs land */
  .table-bar .bar-back button, .table-bar #table-menu { min-width: 40px; min-height: 36px; }
  .modal { max-height: calc(100dvh - 32px - var(--sat) - var(--sab)); }
  .modal .actions button { min-height: 44px; }
  .menu-list button { min-height: 46px; }
}

/* ---------- "Get the app": the bar in the lobby and the how-to sheet ---------- */
.install-nudge { display: flex; align-items: center; gap: 10px; padding: 9px 10px; margin-bottom: 12px; border-radius: var(--r-lg); border: 1px solid rgba(47, 140, 255, .45);
  background: linear-gradient(90deg, rgba(47, 140, 255, .16), rgba(255, 61, 154, .1)); box-shadow: var(--e1); }
.install-nudge img { width: 40px; height: 40px; border-radius: 10px; flex: none; }
.install-nudge > div { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; }
.install-nudge b { font-family: var(--display); font-size: 15px; letter-spacing: .06em; text-transform: uppercase; }
.install-nudge small { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.install-nudge button.primary { min-height: 36px; padding: 6px 16px; }
.install-nudge button.icon { font-size: 20px; line-height: 1; padding: 4px 9px; min-height: 36px; color: var(--muted); border-color: transparent; }
.um-item.um-install { color: var(--gold-2); }

#app-sheet { position: fixed; inset: 0; z-index: 80; display: grid; align-items: end; justify-items: center; }
#app-sheet .as-backdrop { position: absolute; inset: 0; background: rgba(3, 5, 12, .7); backdrop-filter: blur(3px); }
.as-panel { position: relative; width: 100%; max-width: 460px; background: var(--bg-2); border: 1px solid var(--line-2); border-bottom: 0; border-radius: 22px 22px 0 0; padding: 22px 20px calc(18px + var(--sab)); box-shadow: 0 -16px 50px rgba(0, 0, 0, .7); animation: as-in var(--t-modal) var(--ease-out); text-align: center; }
@keyframes as-in { from { transform: translateY(40px); } to { transform: none; } }
.as-panel .as-icon { width: 72px; height: 72px; border-radius: 18px; box-shadow: 0 8px 24px rgba(0, 0, 0, .6), 0 0 30px rgba(47, 140, 255, .35); }
.as-panel h3 { font-family: var(--display); font-size: 20px; letter-spacing: .04em; text-transform: uppercase; margin: 14px 0 6px; }
.as-panel p { margin: 0 0 14px; font-size: 14px; }
.as-steps { list-style: none; margin: 0; padding: 0; text-align: left; display: flex; flex-direction: column; gap: 8px; }
.as-steps li { display: flex; gap: 12px; align-items: center; background: var(--bg-3); border: 1px solid var(--line); border-radius: var(--r-md); padding: 11px 12px; font-size: 14.5px; line-height: 1.35; }
.as-steps li svg { vertical-align: -5px; color: var(--gold-2); margin: 0 1px; }
.as-n { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--gold); color: #061021; font-weight: 800; font-size: 13px; }
.as-actions { display: flex; justify-content: center; margin-top: 16px; }
.as-actions button { min-width: 140px; min-height: 44px; }
@media (min-width: 641px) { #app-sheet { align-items: center; } .as-panel { border-radius: 22px; border-bottom: 1px solid var(--line-2); padding-bottom: 22px; } }

/* ---------- a phone held sideways: the table is drawn for portrait ---------- */
.rotate-note { display: none; }
@media (orientation: landscape) and (max-height: 500px) and (max-width: 960px) and (pointer: coarse) {
  body.on-table .rotate-note { display: flex; position: fixed; inset: 0; z-index: 90; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center;
    background: rgba(4, 5, 10, .96); color: var(--text); padding: 20px; }
  .rotate-note img { height: 64px; width: auto; animation: rotate-hint 1.8s ease-in-out infinite; filter: drop-shadow(0 0 14px rgba(47, 140, 255, .6)); }
  .rotate-note b { font-family: var(--display); font-size: 22px; letter-spacing: .06em; text-transform: uppercase; margin-top: 10px; }
  .rotate-note span { color: var(--muted); font-size: 14px; }
}
@keyframes rotate-hint { 0%, 20% { transform: rotate(90deg); } 60%, 100% { transform: rotate(0); } }

/* ---------- small fixes found on a 390 px screen ---------- */
@media (max-width: 640px) {
  .table-bar [data-cmd] { white-space: nowrap; flex: none; padding: 6px 10px; }     /* "I'm back" was wrapping onto two lines */
}
