/*
 * Profile, Edit profile and the look pickers (look-), study packs (pack-), word banks (bank-)
 * and the Pro paywall (pro-).
 */

/* Profile tab: one column on a phone; the card with the avatar beside the rows on a desktop. */
.profile { padding-top: calc(var(--safe-top) + 8px); padding-left: 20px; padding-right: 20px; }
.profile-split { width: 100%; display: flex; flex-direction: column; gap: 14px; }
.profile-side { display: flex; flex-direction: column; min-width: 0; }
.profile-rows { gap: 14px; align-items: stretch; }
.profile-row { width: 100%; gap: 14px; padding: 16px; border-radius: 24px; }
.profile-pro {
  background: linear-gradient(135deg, #FFE6A3, #FFF6DC);
  border: 1.5px solid rgba(255, 200, 61, 0.8);
  box-shadow: 0 8px 20px rgba(217, 161, 26, 0.28);
}
.profile-pencil { position: absolute; right: 0; bottom: 0; box-shadow: 0 2px 8px rgba(30, 27, 75, 0.18); }
.profile-sign-out { align-self: center; padding: 12px 24px; }
.profile-over-app { position: absolute; inset: 0; z-index: 44; }

/* The look: the avatar on its border, animating each change (art/AnimatedLook.kt). */
.look { position: relative; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.look-layer { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.look-face { transition: width 0.5s cubic-bezier(.3, 1.4, .5, 1), height 0.5s cubic-bezier(.3, 1.4, .5, 1); }
.look-burst { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); pointer-events: none; }
.look-ring-in { animation: lookRingIn 0.62s ease-out both; }
.look-ring-out { animation: lookRingOut 0.17s ease-in both; }
.look-face-in { animation: lookFaceIn 0.7s ease-out both; }
.look-face-out { animation: lookFaceOut 0.18s ease-in both; }
.look-pop { animation: lookPop 0.5s ease-out both; }
@keyframes lookRingIn {
  0% { opacity: 0; transform: scale(0.55) rotate(-55deg); }
  12% { opacity: 0; }
  40% { opacity: 1; transform: scale(1.08) rotate(6deg); }
  62% { transform: scale(0.97) rotate(-2deg); }
  80% { transform: scale(1.01) rotate(0.5deg); }
  100% { opacity: 1; transform: none; }
}
@keyframes lookRingOut {
  65% { opacity: 0; }
  100% { opacity: 0; transform: scale(1.18) rotate(35deg); }
}
@keyframes lookFaceIn {
  0% { opacity: 0; transform: scale(0.3) rotate(-20deg); }
  25% { opacity: 1; }
  45% { transform: scale(1.12) rotate(9deg); }
  65% { transform: scale(0.96) rotate(-5deg); }
  82% { transform: scale(1.02) rotate(2deg); }
  100% { opacity: 1; transform: none; }
}
@keyframes lookFaceOut {
  80% { opacity: 0; }
  100% { opacity: 0; transform: scale(0.4) rotate(14deg); }
}
@keyframes lookPop {
  0% { transform: scale(0.82); }
  40% { transform: scale(1.06); }
  70% { transform: scale(0.98); }
  100% { transform: none; }
}

/* Classic | Pro | Border, the picked one on a pill that slides. */
.look-tabs {
  position: relative;
  display: flex;
  height: 50px;
  padding: 4px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
}
.look-tab-pill {
  position: absolute;
  top: 4px;
  bottom: 4px;
  border-radius: 999px;
  transition: left 0.35s cubic-bezier(.3, 1.25, .5, 1), background 0.2s;
}
.look-tab {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border-radius: 999px;
  cursor: pointer;
  user-select: none;
}

/* Grids of square choices: avatars and borders. */
.look-grid { display: grid; grid-template-columns: repeat(var(--cols, 6), minmax(0, 1fr)); gap: 10px; }
.look-grid.borders { row-gap: 12px; }
.look-shaker { border-radius: 18px; cursor: pointer; user-select: none; }
.look-cell {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 18px;
  border: 2.5px solid transparent;
  transition: transform 0.35s cubic-bezier(.3, 1.8, .5, 1), background 0.2s, border-color 0.2s;
}
.look-cell.picked { transform: scale(1.06); }
.look-cell.border-cell { cursor: pointer; user-select: none; border-width: 2px; }
.look-cell-art { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.look-cell-art .pic { max-width: none; }
.look-plain {
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(109, 74, 255, 0.16);
  border: 2px solid rgba(109, 74, 255, 0.35);
}
.look-lock {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(30, 27, 75, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Edit profile: the look pinned on top, tabs, a scrolling grid and Save pinned at the bottom. */
.look-editor { display: flex; flex-direction: column; padding-top: calc(var(--safe-top) + 8px); }
.look-body { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.look-side { display: contents; }
.look-hero-area { order: 0; padding: 0 16px; }
.look-hero {
  padding: 14px 16px 12px;
  border-radius: 28px;
  background: linear-gradient(135deg, #ECE6FF, #FFF0D6);
  box-shadow: 0 8px 24px rgba(109, 74, 255, 0.2);
}
.look-name {
  width: 100%;
  max-width: 360px;
  padding: 8px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.7);
  border: 2px solid transparent;
  transition: background 0.15s, border-color 0.15s;
}
.look-name:focus-within { background: #fff; border-color: var(--primary); }
.look-name input {
  min-width: 0;
  padding: 0 8px;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  text-align: center;
}
.look-name input::placeholder { color: rgba(107, 106, 138, 0.5); }
.look-tabs-area { order: 1; padding: 14px 16px 4px; }
.look-pane { order: 2; position: relative; flex: 1 1 0; min-height: 0; }
.look-scroll {
  position: absolute;
  inset: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px 16px 20px;
}
.look-from-right { animation: lookFromRight 0.32s cubic-bezier(.2, .9, .3, 1) both; }
.look-from-left { animation: lookFromLeft 0.32s cubic-bezier(.2, .9, .3, 1) both; }
@keyframes lookFromRight { from { transform: translateX(20%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes lookFromLeft { from { transform: translateX(-20%); opacity: 0; } to { transform: none; opacity: 1; } }
.look-fade {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 12px;
  background: linear-gradient(var(--bg), rgba(245, 243, 255, 0));
  pointer-events: none;
}
.look-save {
  order: 3;
  background: #fff;
  border-radius: 26px 26px 0 0;
  box-shadow: 0 -6px 16px rgba(30, 27, 75, 0.1);
  padding: 14px 20px calc(var(--safe-bottom) + 12px);
}

/* Study packs */
.pack-list { display: flex; flex-direction: column; gap: 12px; }
.pack-row {
  padding: 14px;
  border-radius: 22px;
  background: #fff;
  border: 2px solid transparent;
  box-shadow: 0 3px 10px rgba(109, 74, 255, 0.12);
}
.pack-row.picked { background: var(--primary-tint); border-color: var(--primary); box-shadow: 0 8px 20px rgba(109, 74, 255, 0.2); }
.pack-check {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--line);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.pack-check.picked { background: var(--primary); border-color: var(--primary); }
.pack-check-mark { transform: scale(0); transition: transform 0.35s cubic-bezier(.3, 1.8, .5, 1); }
.pack-check.picked .pack-check-mark { transform: scale(1); }
.pack-detail { display: flex; flex-direction: column; gap: 10px; }
.pack-words, .pack-levels { display: flex; flex-direction: column; gap: 10px; }

/* Word banks: a list over a pinned button. */
.bank-screen { display: flex; flex-direction: column; padding-top: calc(var(--safe-top) + 8px); }
.bank-scroll { flex: 1 1 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.bank-list { display: flex; flex-direction: column; gap: 12px; padding-top: 12px; padding-bottom: 12px; }
.bank-words { display: flex; flex-direction: column; gap: 10px; }
.bank-bottom { padding-top: 12px; padding-bottom: calc(var(--safe-bottom) + 12px); }
.bank-over-sheet { position: absolute; inset: 0; z-index: 43; }
.bank-pictures {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
  gap: 6px;
  max-height: min(460px, 60vh);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.bank-no-picture { grid-column: 1 / -1; justify-self: start; padding: 10px 14px; border-radius: 14px; }
.bank-picture { aspect-ratio: 1; border-radius: 14px; }

/* Pro: the gold Get Pro pill, and the paywall (full screen on a phone, a dialog on a desktop). */
.pro-get { padding: 6px 13px 6px 8px; border-radius: 999px; background: var(--gold); }
.pro-wall { position: absolute; inset: 0; z-index: 45; }
.pro-scrim { display: none; }
.pro-panel {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: var(--bg);
  outline: none;
  animation: proUp 0.38s cubic-bezier(.2, .9, .3, 1) both;
}
@keyframes proUp { from { transform: translateY(8%); opacity: 0; } to { transform: none; opacity: 1; } }
.pro-glow {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 380px;
  background: linear-gradient(to bottom, #FFE9B0, #F1EBFF, var(--bg));
}
.pro-scroll { position: absolute; inset: 0; overflow-y: auto; overscroll-behavior: contain; }
.pro-col {
  position: relative;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: calc(var(--safe-top) + 8px) 20px calc(var(--safe-bottom) + 20px);
}
.pro-close { position: absolute; top: calc(var(--safe-top) + 8px); right: 16px; }
.pro-crown { position: absolute; top: 0; right: 0; animation: proBob 1.4s ease-in-out infinite alternate; }
@keyframes proBob { from { transform: translateY(-4px); } to { transform: translateY(4px); } }
.pro-app-icon { width: 52px; height: 52px; flex-shrink: 0; border-radius: 14px; box-shadow: 0 3px 10px rgba(30, 27, 75, 0.15); }
.pro-plan { width: 100%; padding: 14px 16px; border-radius: 22px; border: 1.5px solid var(--line); }
.pro-plan.picked { background: #FFF6DC; border: 2.5px solid var(--gold); }
.pro-badge {
  position: absolute;
  top: 0;
  right: 18px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--gold);
}
.pro-plan-ghost { width: 100%; height: 78px; border-radius: 22px; background: #fff; animation: proBreathe 0.7s ease-in-out infinite alternate; }
@keyframes proBreathe { from { opacity: 0.45; } to { opacity: 1; } }
.pro-link {
  padding: 8px 6px;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 16px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.pro-welcome { position: absolute; inset: 0; z-index: 2; background: rgba(245, 243, 255, 0.94); animation: fadeIn 0.22s ease both; }
.pro-welcome-card { width: calc(100% - 56px); max-width: 420px; animation: popIn 0.45s cubic-bezier(.3, 1.6, .5, 1) both; }

@media (hover: hover) {
  .profile-row.tappable:hover, .pack-row:hover { box-shadow: 0 8px 22px rgba(109, 74, 255, 0.16); }
  .look-cell:hover { border-color: rgba(109, 74, 255, 0.25); }
  .look-tab:hover { background: rgba(109, 74, 255, 0.05); }
  .pro-link:hover { color: var(--ink); text-decoration: underline; }
  .bank-picture:hover { filter: brightness(0.97); }
}

@media (min-width: 900px) {
  .profile { padding-top: 16px; padding-left: 28px; padding-right: 28px; }
  .profile-split { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 28px; align-items: start; }
  .profile-side { position: sticky; top: 16px; }
  /* Under the right column, below Sign out (the left column is 380px plus the 28px gap). */
  .profile-delete { margin-left: 408px; }

  /* Edit profile: the look and Save on the left, the tabs and grid on the right. */
  .look-editor { padding-top: 16px; }
  .look-body {
    display: grid;
    grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas: "side tabs" "side pane";
    column-gap: 28px;
    padding-bottom: 24px;
  }
  .look-side { grid-area: side; align-self: start; display: flex; flex-direction: column; gap: 16px; }
  .look-hero-area { padding: 0; }
  .look-tabs-area { grid-area: tabs; padding: 0 0 4px; }
  .look-pane { grid-area: pane; }
  .look-scroll { padding: 12px 4px 20px; }
  .look-scroll .look-grid { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); }
  .look-scroll .look-grid.borders { grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); }
  .look-save { border-radius: 24px; box-shadow: var(--card-shadow); padding: 14px 18px 12px; }

  /* Packs and banks: grids of cards. */
  .pack-list, .bank-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
  .pack-use-topics { max-width: 360px; }
  .pack-detail { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 28px; align-items: start; }
  .pack-detail-side { position: sticky; top: 16px; }
  .pack-words { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
  .pack-levels { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
  .bank-words { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
  .bank-bottom-button { max-width: 360px; margin-left: auto; }

  /* The paywall as a dialog over the dimmed app. */
  .pro-scrim { display: block; position: absolute; inset: 0; background: rgba(30, 27, 75, 0.45); animation: fadeIn 0.2s ease both; }
  .pro-panel {
    left: 50%;
    top: 50%;
    right: auto;
    bottom: auto;
    width: min(560px, calc(100% - 48px));
    max-height: calc(100% - 48px);
    display: flex;
    flex-direction: column;
    border-radius: 28px;
    box-shadow: 0 24px 60px rgba(30, 27, 75, 0.3);
    transform: translate(-50%, -50%);
    animation: dialogIn 0.26s cubic-bezier(.2, .9, .3, 1.1) both;
  }
  /* Sized by its content (up to the window), scrolling inside. */
  .pro-scroll { position: relative; inset: auto; flex: 1 1 auto; min-height: 0; }
  .pro-col { padding: 8px 28px 24px; }
  .pro-close { top: 14px; right: 14px; }
}
