/* The phone's Home (30 Oct 2026, the mock-up Jeff approved: media/mockups-2026-10-30-home/home.html). Its own layout
   file (Jeff, 29 Oct: each screen gets its own layout code; only theme.css's tokens are shared), loaded by home.html
   for a touch screen up to a tablet; site.css hides the web page there. The app's Home tab shows this page above the
   app's own tab bar, so everything fits one screen without scrolling from 390 x 668 up, every word 15 px or more.
   Top to bottom: the chips, the school's tile and name, the Coach greeting by name, Play, the Rush card, the timed set.
   2 Nov (docs/plans/2026-11-02-home-page.md): the first-game coins (or the level line) over the buttons, Play now with
   Play with friends and Meet players beside it, the Learn to play card, and the move of the day beside the Rush. It
   still fits one screen (the locked phone_home test); it may scroll inside itself on a very short screen, never
   sideways.
   12 Nov (docs/research/2026-10-28-levels-league-and-screens.md 1.1, "Home: four things"): the thin strip with its
   menu, the Play card (Play, the opponents, the level bar, the Coach's small face), the Rush card, the seasonal set.
   The tile and name, the Coach's standing paragraph, Play with friends, Meet players, Learn to play, Teaching and the
   move of the day left Home for the menu and the app's tabs. */

