@font-face {
  font-family: 'ArkPixel';
  src: url('fonts/ark-pixel-12px-monospaced-zh_cn.ttf.woff2') format('woff2');
  font-display: swap;
}

:root {
  --background: #0f1020;
  --foreground: #eaeaea;
  --card: rgba(18, 8, 40, 0.82);
  --card-foreground: #eaeaea;
  --popover: rgba(15, 16, 32, 0.96);
  --popover-foreground: #eaeaea;
  --primary: #ff4da6;
  --primary-foreground: #fff6fb;
  --secondary: #2b3f6b;
  --secondary-foreground: #d8e7ff;
  --muted: #24304f;
  --muted-foreground: #a0a0a0;
  --accent: #61e8ff;
  --accent-foreground: #09141f;
  --destructive: #ff5d7a;
  --destructive-foreground: #fff6fb;
  --border: #ff4da6;
  --input: rgba(8, 12, 28, 0.9);
  --ring: #61e8ff;
  /* Use Ark Pixel for pure pixel style */
  --font-pixel: 'ArkPixel', 'DotGothic16', sans-serif;
  /* Hard shadow color */
  --shadow-color: rgba(0, 0, 0, 0.2);
}

/* Global Reset for Pixel Font */
* {
  font-family: var(--font-pixel) !important;
  box-sizing: border-box;
}

.hidden {
  display: none !important;
}

body {
  position: relative;
  margin: 0;
  padding: 0;
  background-color: #1a1a2e;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(255, 77, 166, 0.32), transparent 40%),
    radial-gradient(circle at 80% 75%, rgba(97, 232, 255, 0.26), transparent 42%),
    linear-gradient(135deg, #1a1a2e 0%, #2b1055 35%, #3a1c71 65%, #16213e 100%),
    linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 120% 120%, 120% 120%, 300% 300%, 8px 8px, 8px 8px;
  background-position: 15% 20%, 80% 75%, 0% 50%, 0 0, 0 0;
  color: var(--foreground);
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  image-rendering: pixelated;
  /* Disable smoothing for sharper pixels */
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: grayscale;
  animation: neonBackgroundMove 4.5s linear infinite alternate;
}

body::before {
  content: '';
  position: fixed;
  inset: -12%;
  pointer-events: none;
  z-index: 0;
  mix-blend-mode: screen;
  filter: blur(10px) saturate(120%);
  background:
    radial-gradient(circle at 20% 25%, rgba(255, 77, 166, 0.45), transparent 40%),
    radial-gradient(circle at 78% 35%, rgba(97, 232, 255, 0.38), transparent 42%),
    radial-gradient(circle at 50% 82%, rgba(180, 110, 255, 0.30), transparent 45%);
  opacity: 0.72;
  animation: neonDrift 3.2s linear infinite alternate;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.05) 0px,
    rgba(255, 255, 255, 0.05) 1px,
    rgba(0, 0, 0, 0.08) 1px,
    rgba(0, 0, 0, 0.08) 2px
  );
  pointer-events: none;
  z-index: 999;
}

.app-layout {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  transition: filter 0.22s ease;
}

body.modal-open .app-layout {
  pointer-events: none;
  filter: blur(6px);
}

.main-container {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 30px;
}

.drink-sidebar {
  position: absolute;
  left: max(8px, calc(50% - 620px));
  top: 50%;
  transform: translateY(-50%);
  width: 250px;
  height: min(84vh, 620px);
  padding: 14px 12px 12px;
  background-color: rgba(8, 12, 28, 0.84);
  border: 4px solid var(--border);
  box-shadow: 8px 8px 0 var(--shadow-color);
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 2;
}

.leaderboard-sidebar {
  position: absolute;
  right: max(8px, calc(50% - 620px));
  top: 50%;
  transform: translateY(-50%);
  width: 250px;
  height: min(84vh, 620px);
  padding: 14px 12px 12px;
  background-color: rgba(8, 12, 28, 0.84);
  border: 4px solid var(--border);
  box-shadow: 8px 8px 0 var(--shadow-color);
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 2;
}

.leaderboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.leaderboard-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pixel-mini-btn {
  background: var(--secondary);
  color: var(--secondary-foreground);
  border: 3px solid var(--secondary-foreground);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.25);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 6px 8px;
  white-space: nowrap;
}

.leaderboard-scroll-track {
  --leaderboard-duration: 24s;
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: sidebarLoop var(--leaderboard-duration) linear infinite;
  will-change: transform;
}

.leaderboard-scroll-track.static-track {
  animation: none;
}

