/* ------------------------------------------------------------ phone (press P) */
#phone-chip {
  position: fixed;
  top: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  background: var(--paper);
  border: 3px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow);
  font: 800 16px var(--body);
  color: var(--ink);
  cursor: pointer;
}

#phone-chip .badge {
  display: none;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 12px;
  line-height: 18px;
  text-align: center;
  border: 2px solid var(--line);
}

#phone-chip .badge.show {
  display: inline-block;
}

#flash {
  position: fixed;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  z-index: 46;
}

#flash.go {
  animation: flash 0.45s ease-out;
}

@keyframes flash {
  from {
    opacity: 0.9;
  }
}

#phone-root {
  --skin: #f6c59b;
  position: fixed;
  right: max(16px, 6vw);
  bottom: 0;
  width: 330px;
  height: min(660px, calc(100vh - 36px));
  z-index: 44;
  pointer-events: none;
  transform: translateY(115%) rotate(6deg);
  transform-origin: 50% 100%;
  transition: transform 0.38s cubic-bezier(0.2, 1.25, 0.4, 1);
}

#phone-root.open {
  pointer-events: auto;
  transform: translateY(14px) rotate(-2.5deg);
}

.phone {
  position: absolute;
  inset: 0;
  padding: 11px;
  background: #2b2d3a;
  border: 4px solid var(--line);
  border-radius: 48px;
  box-shadow: 8px 8px 0 var(--line);
  z-index: 1;
}

.phone::before {
  /* side button */
  content: "";
  position: absolute;
  right: -9px;
  top: 120px;
  width: 6px;
  height: 64px;
  border-radius: 4px;
  background: #2b2d3a;
  border: 3px solid var(--line);
}

.phone-notch {
  position: absolute;
  top: 11px;
  left: 50%;
  width: 104px;
  height: 24px;
  transform: translateX(-50%);
  background: #2b2d3a;
  border-radius: 0 0 16px 16px;
  z-index: 3;
}

.phone-glass {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  border-radius: 38px;
  background: linear-gradient(170deg, #e7f5ff 0%, #fff9db 55%, #fff0f6 100%);
}

.phone-status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 34px;
  padding: 4px 22px 0;
  font: 800 12px var(--body);
  flex: none;
}

.phone-carrier {
  visibility: hidden; /* would sit under the notch */
}

.phone-screen {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 2px 14px 6px;
  font-size: 13px;
  scrollbar-width: thin;
}

.phone-homebar {
  flex: none;
  display: grid;
  place-items: center;
  height: 22px;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.phone-homebar span {
  width: 110px;
  height: 5px;
  border-radius: 99px;
  background: var(--ink);
}

/* the cartoon hand holding it */
.hand-palm {
  position: absolute;
  left: -30px;
  right: -40px;
  bottom: -170px;
  height: 300px;
  background: var(--skin);
  border: 4px solid var(--line);
  border-radius: 48% 48% 40% 40%;
  z-index: 0;
}

.finger,
.thumb {
  position: absolute;
  background: var(--skin);
  border: 4px solid var(--line);
  z-index: 2;
}

.finger {
  left: -30px;
  width: 52px;
  height: 36px;
  border-radius: 20px;
  transform: rotate(-8deg);
}

.finger.f1 {
  bottom: 230px;
}

.finger.f2 {
  bottom: 186px;
}

.finger.f3 {
  bottom: 142px;
  width: 46px;
}

.thumb {
  right: -26px;
  bottom: 70px;
  width: 50px;
  height: 128px;
  border-radius: 26px;
  transform: rotate(-24deg);
}

/* home screen */
.ph-hello {
  font: 700 22px var(--display);
  margin: 6px 2px 10px;
}

.ph-widget {
  padding: 10px 12px;
  background: #fff;
  border: 3px solid var(--line);
  border-radius: 18px;
  box-shadow: 3px 3px 0 var(--line);
}

.ph-where {
  font: 700 15px var(--display);
}

.ph-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 12px;
}

.ph-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px 6px;
  margin: 18px 0 12px;
}

.ph-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  font: 800 12px var(--body);
  color: var(--ink);
}

.ph-tile {
  position: relative;
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  font-size: 28px;
  border: 3px solid var(--line);
  border-radius: 18px;
  box-shadow: 3px 3px 0 var(--line);
  transition: transform 0.1s ease;
}

.ph-icon:hover .ph-tile {
  transform: translateY(-2px) rotate(-3deg);
}

.ph-icon:active .ph-tile {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--line);
}

.ph-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  border-radius: 99px;
  background: var(--red);
  border: 2px solid var(--line);
  color: #fff;
  font: 800 11px/18px var(--body);
}

.ph-tip {
  text-align: center;
  color: var(--ink-soft);
  font-size: 11px;
  margin-top: 6px;
}

