/* Macaron "jelly" look shared with the Android app: pastel gradient with faint pets, bold near-black text. */
:root {
  --ink: #1c1824;
  --ink-soft: #5a5464;
  --mint: #96e4be;
  --strawberry: #ff9aaa;
  --sky: #96d2f5;
  --peach: #ffc496;
  --lavender: #cdb6f6;
  --lemon: #ffea8c;
  --cloud: #e4e2ec;
}

* { box-sizing: border-box; }

html, body { margin: 0; height: 100%; }

body {
  font-family: "Microsoft JhengHei", "PingFang TC", "Noto Sans TC", sans-serif;
  font-weight: 700;
  color: var(--ink);
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='150'%3E%3Cg font-size='30' opacity='.22'%3E%3Ctext x='10' y='40' transform='rotate(-14 25 30)'%3E🐶%3C/text%3E%3Ctext x='100' y='45' transform='rotate(12 115 35)'%3E🐱%3C/text%3E%3Ctext x='55' y='115' transform='rotate(-10 70 105)'%3E🐾%3C/text%3E%3Ctext x='140' y='125' transform='rotate(14 155 115)'%3E🐰%3C/text%3E%3C/g%3E%3C/svg%3E"),
    linear-gradient(#ffe4ec, #eee2ff 55%, #def0ff);
  background-attachment: fixed;
  display: flex;
  flex-direction: column;
}

header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top));
  font-size: 22px;
}
header #me { flex: 1; }
.conn { font-size: 14px; color: var(--ink-soft); }
.conn.on { color: #14824a; }

main { flex: 1; display: flex; gap: 16px; padding: 0 16px 16px; min-height: 0; }

button { font: inherit; color: inherit; cursor: pointer; }
button.icon { background: none; border: 0; font-size: 26px; }

/* jelly buttons: glossy top, darker edge that sinks when pressed */
.jelly {
  --c: var(--cloud);
  border: 2px solid color-mix(in srgb, var(--c), white 60%);
  border-radius: 22px;
  padding: 14px 18px;
  font-size: 20px;
  background: linear-gradient(color-mix(in srgb, var(--c), white 45%), var(--c));
  box-shadow: 0 5px 0 color-mix(in srgb, var(--c), black 20%);
  transition: transform .05s, box-shadow .05s;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.jelly:active, .jelly.held { transform: translateY(4px); box-shadow: 0 1px 0 color-mix(in srgb, var(--c), black 20%); }
.jelly.wide { width: 100%; }
.jelly.round { width: 110px; height: 110px; border-radius: 50%; font-size: 22px; padding: 0; }
.mint { --c: var(--mint); } .strawberry { --c: var(--strawberry); } .sky { --c: var(--sky); }
.peach { --c: var(--peach); } .lavender { --c: var(--lavender); } .lemon { --c: var(--lemon); } .cloud { --c: var(--cloud); }

/* family list */
#family { width: 300px; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; padding: 4px 4px 12px; }
#family .jelly { text-align: left; display: flex; align-items: center; gap: 10px; }
#family .jelly.selected { outline: 4px solid var(--ink); outline-offset: 2px; }
#family .member { position: relative; padding-right: 46px; }
#family .member .del { position: absolute; right: 10px; top: 50%; transform: translateY(-60%); font-size: 18px; opacity: 0; transition: opacity .15s; padding: 4px; border-radius: 10px; }
#family .member:hover .del { opacity: .7; }
#family .member .del:hover { opacity: 1; background: rgba(255,255,255,.7); }
#family .member.dragging { opacity: .4; }
#family .member.dropTarget { outline: 3px dashed var(--ink); outline-offset: 2px; }
.badge { margin-left: auto; background: #e8334f; color: white; border-radius: 12px; padding: 2px 9px; font-size: 15px; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: #b9b6c4; flex: none; }
.dot.on { background: #20c06a; }

/* contact page */
#contact { flex: 1; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
#contact .title { font-size: 26px; text-align: center; }
#contact .status { min-height: 22px; text-align: center; color: #aa3c14; }
.actions { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.actions .jelly { min-height: 86px; }
.pttVolume { display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,.55); border-radius: 16px; padding: 8px 14px; font-size: 16px; }
.pttVolume input { flex: 1; }
.compose { display: flex; gap: 10px; }
.compose input { flex: 1; font: inherit; font-size: 17px; padding: 12px 14px; border-radius: 16px; border: 2px solid var(--lavender); background: white; color: var(--ink); }
.messages { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 4px; }
.bubble { max-width: 80%; border-radius: 16px; padding: 10px 14px; font-size: 17px; background: color-mix(in srgb, var(--sky), white 35%); align-self: flex-start; word-break: break-word; }
.bubble.mine { background: color-mix(in srgb, var(--mint), white 35%); align-self: flex-end; }
.bubble .meta { font-size: 13px; color: var(--ink-soft); margin-top: 4px; }
.bubble a { color: #1450c8; }
.bubble.voice { cursor: pointer; }
.bubble.media { padding: 6px; }
.bubble.media img { display: block; max-width: min(360px, 100%); max-height: 320px; min-height: 60px; border-radius: 12px; cursor: zoom-in; background: rgba(0,0,0,.06); }
.viewer { position: fixed; inset: 0; background: rgba(0,0,0,.92); z-index: 30; display: flex; align-items: center; justify-content: center; }
.viewer img, .viewer video { max-width: 96vw; max-height: 94vh; border-radius: 8px; }
.viewer { overflow: hidden; touch-action: none; }
.viewer img { cursor: zoom-in; user-select: none; }
.viewerHint { position: absolute; bottom: 16px; left: 0; right: 0; text-align: center; color: rgba(255,255,255,.65); font-size: 13px; pointer-events: none; }
.viewerClose { position: absolute; top: 14px; right: 18px; background: rgba(255,255,255,.18); color: #fff; border: 0; border-radius: 50%; width: 44px; height: 44px; font-size: 22px; }
.compose #attachBtn { padding: 10px 14px; }
.empty { text-align: center; color: var(--ink-soft); margin-top: 40px; }

/* join / name screens */
.center { margin: auto; width: min(420px, 100%); display: flex; flex-direction: column; gap: 12px; text-align: center; }
.code { font-size: 44px; letter-spacing: 10px; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.keypad .jelly { font-size: 28px; }
.nameInput { font: inherit; font-size: 22px; padding: 12px; border-radius: 16px; border: 2px solid var(--lavender); text-align: center; }
.roles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

/* overlays */
.layer { position: fixed; inset: 0; background: rgba(40, 30, 60, .35); display: flex; align-items: center; justify-content: center; z-index: 10; }
.hidden { display: none !important; }
.callCard, .sheet { background: linear-gradient(#fff4f8, #f3ecff); border-radius: 28px; padding: 28px; box-shadow: 0 12px 40px rgba(0,0,0,.2); }
.callCard { width: min(420px, 92vw); text-align: center; }
.avatar.big { font-size: 72px; }
.callName { font-size: 30px; margin-top: 6px; }
.callStatus { font-size: 18px; color: var(--ink-soft); margin: 8px 0 22px; }
.callButtons { display: flex; justify-content: center; gap: 24px; }
.sheet { width: min(460px, 94vw); display: flex; flex-direction: column; gap: 14px; }
.sheet h2 { margin: 0; }
.sheet label { display: flex; flex-direction: column; gap: 6px; font-size: 17px; }
.sheet label span { float: right; color: var(--ink-soft); }
.sheet label.check { flex-direction: row; align-items: center; gap: 8px; }
.sheet .row { display: flex; gap: 10px; }
.sheet .row .jelly { flex: 1; font-size: 17px; }
.hint { color: var(--ink-soft); font-size: 14px; margin: 0; }
input[type=range] { accent-color: #9b6be0; width: 100%; }
.sheet select { font: inherit; font-size: 15px; padding: 8px; border-radius: 12px; border: 2px solid var(--lavender); background: white; color: var(--ink); }
.meter { height: 12px; border-radius: 6px; background: rgba(0,0,0,.08); overflow: hidden; margin-top: -6px; }
.meter div { height: 100%; width: 0; background: linear-gradient(90deg, #20c06a, #ffd23c 75%, #ff5a5a); transition: width .05s; }
.sheet { max-height: 92vh; overflow-y: auto; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: white; padding: 10px 18px; border-radius: 14px; z-index: 20; }

/* phones (iPhone home-screen app, Android browser): the Android app's layout */
@media (max-width: 720px) {
  main { flex-direction: column; padding: 0 10px 0; }
  #family { width: 100%; }
  main.inContact #family { display: none; }
  main:not(.inContact) #contact { display: none; }
  .actions { grid-template-columns: 1fr; }
  header { padding: 8px 14px; padding-top: max(8px, env(safe-area-inset-top)); font-size: 20px; }
}
.banner { display: block; width: calc(100% - 8px); margin: 4px 4px 10px; font-size: 15px; line-height: 1.5; }
div.banner { background: rgba(255,255,255,.75); border: 2px dashed var(--lavender); border-radius: 18px; padding: 12px 14px; }
.jelly.small { font-size: 15px; padding: 8px 14px; border-radius: 16px; }
.jelly.round.small { width: 48px; height: 48px; font-size: 20px; flex: none; }

/* home: wide 全家廣播 tile + two columns of square family tiles */
main.phone #family { gap: 0; overflow-y: auto; }
.tilesHead { display: flex; justify-content: flex-end; margin: 2px 4px 6px; }
.wideTile { display: flex; align-items: center; gap: 14px; text-align: left; margin: 0 4px 10px; font-size: 20px; }
.wideTile .ico, .tileBtn .ico { font-size: 34px; }
.wideTile small { color: var(--ink-soft); font-size: 13px; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 0 4px 24px; }
.tile { position: relative; aspect-ratio: 1 / 0.92; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; cursor: pointer; padding: 10px 6px 16px; }
.tileAvatar { font-size: 48px; line-height: 1.1; }
.tileName { font-size: 19px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tileState { font-size: 12px; color: var(--ink-soft); }
.tile .badge { position: absolute; top: 8px; right: 8px; margin: 0; }
/* 方塊大小: 中 = three to a row, 小 = one row per person with the picture on the left */
.tiles.size1 { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.tiles.size1 .tileAvatar { font-size: 34px; }
.tiles.size1 .tileName { font-size: 15px; }
.tiles.size1 .tileState { font-size: 11px; }
.tiles.size2 { grid-template-columns: 1fr; gap: 8px; }
.tiles.size2 .tile { aspect-ratio: auto; flex-direction: row; justify-content: flex-start; gap: 12px; padding: 10px 40px 10px 14px; min-height: 56px; text-align: left; }
.tiles.size2 .tileAvatar { font-size: 30px; }
.tiles.size2 .tileName { font-size: 18px; }
.tileDel { position: absolute; top: 6px; left: 8px; font-size: 22px; }
.tileMove { display: flex; gap: 22px; font-size: 22px; margin-top: 4px; }
.tileMove .off { opacity: .2; pointer-events: none; }

/* contact page: three action tiles, chat, compose bar pinned to the bottom */
main.phone #contact { gap: 6px; height: 100%; }
.phoneHead { display: flex; align-items: center; gap: 10px; padding-top: 4px; }
.phoneHead .title { flex: 1; text-align: left !important; font-size: 24px; }
.actionTiles { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.tileBtn { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 104px; font-size: 15px; gap: 4px; padding: 10px 4px 14px; }
.messages.chat { flex: 1; min-height: 0; padding: 4px 2px 8px; }
.compose.bar { align-items: center; gap: 8px; padding: 8px 2px; padding-bottom: max(8px, env(safe-area-inset-bottom)); background: rgba(255,255,255,.55); border-radius: 18px 18px 0 0; margin: 0 -10px; padding-left: 8px; padding-right: 8px; }
.compose.bar input { min-width: 0; }
main.phone { height: calc(100dvh - 60px); }