.leaderboard-item {
  min-height: 76px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px;
  background: rgba(255, 77, 166, 0.08);
  border: 2px solid var(--muted);
  cursor: pointer;
}

.leaderboard-item.is-current-user {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(97, 232, 255, 0.3);
}

.leaderboard-empty {
  justify-content: center;
  color: var(--muted-foreground);
  cursor: default;
}

.leaderboard-thumb {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  object-fit: cover;
  image-rendering: pixelated;
  border: 2px solid var(--secondary-foreground);
  background: #14172a;
}

.leaderboard-info {
  min-width: 0;
}

.leaderboard-name {
  margin: 3px 0 5px;
  font-size: 1rem;
  line-height: 1.25;
  color: var(--foreground);
  word-break: break-all;
}

.leaderboard-count {
  margin: 0;
  font-size: 0.86rem;
  color: var(--accent);
}

.leaderboard-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.6em;
  height: 1.6em;
  padding: 1px 6px;
  font-size: 0.72rem;
  line-height: 1;
  color: var(--secondary-foreground);
  border: 2px solid var(--secondary-foreground);
  background: rgba(28, 53, 95, 0.62);
}

.leaderboard-rank.rank-1 {
  font-size: 0.9rem;
  border-color: #ffe49c;
  background: linear-gradient(180deg, #ffeaa8 0%, #ffc94d 100%);
}

.leaderboard-rank.rank-2 {
  font-size: 0.9rem;
  border-color: #dbe6f2;
  background: linear-gradient(180deg, #f1f4fa 0%, #b8c4d3 100%);
}

.leaderboard-rank.rank-3 {
  font-size: 0.9rem;
  border-color: #e3b08a;
  background: linear-gradient(180deg, #efc0a0 0%, #be7f56 100%);
}

.sidebar-title {
  margin: 0;
  color: var(--accent);
  font-size: 1.5rem;
  letter-spacing: 2px;
  text-align: center;
}

.sidebar-scroll-window {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  border: 3px solid var(--secondary-foreground);
  background: rgba(15, 16, 32, 0.92);
  padding: 8px;
}

.sidebar-scroll-track {
  --sidebar-duration: 28s;
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: sidebarLoop var(--sidebar-duration) linear infinite;
  will-change: transform;
}

.sidebar-item {
  min-height: 76px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px;
  background: rgba(97, 232, 255, 0.08);
  border: 2px solid var(--muted);
}

.drink-sidebar .sidebar-item {
  cursor: pointer;
}

.sidebar-thumb {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  object-fit: cover;
  image-rendering: pixelated;
  border: 2px solid var(--secondary-foreground);
  background: #14172a;
}

.sidebar-drink-name {
  margin: 0;
  line-height: 1.35;
  color: var(--foreground);
  font-size: 1rem;
  word-break: break-all;
}

header {
  text-align: center;
}

header h1 {
  font-size: 4rem;
  margin: 0;
  color: var(--primary);
  /* Hard pixel shadow */
  text-shadow: 4px 4px 0px var(--shadow-color);
  letter-spacing: 4px;
  padding-left: 4px; /* Balance letter-spacing for perfect centering */
  line-height: 1;
}

header p {
  font-size: 1.5rem;
  margin-top: 10px;
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 2px;
  padding-left: 2px; /* Balance letter-spacing */
}

/* Slot Machine Structure */
.slot-machine-container {
  display: flex;
  align-items: flex-end; /* Align bottom */
  gap: 10px;
  /* Center visually */
  transform: translateX(30px);
}

.machine-body {
  background-color: var(--card);
  /* Double border effect for pixel look */
  border: 4px solid var(--border);
  /* No rounded corners! */
  border-radius: 0; 
  padding: 20px;
  /* Hard box shadow */
  box-shadow: 8px 8px 0px var(--shadow-color);
  width: 360px; 
  position: relative;
}

/* Decorative screws */
.machine-body::before, .machine-body::after {
  content: '';
  position: absolute;
  width: 8px;
  height: 8px;
  background: var(--muted-foreground);
  top: 6px;
  box-shadow: inset 2px 2px 0 rgba(0,0,0,0.3);
}
.machine-body::before { left: 6px; }
.machine-body::after { right: 6px; }


.screen-border {
  background-color: var(--input);
  padding: 10px;
  border: 4px solid var(--secondary-foreground);
  border-radius: 0;
  /* Inset hard shadow */
  box-shadow: inset 4px 4px 0px rgba(0,0,0,0.1);
}

.spinner-window {
  height: 240px; 
  background:
    linear-gradient(
      180deg,
      rgba(16, 10, 48, 0.96) 0%,
      rgba(22, 8, 74, 0.92) 48%,
      rgba(5, 20, 46, 0.96) 100%
    ),
    radial-gradient(circle at 16% 18%, rgba(97, 232, 255, 0.32), transparent 36%),
    radial-gradient(circle at 84% 78%, rgba(255, 77, 166, 0.28), transparent 42%),
    repeating-linear-gradient(
      0deg,
      rgba(97, 232, 255, 0.08) 0px,
      rgba(97, 232, 255, 0.08) 2px,
      rgba(255, 77, 166, 0.06) 2px,
      rgba(255, 77, 166, 0.06) 4px
    );
  overflow: hidden;
  position: relative;
  border: 2px solid var(--border);
  box-shadow:
    inset 0 0 0 2px rgba(97, 232, 255, 0.35),
    inset 0 0 22px rgba(255, 77, 166, 0.26),
    0 0 20px rgba(97, 232, 255, 0.28),
    0 0 32px rgba(255, 77, 166, 0.2);
}

.spinner-list {
  position: relative;
  top: 0;
  will-change: transform;
  display: flex;
  flex-direction: column;
}

.spinner-item {
  height: 240px; 
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  line-height: 1.4;
  padding: 0 15px; 
  background:
    linear-gradient(180deg, rgba(97, 232, 255, 0.1) 0%, rgba(255, 77, 166, 0.08) 100%),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0));
  border-bottom: 2px solid var(--muted); 
  box-sizing: border-box;
}

.drink-title {
  font-size: 1.8rem; 
  font-weight: bold;
  color: var(--primary);
  margin-bottom: 5px;
  /* text-transform: uppercase; // Chinese doesn't have case */
}

.drink-recipe {
  font-size: 1.2rem; 
  color: var(--foreground);
  margin-bottom: 5px;
}

.drink-desc {
  font-size: 1rem;
  color: var(--muted-foreground);
  /* font-style: italic; // Pixel fonts often don't support italic well */
  max-width: 90%;
}

/* Pixel Glare - Stripes */
.pixel-reflection {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    0deg,
    rgba(255,255,255,0.05) 0px,
    rgba(255,255,255,0.05) 2px,
    transparent 2px,
    transparent 4px
  ),
  linear-gradient(
    135deg,
    rgba(97, 232, 255, 0.16) 0%,
    rgba(255, 77, 166, 0.12) 45%,
    transparent 80%
  );
  pointer-events: none;
  z-index: 5;
}