/* app screens */
.ph-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0 8px;
  background: linear-gradient(#eaf6fc 80%, rgba(234, 246, 252, 0));
}

.ph-head h3 {
  margin: 0;
  font: 700 19px var(--display);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ph-back {
  flex: none;
  width: 32px;
  height: 32px;
  border: 3px solid var(--line);
  border-radius: 11px;
  background: #fff;
  font: 800 20px/1 var(--body);
  cursor: pointer;
  box-shadow: 2px 2px 0 var(--line);
}

.ph-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ph-empty {
  margin: 18px 6px;
  text-align: center;
  color: var(--ink-soft);
}

.ph-select,
.ph-search {
  padding: 7px 10px;
  border-width: 2px;
  border-radius: 12px;
  font-size: 13px;
}

.ph-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 12px;
}

.spinner.small {
  width: 16px;
  height: 16px;
  border-width: 3px;
}

.ph-cols {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
}

.ph-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 5px 2px;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  font: 800 10px var(--body);
  color: var(--ink);
}

.ph-col b {
  font: 700 16px var(--display);
  color: var(--c);
}

.ph-col small {
  font-size: 9px;
  line-height: 1.1;
  text-align: center;
}

.ph-col.on {
  background: var(--c);
  color: #fff;
}

.ph-col.on b {
  color: #fff;
}

.ph-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ph-card {
  padding: 9px 10px;
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 14px;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.2);
}

.ph-card-top {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ph-card-top > :last-child {
  margin-left: auto;
}

.ph-card-title {
  margin: 4px 0;
  font-size: 13px;
}

.ph-clip {
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.ph-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.ph-summary {
  font-weight: 800;
}

.ph-floor,
.ph-person-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  text-align: left;
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 14px;
  box-shadow: 2px 2px 0 var(--line);
  font: 700 13px var(--body);
  color: var(--ink);
  cursor: pointer;
}

.ph-floor:hover:not(:disabled),
.ph-person-row:hover {
  background: #fff9db;
}

.ph-floor.here {
  background: #fff3bf;
  cursor: default;
}

.ph-floor .floor-num {
  width: 38px;
  height: 38px;
  font-size: 13px;
  grid-row: auto;
  flex: none;
}

.ph-floor-text,
.ph-person-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.ph-floor-text strong,
.ph-person-text strong,
.ph-person-text small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ph-floor-text small,
.ph-person-text small {
  color: var(--ink-soft);
  font-size: 11px;
}

.ph-floor-chips {
  display: flex;
  gap: 3px;
}

.floor-num.tiny {
  display: inline-grid;
  place-items: center;
  width: auto;
  min-width: 28px;
  height: 22px;
  padding: 0 4px;
  border-radius: 8px;
  border-width: 2px;
  font-size: 11px;
}

.ph-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 3px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.ph-tab {
  padding: 6px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  font: 800 12px var(--body);
  color: var(--ink);
  cursor: pointer;
}

.ph-tab.on {
  background: var(--yellow);
}

.ph-tab:disabled {
  opacity: 0.4;
  cursor: default;
}

.ph-person {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-align: center;
}

.ph-person h3 {
  margin: 6px 0 0;
  font: 700 20px var(--display);
}

.ph-event {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 14px;
}

.ph-event > div {
  flex: 1;
  min-width: 0;
}

.ph-event.you {
  background: #e7f5ff;
}

.ph-event-icon {
  font-size: 18px;
}

.ph-camera {
  display: grid;
  place-items: center;
  height: 120px;
  border: 3px dashed var(--ink-soft);
  border-radius: 18px;
  background: repeating-linear-gradient(45deg, rgba(0, 0, 0, 0.03) 0 10px, transparent 10px 20px);
}

.ph-shutter {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  border: 5px solid var(--line);
  background: radial-gradient(circle, #fff 55%, #ced4da 56%);
  box-shadow: 3px 3px 0 var(--line);
  cursor: pointer;
}

.ph-shutter:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--line);
}

.ph-photos {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.ph-thumb {
  padding: 0;
  border: 2px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 4 / 3;
}

.ph-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ph-photo {
  display: block;
  width: 100%;
  border: 3px solid var(--line);
  border-radius: 14px;
}

.ph-setting {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 14px;
  font-weight: 800;
}

.ph-setting.row {
  flex-direction: row;
}

.ph-setting span b {
  float: right;
  color: var(--blue);
}

.ph-setting input[type="range"] {
  padding: 0;
  border: 0;
  accent-color: var(--blue);
}

.ph-about {
  padding: 10px 12px;
  color: var(--ink-soft);
  font-size: 12px;
  text-align: center;
}

@media (max-width: 520px) {
  #phone-root {
    right: calc(50% - 165px);
  }
}

@media (prefers-reduced-motion: reduce) {
  #phone-root {
    transition: none;
  }
}
