/* Phone screens. Designed at 390 x 844; works down to 360 wide. */
html, body { height: 100%; }
body { overflow-x: hidden; }

.phone { min-height: 100vh; min-height: 100dvh; max-width: 480px; margin: 0 auto; }
.screen { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background-color: var(--aubergine); }
.screen__body { flex: 1; display: flex; flex-direction: column; gap: 16px; padding: 26px 24px calc(24px + env(safe-area-inset-bottom)); }
.screen__body--centre { align-items: center; text-align: center; gap: 18px; padding-top: 48px; }
.screen__body--tall { padding-top: 64px; gap: 20px; padding-left: 28px; padding-right: 28px; }
.screen__body--welcome { padding-top: 48px; padding-left: 28px; padding-right: 28px; }
.screen__body--bid { padding: 22px 24px calc(26px + env(safe-area-inset-bottom)); }
.screen__body--result { gap: 18px; padding: 26px 24px calc(28px + env(safe-area-inset-bottom)); }
.spacer { flex: 1; }
.self-centre { align-self: center; }
.row { display: flex; align-items: center; gap: 12px; }
.row--between { justify-content: space-between; }

/* Masthead */
.masthead { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.masthead__presenter { font-size: 13px; padding: 6px 16px; }
.masthead__title { font-size: 34px; line-height: 1.1; text-align: center; white-space: nowrap; }
@media (max-width: 370px) { .masthead__title { font-size: 30px; } }

/* Join form */
.join { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field__row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.field__label { font-size: 15px; font-weight: 700; white-space: nowrap; }
.field__hint { font-size: 13px; color: var(--grey); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 370px) { .field__hint { font-size: 12px; } }
.input { width: 100%; border: 0; border-radius: var(--radius-card); background: var(--white); color: var(--aubergine); font-weight: 700; }
.input::placeholder { color: var(--grey-dark); }
.input:focus { outline: 3px solid var(--starfruit); outline-offset: 2px; }
.input--code { height: 60px; font-size: 34px; font-weight: 800; letter-spacing: 12px; text-align: center; text-transform: uppercase; padding-left: 12px; }
.input--nick { height: 52px; font-size: 20px; padding: 0 18px; }
.form-msg { font-size: 14px; color: var(--carrot); min-height: 1.3em; text-align: center; margin: -4px 0 0; }
.form-msg:empty { display: none; }

/* Avatar carousel */
/* Free scrolling on purpose: mandatory snap points stop a flick after one or two avatars on phones. */
.carousel { display: flex; gap: 12px; overflow-x: auto; overscroll-behavior-x: contain; touch-action: pan-x pan-y; padding: 6px 4px 8px; margin: 0 -4px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.carousel::-webkit-scrollbar { display: none; }
.carousel__item { flex: none; display: flex; flex-direction: column; align-items: center; gap: 6px; width: 76px; }
.carousel__btn { width: 76px; height: 76px; padding: 0; border: 0; border-radius: 50%; background: none; outline-offset: 3px; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.carousel__btn img { pointer-events: none; -webkit-user-drag: none; }
.carousel__btn img { width: 76px; height: 76px; }
.carousel__btn[aria-checked="true"] { outline: 4px solid var(--white); }
.carousel__btn:focus-visible { outline: 4px solid var(--starfruit); }
.carousel__btn:disabled { opacity: .3; cursor: default; }
.carousel__tag { font-size: 12px; font-weight: 700; color: var(--starfruit); }
.carousel__item--taken .carousel__tag { color: var(--grey); }

.status { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 14px; color: var(--grey); text-align: center; }

/* Lobby */
.hero-avatar { width: 120px; height: 120px; }
.hero-avatar--dim { opacity: .6; }
.badge--small { font-size: 13px; padding: 6px 14px; }
.headline { font-size: 32px; line-height: 1.15; font-weight: 800; text-align: center; }
.lede { font-size: 16px; line-height: 1.5; text-align: center; color: var(--grey-light); }
.screen__body--result > div[aria-live] { display: flex; flex-direction: column; gap: 18px; }
.lede--light { color: var(--grey-light); }
.panel--pad { padding: 18px 20px; width: 100%; }
.lobby-panel { display: flex; flex-direction: column; gap: 12px; text-align: left; }
.count { background: var(--persian); color: var(--aubergine); font-weight: 700; font-size: 14px; padding: 4px 12px; border-radius: var(--radius-pill); }
.avatar-row { display: flex; flex-wrap: wrap; gap: 8px; }
.avatar-row img { width: 40px; height: 40px; }
.avatar-row img.is-off { opacity: .35; }

/* Bid */
.time { font-size: 16px; font-weight: 800; }
.time--low { color: var(--carrot); }
.kicker { font-size: 14px; font-weight: 700; color: var(--starfruit); }
.item-title { margin-top: 4px; font-size: 22px; line-height: 1.2; font-weight: 800; }
.bid-card { background: var(--white); color: var(--aubergine); border-radius: var(--radius-card); padding: 12px 20px; text-align: center; box-shadow: 5px 5px 0 var(--persian); }
.bid-card__label { font-size: 13px; font-weight: 700; color: var(--slate); }
.bid-card__amount { font-size: 58px; line-height: 1.1; font-weight: 800; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bid-card__amount.is-long { font-size: 44px; }
.keypad { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.keypad button { height: 62px; border: 0; border-radius: var(--radius-card); background: var(--slate); color: var(--white); font-size: 26px; font-weight: 800; touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; transition: background .08s ease-out, color .08s ease-out, opacity var(--ease), transform .08s ease-out; }
.keypad button:active { background: var(--starfruit); color: var(--aubergine); transform: scale(.96); }
.keypad button:focus-visible { outline: 3px solid var(--starfruit); outline-offset: 2px; }
.keypad button:disabled { opacity: .35; cursor: default; transform: none; }
@media (hover: hover) and (pointer: fine) {
  .keypad button:hover { background: var(--persian); color: var(--aubergine); }
  .keypad button:disabled:hover { background: var(--slate); color: var(--white); }
}
.keypad .keypad__del { font-size: 20px; }
.hint { font-size: 13px; line-height: 1.5; text-align: center; color: var(--grey); margin-top: 10px; }
.locked-pill { white-space: normal; text-align: center; padding: 16px; }
.screen[data-screen="bid"] .btn--block { padding: 16px; }
@media (max-height: 700px) { .keypad button { height: 52px; } .bid-card__amount { font-size: 48px; } }

/* Result */
.price-tag--phone { align-self: center; width: 290px; max-width: 100%; transform: rotate(-3deg); padding: 20px 16px 16px; margin: 8px 0 12px; box-shadow: 6px 6px 0 var(--persian); }
.price-tag--phone.price-tag--flip { animation-name: tag-flip-phone; }
@keyframes tag-flip-phone {
  0% { transform: rotate(-3deg) perspective(700px) rotateY(95deg); opacity: 0; }
  60% { transform: rotate(-3deg) perspective(700px) rotateY(-14deg); opacity: 1; }
  100% { transform: rotate(-3deg) perspective(700px) rotateY(0); opacity: 1; }
}
.price-tag--phone::before { left: 12px; top: 12px; width: 14px; height: 14px; }
.price-tag__label { font-size: 14px; font-weight: 700; }
.price-tag__amount { font-size: 68px; line-height: 1.05; font-weight: 800; font-variant-numeric: tabular-nums; }
.price-tag__amount.is-long { font-size: 48px; }
.price-tag--winner { display: flex; flex-direction: column; align-items: center; gap: 8px; padding-bottom: 20px; }
.winner-avatar { width: 88px; height: 88px; outline: 4px solid var(--aubergine); outline-offset: 3px; margin-top: 6px; }
.price-tag__name { font-size: 30px; line-height: 1.1; font-weight: 800; word-break: break-word; }
.price-tag__sub { font-size: 15px; font-weight: 700; }
.breakdown { display: flex; flex-direction: column; gap: 12px; font-size: 16px; font-weight: 700; text-align: left; }
.breakdown__row { display: flex; justify-content: space-between; gap: 12px; }
.breakdown__row span:last-child { color: var(--starfruit); white-space: nowrap; }
.breakdown__row--muted { color: var(--grey); }
.breakdown__row--muted span:last-child { color: var(--carrot); }
.breakdown__row--zero span:last-child { color: var(--grey); }
.breakdown__rule { height: 2px; background: var(--slate); }
.breakdown__total { font-size: 20px; font-weight: 800; }
.breakdown__total span:last-child { color: var(--white); }
.stats { display: flex; gap: 12px; }
.stat { flex: 1; background: var(--slate); border-radius: var(--radius-card); padding: 14px; text-align: center; }
.stat__big { font-size: 30px; font-weight: 800; }
.stat__small { font-size: 13px; color: var(--grey); }
.podium-list { display: flex; flex-direction: column; gap: 10px; }
.podium-list__row { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 16px; }
.podium-list__row img { width: 36px; height: 36px; }
.podium-list__rank { width: 22px; color: var(--starfruit); font-weight: 800; }
.podium-list__name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium-list__row--me .podium-list__name::after { content: " (you)"; color: var(--grey); font-weight: 500; }

/* Reconnecting */
.dashed-ring { padding: 8px; border: 4px dashed var(--carrot); border-radius: 50%; }
.retry-card { width: 100%; background: var(--slate); border-radius: var(--radius-card); padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; font-size: 15px; font-weight: 700; text-align: left; }
.retry-card__eta { color: var(--starfruit); }
.progress--small { height: 10px; background: var(--aubergine); }
.progress__indeterminate { width: 40%; height: 100%; border-radius: var(--radius-pill); background: var(--starfruit); animation: slide 1.4s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(250%); } }

/* Welcome back */
.live-card { width: 100%; background: var(--slate); border-radius: var(--radius-card); padding: 14px 18px; display: flex; justify-content: space-between; align-items: center; gap: 12px; font-weight: 700; text-align: left; }
.live-card__kicker { font-size: 13px; color: var(--starfruit); }
.live-card__title { font-size: 18px; }
.live-card__time { font-size: 26px; font-weight: 800; white-space: nowrap; }

/* Toast for brief messages */
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); max-width: min(90vw, 420px); background: var(--white); color: var(--aubergine); font-weight: 700; font-size: 15px; padding: 12px 20px; border-radius: var(--radius-pill); box-shadow: 4px 4px 0 var(--persian); z-index: 10; text-align: center; }

/* Paused */
.is-paused .time { color: var(--carrot); }