.selection-line {
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: 4px; 
  background: var(--destructive); 
  transform: translateY(-50%);
  pointer-events: none;
  z-index: 10;
  opacity: 0.4; 
  /* Dotted line via gradient */
  background: linear-gradient(90deg, var(--destructive) 50%, transparent 50%);
  background-size: 8px 100%;
}

.machine-details {
  display: flex;
  justify-content: space-between;
  margin-top: 15px;
}

.detail-stripe {
  height: 12px;
  width: 40%;
  background-color: var(--secondary);
  border: 2px solid var(--border);
  box-shadow: 2px 2px 0 rgba(0,0,0,0.1);
}

/* Lever Mechanism - Pixelated */
.lever-container {
  position: relative;
  width: 60px;
  height: 280px; 
  cursor: pointer;
}

.lever-base {
  position: absolute;
  bottom: 20px;
  left: -10px;
  width: 24px;
  height: 60px;
  background: var(--muted-foreground);
  border: 4px solid var(--foreground);
  border-radius: 0; /* Square base */
  box-shadow: 4px 4px 0 var(--shadow-color);
}

.lever-stick {
  position: absolute;
  bottom: 50px;
  left: -2px; /* Center relative to base? Base is 24px wide (-10px left). Stick is 8px wide. */
  /* Base center is roughly left + width/2 = -10 + 12 = 2px. Stick left -2 + 4 = 2px. Close enough. */
  width: 12px;
  height: 180px; 
  background: var(--secondary);
  border: 4px solid var(--foreground);
  transform-origin: bottom center;
  /* Pixel look: no smoothing */
}

/* The Knob - PIXEL SPHERE (Square) */
.lever-knob {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 40px;
  background: var(--destructive);
  border-radius: 0; /* SQUARE */
  border: 4px solid var(--foreground);
  /* Pixel highlight */
  box-shadow: inset 4px 4px 0 rgba(255,255,255,0.4), 4px 4px 0 rgba(0,0,0,0.2);
}

