/* The phone page (docs/REMOTE.md, section 6). It loads the Mac's own app.css and looks.css first, so the chat, buttons
   and colours are the same; this file lays them out for a phone held in one hand: one column, the chat under the
   thumb, a 16 px gutter, the notch and the home bar left clear (safe-area insets), and text big enough to read. */

html, body { height: 100%; }
body.phone { overflow: hidden; font-size: 15px; background: var(--app); overscroll-behavior: none; }
body.phone button { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
/* iOS zooms into any field under 16 px when it is tapped */
body.phone textarea, body.phone input, body.phone select { font-size: 16px; }
#root { height: 100dvh; display: flex; flex-direction: column; }

/* ----- the frame: a banner when the Mac can't be reached, then the screen ----- */
.ph { flex: 1; min-height: 0; display: flex; flex-direction: column; padding-top: env(safe-area-inset-top); background: var(--app); }
.ph-banner { flex: none; display: flex; align-items: center; gap: 12px; padding: 10px 16px; font-size: 13px; line-height: 1.4; background: var(--skbg); color: var(--sky); }
.ph-banner.warn { background: var(--cobg); color: #F7A8B6; }
.ph-link { flex: none; margin-left: auto; color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

.ph-center { flex: 1; min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: calc(32px + env(safe-area-inset-top)) 24px calc(32px + env(safe-area-inset-bottom)); text-align: center; }
.ph .ph-center { min-height: 0; padding-top: 32px; }
.ph-center h1 { margin: 8px 0 0; font-size: 22px; font-weight: 700; letter-spacing: -0.015em; line-height: 1.25; max-width: 18em; }
.ph-center p { margin: 0; max-width: 34ch; line-height: 1.55; color: var(--tx2); }
.ph-center p.mu { color: var(--tx3); font-size: 14px; }
.ph-center .btn { height: 44px; padding: 0 22px; border-radius: 22px; font-size: 15px; margin-top: 8px; }

/* ----- a page: a header, then what scrolls ----- */
.ph-page { flex: 1; min-height: 0; width: 100%; min-width: 0; display: flex; flex-direction: column; }
.ph-page > * { min-width: 0; max-width: 100%; }
.ph-head { flex: none; height: 56px; display: flex; align-items: center; gap: 10px; padding: 0 8px 0 16px; border-bottom: 1px solid var(--ln); }
.ph-project .ph-head { padding-left: 4px; }
.ph-head-t { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.ph-head-t b, .ph-head-t span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ph-head-t b { font-size: 16px; font-weight: 650; letter-spacing: -0.01em; }
.ph-head-t span { font-size: 12px; color: var(--tx3); }
.ph-head .ib, .ph-sheet .ib { width: 44px; height: 44px; border-radius: 12px; }
.ph-head .ib:active { background: var(--s2); }
.ph-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 16px 16px calc(24px + env(safe-area-inset-bottom)); }

/* ----- Home: a new project from an idea, then the projects ----- */
.ph-new { display: flex; flex-direction: column; gap: 10px; padding: 12px 12px 10px 14px; border-radius: 20px; border: 1px solid rgba(255, 255, 255, 0.1); background: rgba(255, 255, 255, 0.04); transition: border-color 0.2s var(--ease); }
.ph-new:focus-within { border-color: rgba(255, 255, 255, 0.22); }
.ph-new textarea { width: 100%; min-height: 72px; resize: none; border: 0; outline: 0; padding: 0; background: transparent; line-height: 1.45; color: var(--tx); }
.ph-new textarea::placeholder { color: var(--tx3); }
.ph-new-f { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ph-new-f .btn { height: 36px; border-radius: 18px; padding: 0 16px; font-size: 14px; }
.ph-seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: rgba(255, 255, 255, 0.06); min-width: 0; }
.ph-seg button { display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 10px; border-radius: 999px; font-size: 13px; color: var(--tx3); transition: background 0.2s var(--ease), color 0.2s var(--ease); }
.ph-seg button.on { background: var(--s3); color: var(--tx); }

.ph-films { list-style: none; margin: 20px -8px 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.ph-film { width: 100%; min-height: 68px; display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-radius: 14px; transition: background 0.15s; }
.ph-film:active { background: var(--s1); }
.ph-film-pic { flex: none; width: 76px; height: 48px; border-radius: 10px; overflow: hidden; display: grid; place-items: center; background: var(--s2); color: var(--tx3); border: 1px solid var(--ln); }
.ph-film-pic img { width: 100%; height: 100%; object-fit: cover; background: #F4F2EC; }
.ph-film-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ph-film-t b, .ph-film-t span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ph-film-t b { font-size: 15px; font-weight: 600; letter-spacing: -0.005em; }
.ph-film-t span { font-size: 13px; color: var(--tx3); }
.ph-dot { flex: none; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: var(--sky); box-shadow: 0 0 0 4px var(--skbg); }
.ph-empty { margin: 0; padding: 32px 16px; text-align: center; color: var(--tx3); font-size: 14px; line-height: 1.55; }
.ph-skel { height: 136px; margin: 20px 0 0; border-radius: 14px; background: linear-gradient(90deg, var(--s1) 0%, var(--s2) 50%, var(--s1) 100%); background-size: 200% 100%; animation: ph-shimmer 1.6s linear infinite; }
.ph-piece .ph-skel { margin: 16px; }
@keyframes ph-shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* ----- sheets: this phone's menu, and a shot moving ----- */
.ph-sheet-scrim { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; background: rgba(0, 0, 0, 0.6); animation: fade 0.2s var(--ease); }
.ph-sheet { width: 100%; display: flex; flex-direction: column; gap: 10px; padding: 22px 16px calc(16px + env(safe-area-inset-bottom)); border-radius: 22px 22px 0 0; border-top: 1px solid var(--ln2); background: var(--s1); animation: ph-up 0.35s var(--ease); }
.ph-sheet > b { font-size: 16px; font-weight: 650; }
.ph-sheet > p { margin: 0 0 4px; line-height: 1.55; font-size: 14px; }
.ph-sheet .btn, .ph-motion .btn { height: 46px; border-radius: 23px; font-size: 15px; width: 100%; }
@keyframes ph-up { from { transform: translateY(100%); } to { transform: none; } }

/* ----- a project: header, the five tabs as chips, the piece looked at, and Toon's chat under the thumb ----- */
.ph-chips { flex: none; display: flex; gap: 6px; overflow-x: auto; padding: 10px 16px; scroll-padding-inline: 16px; scrollbar-width: none; border-bottom: 1px solid var(--ln); }
.ph-chips::-webkit-scrollbar { display: none; }
.ph-chip { flex: none; height: 34px; padding: 0 14px; border-radius: 17px; border: 1px solid var(--ln); background: transparent; color: var(--tx3); font-size: 14px; font-weight: 500; transition: background 0.2s var(--ease), color 0.2s var(--ease); }
.ph-chip.has { color: var(--tx); border-color: var(--ln2); }
.ph-chip.on { background: var(--ac); color: var(--onac); border-color: transparent; font-weight: 650; }

.ph-piece { flex: 0 0 36%; min-height: 0; overflow-y: auto; overscroll-behavior: contain; border-bottom: 1px solid var(--ln); transition: flex-basis 0.35s var(--ease); }
.ph-project.big-piece .ph-piece { flex-basis: 64%; }
.ph-chat { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; padding-bottom: env(safe-area-inset-bottom); }
/* On the Mac the chat floats beside the project at its own width; here it is the bottom of the page */
.ph-chat > .chat { position: relative; inset: auto; width: auto; z-index: auto; flex: 1; min-height: 0; border-left: 0; background: var(--app); transition: none; transform: none; opacity: 1; pointer-events: auto; }
.ph-chat .chat-h { height: 44px; padding: 0 4px 0 14px; }
.ph-chat .chat-h .ib { width: 40px; height: 40px; }
.ph-chat .chat-ls { padding: 12px 16px; gap: 14px; }
.ph-chat .cmp { margin: 0 8px 8px; }
/* The Mac's keyboard shortcut hints mean nothing here */
.ph-chat .kbd { display: none; }

/* the words: details and the script */
.ph-text { padding: 16px; font-size: 15px; line-height: 1.6; user-select: text; -webkit-user-select: text; }
.ph-text h2 { margin: 0 0 12px; font-size: 19px; font-weight: 700; letter-spacing: -0.015em; line-height: 1.3; }
.ph-text h3 { margin: 20px 0 8px; font-size: 13px; font-weight: 600; color: var(--tx2); }
.ph-text p { margin: 0 0 10px; }
.ph-scene + .ph-scene { margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--ln); }
.ph-see { display: block; margin-top: 3px; font-size: 13px; line-height: 1.45; color: var(--tx3); }

/* the pictures: the storyboard, the designs, the shots */
.ph-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 10px; padding: 14px 16px 18px; }
.ph-frame { margin: 0; display: flex; flex-direction: column; gap: 6px; min-width: 0; text-align: left; }
.ph-frame img, .ph-noimg { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; border-radius: 10px; border: 1px solid var(--ln); background: #F4F2EC; }
.ph-noimg { display: grid; place-items: center; color: var(--tx3); background: var(--s1); }
.ph-frame figcaption { font-size: 13px; line-height: 1.4; color: var(--tx2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ph-frame figcaption b { color: var(--tx); font-weight: 600; }
.ph-shot { padding: 0; color: inherit; }
/* A shot's picture is drawn at the project's own shape (wide, tall or square): shown as it is */
.ph-shot img { aspect-ratio: auto; height: auto; object-fit: fill; background: #000; }
.ph-shot:active img { transform: scale(0.98); }
.ph-shot img { transition: transform 0.15s var(--ease); }
.ph-shot-t { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--tx2); }
.ph-shot-t b { color: var(--tx); }

/* the video */
.ph-video { padding: 14px 0 18px; }
.ph-player { position: relative; margin: 0 16px; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: #000; border: 1px solid var(--ln); }
.ph-player video { display: block; width: 100%; height: 100%; object-fit: contain; }
.ph-player-wait { position: absolute; inset: 0; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 16px; text-align: center; font-size: 13px; line-height: 1.45; background: rgba(14, 14, 14, 0.9); }
.ph-make { display: flex; padding: 12px 16px 0; }
.ph-make .btn { width: 100%; height: 46px; border-radius: 23px; font-size: 15px; }
.ph-bar { position: relative; width: 100%; height: 46px; border-radius: 23px; overflow: hidden; background: var(--s1); border: 1px solid var(--ln); }
.ph-bar span { position: absolute; inset: 0 auto 0 0; background: var(--skbg); transition: width 0.5s var(--ease); }
.ph-bar em { position: relative; height: 100%; display: flex; align-items: center; justify-content: center; font-style: normal; font-size: 14px; color: var(--sky); }
.ph-sub { margin: 22px 16px 0; font-size: 13px; font-weight: 600; color: var(--tx2); }
.ph-motion { margin: auto 16px; width: 100%; max-width: 480px; display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: 20px; background: var(--s1); border: 1px solid var(--ln2); animation: fade 0.25s var(--ease); }
.ph-motion img { width: 100%; border-radius: 12px; background: #000; }
.ph-motion .ph-player-wait { position: static; min-height: 200px; background: none; }
.ph-motion p { margin: 0; font-size: 13px; text-align: center; }

.ph-toast { bottom: calc(112px + env(safe-area-inset-bottom)); width: max-content; max-width: calc(100% - 32px); font-size: 14px; }

@media (prefers-reduced-motion: reduce) {
  .ph-piece, .ph-sheet, .ph-motion, .ph-skel, .ph-bar span { transition: none; animation: none; }
}