.phone-home { --ph-cream: var(--g-cream, #fff6e2); --ph-gold-1: #ffe58a; --ph-gold-2: #f2c13d; --ph-gold-3: #c98a12; --ph-gold-ink: #3a2606;
  position: fixed; inset: 0; z-index: 5; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; color: var(--ph-cream); font-family: var(--g-font-body);
  background: radial-gradient(90% 60% at 50% 28%, #3f8a55 0%, #24603a 45%, #123a22 100%); }
.phone-home::before { content: ""; position: fixed; inset: -20%; pointer-events: none;
  background: radial-gradient(40% 30% at 50% 26%, rgba(255, 236, 170, 0.24), transparent 70%); animation: ph-lamp 6s ease-in-out infinite; }
@keyframes ph-lamp { 50% { opacity: 0.6; } }
.phone-home a { color: inherit; text-decoration: none; }
.phone-home a:focus-visible { outline: 3px solid #8fd0ff; outline-offset: 3px; }

/* tiles drifting down behind everything, faint */
.ph-drift { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.ph-fall { position: absolute; top: -90px; opacity: 0.2; filter: blur(0.6px); animation: ph-fall linear infinite; }
@keyframes ph-fall { to { transform: translateY(calc(100vh + 180px)) rotate(var(--spin)); } }
.ph-tile { display: block; width: 38px; height: 53px; border-radius: 6px; position: relative; overflow: hidden;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0) 16%), radial-gradient(130% 95% at 50% 18%, #fffdf7 0%, var(--tile) 55%, var(--tile-edge) 135%);
  box-shadow: 0 2px 0 var(--tile-shadow);
  --pip-bam: var(--bam); --pip-crak: var(--crak); --pip-dot: var(--dot); --pip-wind: var(--wind); --tile-ink: var(--ink); --tile-face: var(--tile); }
.ph-tile svg { position: absolute; left: 6%; top: 11%; width: 88%; height: 84%; }
.ph-tile.soap svg { left: 0; top: 0; width: 100%; height: 100%; }
.ph-tile.joker { display: grid; place-items: center; font: 800 0.7rem var(--display); color: var(--joker); }
.ph-tile.flower { display: grid; place-items: center; font: 800 1.1rem var(--display); color: var(--bam); }

/* one column that fills the screen: the set's banner takes what room is left */
.ph-stack { position: relative; z-index: 2; min-height: 100%; box-sizing: border-box; margin: 0 auto; max-width: 480px;
  display: flex; flex-direction: column; justify-content: flex-start; gap: 14px;
  padding: calc(8px + env(safe-area-inset-top, 0px)) calc(16px + env(safe-area-inset-right, 0px)) calc(12px + env(safe-area-inset-bottom, 0px)) calc(16px + env(safe-area-inset-left, 0px)); }
.ph-stack > * { flex: none; }

/* 1. the chips */
.ph-chips { display: flex; align-items: center; gap: 6px; min-width: 0; }
.ph-chip { display: inline-flex; align-items: center; gap: 6px; height: 38px; box-sizing: border-box; padding: 0 12px; border-radius: 999px; white-space: nowrap;
  background: rgba(0, 0, 0, 0.34); box-shadow: inset 0 0 0 1.5px rgba(255, 233, 163, 0.28); font: 400 17px/1 var(--g-font-display); color: var(--ph-cream);
  font-variant-numeric: tabular-nums; }
.ph-chip[hidden] { display: none; }
.ph-chips > :first-child:not([hidden]), .ph-chips > [hidden] + * { margin-right: auto; }
.ph-coins { padding-left: 7px; }
.ph-coins b { font-weight: 400; }
.ph-lv { background: linear-gradient(180deg, #2f6fc4, #1d4a8f); box-shadow: inset 0 0 0 1.5px #8fc4ff; }
.ph-streak { padding-left: 10px; }
.ph-chips > .ph-signin { margin: 0 0 0 auto; }
/* the menu at the strip's right end: what left Home (12 Nov), one tap away */
.ph-menu { position: relative; flex: none; margin-left: auto; }
.ph-chips > .ph-signin + .ph-menu { margin-left: 0; }
.ph-menu-open { width: 44px; padding: 0; justify-content: center; list-style: none; cursor: pointer; }
.ph-menu-open::-webkit-details-marker { display: none; }
.ph-menu[open] .ph-menu-open { background: rgba(0, 0, 0, 0.55); box-shadow: inset 0 0 0 1.5px var(--ph-gold-2); }
.ph-menu-panel { position: absolute; right: 0; top: calc(100% + 8px); z-index: 20; width: min(270px, calc(100vw - 32px)); box-sizing: border-box;
  display: grid; gap: 4px; padding: 8px; border-radius: 18px; background: linear-gradient(180deg, #1d5232, #0f3320);
  box-shadow: inset 0 0 0 2px rgba(255, 233, 163, 0.45), 0 14px 30px rgba(0, 0, 0, 0.55); }
.ph-menu-panel a { display: flex; align-items: center; gap: 10px; min-height: 46px; box-sizing: border-box; padding: 6px 12px; border-radius: 12px;
  font: 400 18px/1.15 var(--g-font-display); color: var(--ph-cream); background: rgba(255, 255, 255, 0.06); }
.ph-menu-panel a:active { background: rgba(255, 255, 255, 0.16); }
/* invite your table with coins (19 Nov; invite.js tableButton): a menu row like the links, its line under it small */
.ph-invite .invite-button { display: flex; align-items: center; width: 100%; min-height: 46px; box-sizing: border-box; padding: 6px 12px; border: 0;
  border-radius: 12px; text-align: left; cursor: pointer; font: 400 18px/1.15 var(--g-font-display); color: #2a1d05;
  background: linear-gradient(#f6cd63, #e7ae35); }
.ph-invite .invite-said { margin: 4px 12px 2px; font-size: 13px; line-height: 1.3; color: var(--ph-cream); }
.ph-invite .invite-said:empty { display: none; }
.ph-menu-panel .ph-move b { font: inherit; }
.ph-menu-panel .ph-move-tile { flex: none; width: 24px; height: 34px; }
.ph-coin { flex: none; display: inline-block; width: 22px; height: 22px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff3b0, #f2c13d 55%, #b37a0c);
  box-shadow: inset 0 0 0 2px rgba(120, 70, 0, 0.45); }
.ph-flame { flex: none; display: inline-block; width: 16px; height: 21px; background: radial-gradient(60% 55% at 50% 70%, #ffe58a 0 35%, #ff9a2e 60%, #e5482a 100%);
  border-radius: 50% 50% 45% 45% / 62% 62% 38% 38%; transform: rotate(-6deg); }

/* 2. the Play card: the biggest thing on Home. Play across it, the opponents in small type, the level bar, and the
   Coach's small face at its top right corner */
.ph-card { position: relative; display: grid; gap: 8px; margin-top: 10px; padding: 14px; border-radius: 26px;
  background: linear-gradient(180deg, rgba(10, 40, 24, 0.55), rgba(6, 26, 15, 0.7)); box-shadow: inset 0 0 0 2px rgba(255, 233, 163, 0.3), 0 8px 18px rgba(0, 0, 0, 0.3); }
.ph-play { position: relative; display: grid; place-items: center; height: 88px; margin: 0 0 7px; border-radius: 24px;
  font: 400 44px/1 var(--g-font-display); color: var(--ph-gold-ink) !important; letter-spacing: 0.02em; text-shadow: 0 2px 0 rgba(255, 255, 255, 0.45);
  background: linear-gradient(180deg, var(--ph-gold-1) 0%, var(--ph-gold-2) 52%, var(--ph-gold-3) 100%);
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.75), inset 0 -4px 0 rgba(120, 70, 0, 0.35), 0 7px 0 #8a5a08, 0 16px 28px rgba(0, 0, 0, 0.45);
  animation: ph-breathe 2.2s ease-in-out 1s infinite; }
.ph-play::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(100deg, transparent 35%, rgba(255, 255, 255, 0.55) 50%, transparent 65%) -200% 0 / 200% 100% no-repeat;
  animation: ph-sweep 3.4s ease-in-out 1.5s infinite; }
.ph-play:active { transform: translateY(5px); box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.7), 0 2px 0 #8a5a08, 0 8px 16px rgba(0, 0, 0, 0.4); }
@keyframes ph-breathe { 50% { transform: scale(1.03); } }
@keyframes ph-sweep { 0% { background-position: -200% 0; } 35%, 100% { background-position: 200% 0; } }
/* the opponents she chose last, small, under Play */
.ph-who { margin: -2px 0 0; text-align: center; font: 700 calc(15px * var(--text, 1))/1.2 var(--g-font-body); color: rgba(255, 246, 226, 0.85); }
.ph-who[hidden] { display: none; }
/* under Play: the first-game coins for a guest, or the level bar and "N games to Level X: the reward" */
.ph-line { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 2px 6px; margin: 0; text-align: center;
  font: 700 calc(16px * var(--text, 1))/1.3 var(--g-font-body); color: var(--ph-cream); text-wrap: balance; }
.ph-line[hidden] { display: none; }
.ph-line b { color: var(--ph-gold-1); font-weight: 800; }
.ph-line .ph-coin { width: 20px; height: 20px; }
.ph-level { display: grid; gap: 6px; }
.ph-bar { position: relative; display: block; height: 18px; border-radius: 999px; overflow: hidden; background: rgba(0, 0, 0, 0.45);
  box-shadow: inset 0 0 0 1.5px rgba(143, 196, 255, 0.55); }
.ph-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: inherit; background: linear-gradient(180deg, #8fc4ff, #2f6fc4 60%, #1d4a8f); }
.ph-bar i { position: absolute; top: 4px; bottom: 4px; width: 2px; margin-left: -1px; background: rgba(255, 255, 255, 0.35); }
/* her place in this week's league, when she has one: a small pill, not an underlined line */
.ph-league { justify-self: center; padding: 4px 12px; border-radius: 999px; text-align: center;
  font: 700 calc(15px * var(--text, 1))/1.25 var(--g-font-body); color: var(--ph-cream); background: rgba(194, 69, 122, 0.55); box-shadow: inset 0 0 0 1.5px #ffb3c9; }
/* the Coach: a small face on the card's top right corner; her words appear beside her only when there is something
   new (the first visit), or when tapped, and go again */
.ph-kora { position: absolute; right: 8px; top: -20px; z-index: 3; width: 58px; height: 58px; padding: 0; border: 0; border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, #fff7e0, #f2d9a0); box-shadow: 0 0 0 2.5px var(--ph-gold-2), 0 4px 10px rgba(0, 0, 0, 0.45); overflow: hidden; cursor: pointer; }
.ph-kora img { display: block; width: 100%; height: auto; margin-top: 2px; }
/* her words sit under Play, never over it, so Play stays readable and tappable while she speaks */
.ph-say { position: absolute; right: 12px; top: 106px; z-index: 4; max-width: min(300px, calc(100% - 24px)); margin: 0; padding: 10px 12px;
  border-radius: 16px 4px 16px 16px; background: #fffaf0; color: #2b2110; font: 700 calc(16px * var(--text, 1))/1.3 var(--g-font-body);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35); }
.ph-say[hidden] { display: none; }

/* 3. Today's Mahjong Rush, with the streak and the chest */
.ph-rush { display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 14px; border-radius: 20px;
  background: linear-gradient(180deg, #7a28a0, #46126a); box-shadow: inset 0 0 0 2px #ffb347, 0 6px 14px rgba(0, 0, 0, 0.3); }
.ph-rush:active { filter: brightness(1.08); }
.ph-bolt { flex: none; width: 32px; height: 40px; background: linear-gradient(180deg, #ffe58a, #f2a33d);
  clip-path: polygon(58% 0, 8% 58%, 44% 58%, 30% 100%, 92% 38%, 54% 38%, 72% 0); filter: drop-shadow(0 2px 0 rgba(60, 20, 0, 0.5)); }
.ph-rush-words { flex: 1; min-width: 0; display: grid; gap: 3px; }
.ph-rush-words b { font: 400 21px/1.1 var(--g-font-display); color: #ffd36b; }
.ph-rush-words span { font: 700 calc(16px * var(--text, 1))/1.3 var(--g-font-body); color: #fff6e2; }
.ph-rush-words .ph-flame { width: 13px; height: 17px; vertical-align: -2px; margin-right: 4px; }
.ph-chest { flex: none; width: 74px; display: grid; justify-items: center; }
.ph-chest img { display: block; width: 58px; height: auto; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.4)); animation: ph-wiggle 3s ease-in-out infinite; transform-origin: 50% 90%; }
@keyframes ph-wiggle { 0%, 80%, 100% { transform: none; } 85% { transform: rotate(-6deg); } 90% { transform: rotate(6deg); } 95% { transform: rotate(-3deg); } }
.ph-amt { margin-top: 2px; display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px 2px 4px; border-radius: 999px;
  background: rgba(0, 0, 0, 0.55); font: 400 16px/1.2 var(--g-font-display); color: #ffe9a8; }
.ph-amt .ph-coin { width: 16px; height: 16px; }

/* 4. the timed set: its banner fills what room is left, with its name, the pieces collected and Shop */
.ph-event { position: relative; display: flex; align-items: flex-end; flex: 1 1 96px !important; min-height: 96px; max-height: 170px; border-radius: 20px; overflow: hidden;
  box-sizing: border-box; border: 2px solid #ffb347; background: #2a0f3a center 35% / cover no-repeat; box-shadow: 0 6px 14px rgba(0, 0, 0, 0.3); }
.ph-event-words { width: 100%; display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; padding: 26px 14px 10px;
  background: linear-gradient(transparent, rgba(30, 6, 40, 0.94)); }
.ph-event-say { display: grid; gap: 4px; min-width: 0; }
.ph-event-say b { font: 400 22px/1.1 var(--g-font-display); color: #ffb347; }
.ph-event-say > span { font: 700 calc(16px * var(--text, 1))/1.3 var(--g-font-body); color: #fff6e2; }
.ph-pips { display: flex; gap: 4px; }
.ph-pips i { width: 12px; height: 12px; border-radius: 50%; background: rgba(20, 4, 28, 0.7); box-shadow: inset 0 0 0 1.5px rgba(255, 179, 71, 0.85); }
.ph-pips i.on { background: #ffb347; }
.ph-go { flex: none; padding: 6px 12px; border-radius: 999px; font: 400 17px/1.2 var(--g-font-display); color: var(--ph-gold-ink);
  background: linear-gradient(180deg, var(--ph-gold-1), var(--ph-gold-2)); box-shadow: 0 3px 0 #8a5a08; }

/* the games played at our tables, below the first screen, and Watch any of them */
.ph-count { position: relative; z-index: 2; display: grid; justify-items: center; gap: 10px; max-width: 480px; margin: 0 auto;
  padding: 22px 16px calc(28px + env(safe-area-inset-bottom, 0px)); text-align: center; }
.ph-hands { position: relative; margin: 0; display: grid; justify-items: center; gap: 2px; }
.ph-hands .hc-num { font: 400 36px/1 var(--g-font-display); color: #f7e7b4; text-shadow: 0 3px 0 rgba(0, 0, 0, 0.3); font-variant-numeric: tabular-nums; }
.ph-hands .hc-what { font: 700 calc(16px * var(--text, 1))/1.3 var(--g-font-body); }
.ph-hands .hc-today { font: 600 calc(15px * var(--text, 1))/1.3 var(--g-font-body); color: rgba(255, 246, 226, 0.8); }
.ph-watch { padding: 8px 18px; border-radius: 999px; font: 400 18px/1.2 var(--g-font-display); color: var(--ph-cream) !important;
  background: linear-gradient(180deg, #3f9a5c 0%, #2a7445 55%, #1d5532 100%); box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.3), 0 4px 0 #0f3a20; }
.ph-hands.hc-glow .hc-num { color: #ffe58a; text-shadow: 0 0 18px rgba(255, 213, 90, 0.95), 0 0 42px rgba(242, 193, 61, 0.7); }

/* a larger phone (430 wide and up): Play a little larger */
@media (min-width: 420px) {
  .ph-play { height: 96px; font-size: 48px; }
  .ph-say { top: 114px; }
}
/* a tall page (Safari on a phone with its bars hidden): the banner takes more of the room */
@media (min-height: 800px) {
  .ph-event { max-height: 240px; }
}
/* a short page (the app's Home above its tab bar on a smaller phone): Play and the gaps a little smaller */
@media (max-height: 720px) {
  .ph-stack { gap: 10px; }
  .ph-event { min-height: 88px; }
  .ph-play { height: 80px; }
}

/* held sideways: the Play card on the left, the Rush and the set on the right; the page may scroll */
@media (orientation: landscape) and (max-height: 600px) {
  .ph-stack { max-width: 920px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-auto-rows: min-content;
    column-gap: 24px; row-gap: 10px; align-content: start; overflow-y: auto; }
  .ph-chips { grid-column: 1 / -1; }
  .ph-card { grid-column: 1; grid-row: 2 / span 2; align-self: start; }
  .ph-today, .ph-event { grid-column: 2; }
  .ph-event { min-height: 96px; }
}

/* a tablet held upright that still gets this Home (a short one): the same, larger */
@media (min-width: 700px) and (min-height: 760px) {
  .ph-stack { max-width: 600px; gap: 16px; padding-top: calc(24px + env(safe-area-inset-top, 0px)); padding-bottom: 32px; }
  .ph-chip { height: 46px; font-size: 20px; padding: 0 16px; }
  .ph-play { height: 112px; font-size: 56px; }
  .ph-kora { width: 76px; height: 76px; }
  .ph-rush-words b { font-size: 28px; }
  .ph-rush-words span { font-size: calc(19px * var(--text, 1)); }
  .ph-event { max-height: 260px; }
  .ph-event-say b { font-size: 30px; }
  .ph-event-say > span { font-size: calc(19px * var(--text, 1)); }
}

/* the cards' lines break evenly, never leaving one word on a line of its own */
.ph-rush-words span { text-wrap: balance; }

@media (prefers-reduced-motion: reduce) {
  .ph-drift { display: none; }
  .phone-home *, .phone-home::before { animation: none !important; }
}