/* Lever Pull Animation - Hard Rotation */
.lever-container.pulled .lever-stick {
   transform: rotate(45deg); 
}

/* Result Box */
.result-box {
  background: var(--foreground);
  color: var(--background);
  padding: 15px 25px;
  border: 4px solid var(--primary);
  /* Hard shadow */
  box-shadow: 8px 8px 0px var(--shadow-color);
  animation: popIn 0.3s steps(4, end); /* Steps animation for choppy pixel feel */
  max-width: 90%;
  text-align: center;
}

.result-box .label {
  display: block;
  font-size: 1.5rem;
  color: var(--accent);
  margin-bottom: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.result-box.hidden {
  display: none;
}

@keyframes popIn {
  from { transform: scale(0); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.winner-pulse {
  animation: pulse 0.5s steps(2, start) infinite alternate;
}

@keyframes pulse {
    from { transform: scale(1); }
    to { transform: scale(1.05); }
}

@keyframes sidebarLoop {
  from { transform: translateY(0); }
  to { transform: translateY(-50%); }
}

@keyframes neonBackgroundMove {
  0% {
    background-position: 10% 15%, 85% 80%, 0% 50%, 0 0, 0 0;
  }
  50% {
    background-position: 35% 45%, 55% 55%, 100% 50%, 0 0, 0 0;
  }
  100% {
    background-position: 50% 20%, 40% 85%, 0% 50%, 0 0, 0 0;
  }
}

@keyframes neonDrift {
  0% { transform: translate3d(-3%, -2%, 0) scale(1.03); }
  50% { transform: translate3d(4%, 2.5%, 0) scale(1.09); }
  100% { transform: translate3d(-4%, 3%, 0) scale(1.05); }
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.modal-overlay.show .modal-content {
    pointer-events: auto;
}

.modal-content {
    background: var(--background);
    border: 4px solid var(--primary);
    box-shadow: 8px 8px 0 var(--shadow-color);
    padding: 20px;
    width: min(92vw, 460px);
    min-width: 0;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    transform: scale(0.8);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.profile-modal-content {
    width: min(92vw, 520px);
}

.history-modal-content {
    width: min(92vw, 560px);
}

.modal-overlay.show .modal-content {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: flex-end;
}

.close-btn {
    font-size: 2rem;
    cursor: pointer;
    line-height: 0.5;
    color: var(--muted-foreground);
}

.close-btn:hover {
    color: var(--primary);
}

.modal-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.modal-title {
    margin: 0 0 12px;
    font-size: 1.4rem;
    color: var(--accent);
    text-align: center;
}

.form-label {
    width: 100%;
    max-width: 340px;
    margin: 0 0 6px;
    color: var(--muted-foreground);
    font-size: 0.95rem;
}

.pixel-input {
    width: 100%;
    max-width: 340px;
    background: var(--input);
    color: var(--foreground);
    border: 3px solid var(--secondary-foreground);
    padding: 8px 10px;
    font-size: 1rem;
    outline: none;
}

.pixel-input:focus {
    border-color: var(--accent);
}

.camera-status {
    width: 100%;
    max-width: 340px;
    margin: 10px 0;
    color: var(--muted-foreground);
    font-size: 0.9rem;
    line-height: 1.35;
}

.camera-frame {
    width: min(100%, 340px);
    height: 210px;
    border: 3px solid var(--secondary-foreground);
    background: rgba(12, 16, 38, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.camera-preview,
.camera-captured {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.camera-actions {
    margin-top: 12px;
    width: 100%;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
}

.camera-actions .pixel-btn {
    font-size: 1rem;
    padding: 8px 12px;
}

.camera-actions .pixel-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.history-user-card {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
}

.history-user-image {
    width: 88px;
    height: 88px;
    object-fit: cover;
    border: 3px solid var(--secondary-foreground);
    background: #14172a;
}

.history-user-info {
    min-width: 0;
}

.history-user-name {
    font-size: 1.4rem;
    color: var(--primary);
    margin-bottom: 6px;
    line-height: 1.2;
}

.history-user-count {
    color: var(--accent);
    font-size: 0.95rem;
}

.history-records {
    width: 100%;
    max-height: 360px;
    overflow-y: auto;
}

.history-empty {
    margin: 0;
    color: var(--muted-foreground);
    text-align: center;
}

.history-record-item {
    border: 2px solid var(--muted);
    background: rgba(255, 77, 166, 0.07);
    padding: 8px 10px;
    margin-bottom: 8px;
}

.history-record-drink {
    color: var(--foreground);
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.history-record-time {
    color: var(--accent);
    font-size: 0.84rem;
}

.history-records .history-record-item:last-child {
    margin-bottom: 0;
}

.result-image-box {
    width: 180px;
    height: 120px;
    margin: 0 auto 12px;
    padding: 4px;
    border: 3px solid var(--secondary-foreground);
    background: rgba(15, 16, 32, 0.92);
    box-shadow: inset 3px 3px 0 rgba(0, 0, 0, 0.2);
}

.result-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
    border: 2px solid var(--border);
    background: #14172a;
}

.result-name {
    font-size: 1.6rem;
    color: var(--primary);
    text-align: center;
    margin-bottom: 15px;
    text-shadow: 2px 2px 0 var(--shadow-color);
    white-space: nowrap;
}

.result-divider {
    height: 2px;
    background: var(--muted);
    margin: 15px 0;
    position: relative;
}

.result-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    background: var(--secondary);
    border: 2px solid var(--border);
    transform: translate(-50%, -50%) rotate(45deg);
}

.result-recipe {
    font-size: 1rem;
    color: var(--muted-foreground);
    text-align: center;
    line-height: 1.5;
}

.modal-footer {
    margin-top: 25px;
    display: flex;
    justify-content: center;
}

.pixel-btn {
    background: var(--primary);
    color: var(--primary-foreground);
    border: 4px solid var(--border);
    padding: 10px 20px;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 4px 4px 0 var(--shadow-color);
    transition: transform 0.1s, box-shadow 0.1s;
}

.pixel-btn:active {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0 var(--shadow-color);
}

@media (max-width: 1080px) {
  body {
    padding: 10px;
  }

  .drink-sidebar,
  .leaderboard-sidebar {
    width: 190px;
    height: min(76vh, 560px);
  }

  .drink-sidebar {
    left: 10px;
  }

  .leaderboard-sidebar {
    right: 10px;
  }

  .slot-machine-container {
    transform: none;
  }
}

@media (max-width: 820px) {
  body {
    overflow-y: auto;
    height: auto;
    min-height: 100dvh;
    align-items: flex-start;
    padding: 12px 12px calc(18px + env(safe-area-inset-bottom));
  }

  .app-layout {
    height: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
  }

  .main-container {
    position: static;
    transform: none;
    gap: 20px;
    width: min(760px, 100%);
  }

  .drink-sidebar,
  .leaderboard-sidebar {
    position: static;
    top: auto;
    left: auto;
    right: auto;
    transform: none;
    width: min(760px, 100%);
    max-height: none;
  }

  .drink-sidebar {
    height: 240px;
  }

  .leaderboard-sidebar {
    height: 280px;
  }

  .sidebar-scroll-window {
    min-height: 160px;
  }

  .slot-machine-container {
    transform: none;
    width: min(760px, 100%);
    justify-content: center;
  }

  .machine-body {
    width: min(100%, 420px);
  }

  .pixel-btn,
  .pixel-mini-btn {
    min-height: 44px;
  }
}

@media (max-width: 640px) {
  body {
    overflow-y: auto;
    height: auto;
    min-height: 100dvh;
    align-items: flex-start;
    padding: 12px 10px calc(16px + env(safe-area-inset-bottom));
  }

  .app-layout {
    height: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
  }

  .main-container {
    position: static;
    transform: none;
    gap: 18px;
  }

  .drink-sidebar {
    position: static;
    transform: none;
    width: min(460px, 100%);
    height: 220px;
    max-height: none;
  }

  .leaderboard-sidebar {
    position: static;
    transform: none;
    width: min(460px, 100%);
    height: 260px;
    max-height: none;
  }

  .sidebar-scroll-window {
    min-height: 150px;
  }

  header h1 {
    font-size: 2.2rem;
    letter-spacing: 2px;
    padding-left: 2px;
  }

  header p {
    font-size: 1.1rem;
  }

  .machine-body {
    width: min(100%, 340px);
    padding: 14px;
  }

  .spinner-window {
    height: 210px;
  }

  .spinner-item {
    height: 210px;
  }

  .drink-title {
    font-size: 1.5rem;
  }

  .modal-content {
    width: min(92vw, 420px);
    max-height: 84vh;
  }

  .history-modal-content {
    width: min(94vw, 440px);
  }

  .result-image-box {
    width: 150px;
    height: 100px;
  }

  .result-name {
    font-size: 1.25rem;
  }

  .history-user-name {
    font-size: 1.15rem;
  }

  .pixel-btn,
  .pixel-mini-btn {
    min-height: 44px;
  }
}
