:root {
  /* Modern Dark Theme */
  --bg-primary: #121212; /* Very dark grey */
  --bg-secondary: #1e1e1e;
  --bg-card: #2a2a2a;
  --bg-card-hover: #383838;
  --text-primary: #eaeaea; /* Slightly brighter */
  --text-secondary: #a0a0a0; /* Medium grey */
  --accent-primary: #7f5af0; /* Brighter Purple */
  --accent-secondary: #9f8aff;
  --accent-green: #2cb67d; /* Tealish Green */
  --accent-green-hover: #259d6c;
  --border-color: #3a3a3a;
  --font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --card-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  --card-shadow-hover: 0 8px 25px rgba(0, 0, 0, 0.3);
  --border-radius-small: 6px;
  --border-radius-medium: 10px;
  --border-radius-large: 16px;
  --scrollbar-bg: var(--bg-secondary);
  --scrollbar-thumb: #555;
  --scrollbar-thumb-hover: #777;
  /* Ticker Colors */
  --ticker-bg-rgba: rgba(25, 28, 41, 0.6); /* Dark blue/purple tint */
  --ticker-border: rgba(127, 90, 240, 0.2); /* Faint accent border */
  --ticker-text: var(--text-secondary);
  /* Animation Speeds */
  --transition-speed: 0.1s;
}

.light-theme {
  /* Modern Light Theme */
  --bg-primary: #f5f5f7; /* Light grey background */
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f0f0f0;
  --text-primary: #1d1d1f; /* Near black */
  --text-secondary: #6e6e73; /* Grey */
  --accent-primary: #007aff; /* Apple Blue */
  --accent-secondary: #5856d6; /* Indigo */
  --accent-green: #28a745;
  --accent-green-hover: #218838;
  --border-color: #d2d2d7;
  --card-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  --card-shadow-hover: 0 6px 20px rgba(0, 0, 0, 0.12);
  --scrollbar-bg: var(--bg-primary);
  --scrollbar-thumb: #bbb;
  --scrollbar-thumb-hover: #999;
  /* Ticker Colors */
  --ticker-bg-rgba: rgba(245, 245, 247, 0.65); /* Light grey tint */
  --ticker-border: rgba(0, 122, 255, 0.15); /* Faint accent border */
  --ticker-text: var(--text-secondary);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  padding-bottom: 60px;
  overflow-y: scroll; /* Re-enable vertical scrollbar */
  transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease;
  /* Обеспечиваем немедленную готовность */
  animation: none !important;
}

/* Modern Scrollbar Styling (WebKit browsers) */
body::-webkit-scrollbar {
  width: 8px; /* Slim scrollbar */
}

body::-webkit-scrollbar-track {
  background: var(--scrollbar-bg);
  transition: background-color var(--transition-speed) ease;
}

body::-webkit-scrollbar-thumb {
  background-color: var(--scrollbar-thumb);
  border-radius: 10px;
  border: 2px solid var(--scrollbar-bg); /* Creates padding around thumb */
  transition: background-color var(--transition-speed) ease;
}

body::-webkit-scrollbar-thumb:hover {
  background-color: var(--scrollbar-thumb-hover);
}

/* Add Firefox specific scrollbar styling if needed */
/* body {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-bg);
} */

a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: color var(--transition-speed) ease;
}
a:hover {
  color: var(--accent-secondary);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  position: relative; /* Needed for refresh button positioning */
}

/* --- Header --- */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 30px;
  background-color: rgba(var(--bg-secondary-rgb, 30 30 30), 0.8); /* Use RGB for opacity */
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  transition: background-color var(--transition-speed) ease, border-color var(--transition-speed) ease;
}

/* Add RGB versions for transparent background */
:root {
  --bg-secondary-rgb: 30, 30, 30;
}
.light-theme {
  --bg-secondary-rgb: 255, 255, 255;
}

.logo {
  font-size: 1.6em;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 15px;
}

/* View Controls now in header */
.view-controls {
  display: flex;
  background-color: var(--bg-primary);
  border-radius: var(--border-radius-medium);
  padding: 4px;
  border: 1px solid var(--border-color);
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.view-controls button {
  background-color: transparent;
  color: var(--text-secondary);
  border: none;
  padding: 6px 14px;
  border-radius: var(--border-radius-small);
  cursor: pointer;
  font-size: 0.9em;
  font-weight: 500;
  transition: all 0.3s ease;
}

.view-controls button:hover {
  color: var(--text-primary);
}

.view-controls button.active {
  background-color: var(--bg-card);
  color: var(--text-primary);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* Header Info now only contains theme toggle */
.header-info button {
  background: var(--bg-secondary);
  padding: 5px 8px;
  border-radius: var(--border-radius-large);
  font-size: 1.2em;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  cursor: pointer;
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-info button:hover {
  background-color: var(--bg-card);
}

/* Исправляем стили для кнопок в шапке */
.header-button {
  background: var(--bg-secondary);
  padding: 8px 16px;
  border-radius: var(--border-radius-medium);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 0.95em;
  font-weight: 500;
  transition: all var(--transition-speed) ease;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto !important;
}

.header-button:hover {
  background-color: var(--bg-card);
  border-color: var(--accent-secondary);
}

/* --- Refresh Controls (Removed) --- */
/* .refresh-controls { ... } */
/* .refresh-controls button { ... } */
/* .refresh-controls button:hover { ... } */

/* --- Central Status Display --- */
.status-display {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin: 30px auto 40px auto;
  padding: 18px 35px;
  background-color: var(--bg-secondary);
  border-radius: var(--border-radius-large);
  border: 1px solid var(--border-color);
  width: fit-content;
  box-shadow: var(--card-shadow);
  transition: background-color var(--transition-speed) ease, border-color var(--transition-speed) ease;
}

/* Group balance and timer */
.status-main-info {
  display: flex;
  align-items: center;
  gap: 15px;
}

.status-item {
  font-size: 1.8em;
  font-weight: 600;
  color: var(--text-primary);
  transition: color var(--transition-speed) ease;
}

#balance {
  color: var(--accent-secondary);
}

.status-separator {
  font-size: 1.5em;
  color: var(--border-color);
  font-weight: 300;
  transition: color var(--transition-speed) ease;
}

/* Pulsing Animation */
@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(var(--accent-green-rgb, 40 167 69), 0.6);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(var(--accent-green-rgb, 40 167 69), 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(var(--accent-green-rgb, 40 167 69), 0);
  }
}
:root {
  --accent-green-rgb: 40, 167, 69;
}

/* Refresh button specific styling */
#refresh-btn {
  background: var(--accent-green);
  border: none;
  color: white;
  padding: 8px 18px;
  margin-top: 10px;
  cursor: pointer;
  border-radius: var(--border-radius-medium);
  display: flex; /* Default to showing */
  align-items: center;
  justify-content: center;
  transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease, transform
    var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
  font-size: 0.9em;
  font-weight: 600;
  box-shadow: 0 4px 10px rgba(var(--accent-green-rgb, 40 167 69), 0.3);
  /* Обеспечиваем немедленную кликабельность */
  pointer-events: auto !important;
}

#refresh-btn.active {
  display: flex; /* Show button when active */
  animation: pulse 2s infinite;
}

#refresh-btn:hover {
  background-color: var(--accent-green-hover);
  color: white;
  box-shadow: 0 6px 15px rgba(var(--accent-green-rgb, 40 167 69), 0.4);
}

#refresh-btn:active {
  transform: scale(0.95);
  box-shadow: 0 2px 5px rgba(var(--accent-green-rgb, 40 167 69), 0.2);
  animation: none;
}

/* --- Opinions Grid --- */
#opinions-container {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.opinion-card {
  background-color: var(--bg-card);
  border-radius: var(--border-radius-large);
  padding: 25px;
  border: 1px solid var(--border-color);
  transition: transform var(--transition-speed) ease, box-shadow var(--transition-speed) ease, background-color
    var(--transition-speed) ease, border-color var(--transition-speed) ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 160px;
  box-shadow: var(--card-shadow);
  /* Удаляем анимацию появления для мгновенного отображения */
  opacity: 1;
}

.opinion-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--card-shadow-hover);
  background-color: var(--bg-card-hover);
}

/* Top opinion styling (only in History) */
.history-view .opinion-card.top-opinion {
  grid-column: 1 / -1;
  background-color: var(--bg-secondary);
  border-left: 4px solid var(--accent-primary);
  padding: 35px;
  min-height: auto;
}

.history-view .opinion-card.top-opinion .opinion-text {
  font-size: 1.5em;
  margin: 18px 0;
  font-weight: 500;
}

.history-view .opinion-card.top-opinion .opinion-footer {
  margin-top: 25px;
  justify-content: flex-start; /* Align time to start */
}

/* Hide elements in default view, show in history */
.opinion-rank,
.opinion-amount,
.opinion-time {
  display: none;
}

.history-view .opinion-rank,
.history-view .opinion-amount,
.history-view .opinion-time {
  display: inline-block; /* Or block/flex as appropriate */
}

/* Style elements shown in history */
.opinion-rank {
  background-color: var(--accent-primary);
  color: white;
  padding: 4px 9px;
  border-radius: var(--border-radius-small);
  font-weight: 600;
  font-size: 0.9em;
  transition: background-color var(--transition-speed) ease;
}

.opinion-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  font-size: 0.9em;
}

.opinion-author {
  color: var(--text-secondary);
  font-family: monospace;
  font-size: 0.95em;
  transition: color var(--transition-speed) ease;
}

.opinion-amount {
  background-color: rgba(var(--accent-secondary-rgb, 92 122 255), 0.15);
  color: var(--accent-secondary);
  padding: 4px 12px;
  border-radius: var(--border-radius-large);
  font-weight: 600;
  font-size: 0.9em;
  border: 1px solid rgba(var(--accent-secondary-rgb, 92 122 255), 0.3);
  transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease, border-color
    var(--transition-speed) ease;
}

/* Add RGB versions for transparent background */
:root {
  --accent-secondary-rgb: 92, 122, 255;
}
.light-theme {
  --accent-secondary-rgb: 88, 86, 214;
} /* Indigo light */

.opinion-text {
  margin-bottom: 20px;
  flex-grow: 1;
  font-size: 1.1em;
  line-height: 1.5;
  color: var(--text-primary);
  transition: color var(--transition-speed) ease;
}

.opinion-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  gap: 15px;
}

.opinion-time {
  color: var(--text-secondary);
  font-size: 0.85em;
  white-space: nowrap;
  transition: color var(--transition-speed) ease;
}

/* Support button styling */
.support-button {
  background-color: var(--accent-primary);
  color: white;
  border: none;
  padding: 0; /* Remove padding, apply to faces */
  border-radius: var(--border-radius-medium);
  cursor: pointer;
  font-weight: 600;
  font-size: 1em;
  white-space: nowrap;
  perspective: 1000px;
  position: relative;
  min-height: 40px; /* Ensure button has height based on padding of faces */
  min-width: 100px; /* Ensure button has some width */
  overflow: hidden; /* Hide overflowing faces during flip if needed, though backface-visibility should handle it */
  transition: background-color var(--transition-speed) ease; /* Transition background directly */
  /* Обеспечиваем немедленную кликабельность */
  pointer-events: auto !important;
}

.button-face {
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: var(--border-radius-medium);
  backface-visibility: hidden; /* Hide the back */
  padding: 10px 20px;
  box-sizing: border-box;
  transition: transform var(--transition-speed) ease, background-color var(--transition-speed) ease, color
    var(--transition-speed) ease; /* Add transform transition */
  transform-style: preserve-3d; /* Apply here for children */
}

.button-front {
  background-color: var(--accent-primary);
  color: white;
  z-index: 2;
  transform: rotateX(0deg); /* Start facing front */
}

.button-back {
  background-color: var(--accent-secondary);
  color: white;
  transform: rotateX(180deg); /* Start flipped back vertically */
  font-size: 1.1em; /* Make $1 slightly larger */
  font-weight: 700;
}

.support-button:hover .button-front {
  transform: rotateX(-180deg); /* Flip front away */
}

.support-button:hover .button-back {
  transform: rotateX(0deg); /* Flip back to front */
}

/* Remove hover effect from main button */
.support-button:hover {
  background-color: var(--accent-primary); /* Keep original background during flip */
}

.support-button:active {
  /* Simple scale down on click, no rotation */
  transform: scale(0.96);
  transition: transform 0.1s ease; /* Faster click transition */
}

/* --- Ticker --- */
#ticker-container {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background-color: var(--ticker-bg-rgba); /* Use RGBA variable */
  backdrop-filter: blur(12px); /* Apply blur */
  -webkit-backdrop-filter: blur(12px); /* Safari prefix */
  overflow: hidden;
  white-space: nowrap;
  padding: 10px 0;
  border-top: 1px solid var(--ticker-border); /* Use ticker border color */
  z-index: 90;
  transition: background-color var(--transition-speed) ease, border-color var(--transition-speed) ease;
}

#ticker {
  display: inline-block;
  padding-left: 100%;
  animation: ticker-scroll 45s linear infinite;
  will-change: transform;
}

.ticker-item {
  display: inline-block;
  margin-right: 50px;
  color: var(--ticker-text); /* Use ticker text color */
  font-size: 0.9em;
  transition: color var(--transition-speed) ease;
  opacity: 0.9; /* Slightly less muted */
}

@keyframes ticker-scroll {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-100%);
  }
}

/* --- Post Opinion Button --- */
#post-opinion-btn {
  position: fixed;
  bottom: 65px; /* Adjusted position */
  right: 35px;
  background-color: var(--accent-primary);
  color: white;
  border: none;
  border-radius: 50%;
  width: 64px;
  height: 64px;
  font-size: 2.2em;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(var(--accent-primary-rgb, 106 90 205), 0.4);
  transition: all var(--transition-speed) ease;
  z-index: 110;
  /* Обеспечиваем немедленную кликабельность */
  pointer-events: auto !important;
}
:root {
  --accent-primary-rgb: 106, 90, 205;
}
.light-theme {
  --accent-primary-rgb: 0, 122, 255;
}

#post-opinion-btn:hover {
  background-color: var(--accent-secondary);
  transform: scale(1.08);
  box-shadow: 0 8px 25px rgba(var(--accent-secondary-rgb, 92 122 255), 0.5);
}

/* --- Post Opinion Modal --- */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  /* Use Flexbox for centering */
  align-items: center;
  justify-content: center;
  padding: 20px; /* Add some padding for smaller screens */
  opacity: 0; /* Start hidden for animation */
  transition: opacity var(--transition-speed) ease;
}

/* Override display: none when active */
.modal.active {
  opacity: 1;
  display: flex;
}

.modal-content {
  background-color: var(--bg-secondary);
  padding: 35px;
  border: 1px solid var(--border-color);
  width: 90%;
  max-width: 550px;
  border-radius: var(--border-radius-large);
  position: relative;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.25);
  transition: background-color var(--transition-speed) ease, border-color var(--transition-speed) ease, transform
    var(--transition-speed) ease, opacity var(--transition-speed) ease;
  transform: scale(0.95);
  opacity: 0;
  will-change: transform, opacity;
}

/* Apply animation when modal becomes active */
.modal.active .modal-content {
  transform: scale(1);
  opacity: 1;
}

/* Ensure QR modal content also resets margin if needed */
.qr-modal .qr-modal-content {
  max-width: 400px; /* Smaller width for QR display */
  padding: 30px;
  text-align: center;
}

.close-btn {
  color: var(--text-secondary);
  position: absolute;
  top: 18px;
  right: 22px;
  font-size: 30px;
  font-weight: normal;
  cursor: pointer;
  transition: color var(--transition-speed) ease, transform var(--transition-speed) ease;
  line-height: 1;
}

.close-btn:hover {
  color: var(--text-primary);
  transform: scale(1.1);
}

.modal h2 {
  margin-bottom: 25px;
  color: var(--text-primary);
  text-align: center;
  font-size: 1.6em;
  font-weight: 600;
  transition: color var(--transition-speed) ease;
}

.modal label {
  display: block;
  margin-bottom: 10px;
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 0.95em;
  transition: color var(--transition-speed) ease;
}

/* Token Selection Styling */
.token-select {
  display: flex;
  gap: 10px;
  margin-bottom: 25px;
}

.token-select input[type="radio"] {
  display: none; /* Hide actual radio button */
}

.token-select label {
  flex: 1; /* Distribute space evenly */
  text-align: center;
  padding: 10px 15px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-medium);
  cursor: pointer;
  transition: all var(--transition-speed) ease;
  font-weight: 500;
  margin-bottom: 0; /* Override default label margin */
}

.token-select input[type="radio"]:checked + label {
  background-color: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
  box-shadow: 0 2px 8px rgba(var(--accent-primary-rgb), 0.3);
}

.token-select label:hover {
  border-color: var(--accent-secondary);
  color: var(--text-primary);
}

.modal textarea,
.modal select {
  width: 100%;
  padding: 14px;
  margin-bottom: 25px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-medium);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-size: 1em;
  font-family: var(--font-family);
  resize: vertical;
  transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease, border-color
    var(--transition-speed) ease;
}

.modal textarea:focus,
.modal select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(var(--accent-primary-rgb, 106 90 205), 0.3);
}

.modal textarea {
  min-height: 110px;
}

.modal select {
  cursor: pointer;
}

#submit-opinion-btn {
  background-color: var(--accent-primary);
  color: white;
  padding: 14px 30px;
  border: none;
  border-radius: var(--border-radius-medium);
  cursor: pointer;
  font-size: 1.1em;
  font-weight: 600;
  width: 100%;
  transition: background-color var(--transition-speed) ease, transform var(--transition-speed) ease;
  /* Обеспечиваем немедленную кликабельность */
  pointer-events: auto !important;
}

#submit-opinion-btn:hover {
  background-color: var(--accent-secondary);
  transform: scale(1.02);
}

.post-cost-info {
  font-size: 0.9em;
  color: var(--text-secondary);
  text-align: center;
  margin-top: -15px; /* Pull up below token select */
  margin-bottom: 25px;
  transition: color var(--transition-speed) ease;
}

/* QR Code Guide Styling */
.qr-guide {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-medium);
  padding: 15px 20px;
  margin-top: 25px;
  font-size: 0.9em;
  color: var(--text-secondary);
  transition: background-color var(--transition-speed) ease, border-color var(--transition-speed) ease, color
    var(--transition-speed) ease;
}

.qr-guide h4 {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
  font-size: 1em;
}

.qr-guide ol {
  margin-left: 20px;
  padding-left: 10px;
}

.qr-guide li {
  margin-bottom: 5px;
  line-height: 1.5;
}

/* QR Display Modal Styling */
.qr-modal .qr-modal-content {
  max-width: 400px; /* Smaller width for QR display */
  padding: 30px;
  text-align: center;
}

.qr-modal h3 {
  margin-bottom: 20px;
  font-size: 1.4em;
  font-weight: 600;
  color: var(--text-primary);
}

#qr-code-display-area {
  margin-bottom: 25px;
  background-color: white; /* QR codes need white background */
  padding: 15px;
  border-radius: var(--border-radius-medium);
  display: inline-block; /* Center the block */
}

#qr-code-display-area img {
  display: block; /* Remove extra space below image */
  width: 180px; /* Larger QR */
  height: 180px;
}

#qr-details {
  text-align: left;
  font-size: 0.95em;
  color: var(--text-secondary);
}

#qr-details p {
  margin-bottom: 8px;
}

#qr-details strong {
  color: var(--text-primary);
  margin-right: 5px;
}

#qr-details blockquote {
  border-left: 3px solid var(--border-color);
  padding-left: 15px;
  margin: 10px 0 15px 0;
  font-style: italic;
  color: var(--text-primary);
  max-height: 80px; /* Limit height */
  overflow-y: auto; /* Add scroll if text too long */
}

.scan-instruction {
  text-align: center;
  margin-top: 20px;
  font-weight: 500;
  color: var(--accent-secondary);
}

/* QR Code Mockup Styling */
.qr-mockup-container {
  position: relative;
  display: inline-block;
}

.mockup-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(0, 0, 0, 0.4);
  color: white;
  font-size: 2rem;
  font-weight: bold;
  letter-spacing: 2px;
  transform: rotate(-30deg);
  pointer-events: none;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
}

/* --- Responsive Adjustments --- */
@media (max-width: 992px) {
  .app-header {
    flex-direction: column;
    gap: 10px;
    padding: 15px 20px;
  }
  .header-controls {
    flex-wrap: wrap;
    justify-content: center;
  }
}

@media (max-width: 768px) {
  body {
    overflow-y: scroll; /* Ensure scroll is on */
  }
  .container {
    padding: 15px;
  }
  .status-display {
    padding: 10px 20px;
    gap: 15px;
    margin: 20px auto 30px auto;
  }
  .status-item {
    font-size: 1.5em;
  }
  .status-separator {
    font-size: 1.3em;
  }
  #opinions-container {
    gap: 15px;
  }
  .opinion-card {
    padding: 20px;
  }
  .opinion-card.top-opinion {
    padding: 25px;
  }
  .history-view .opinion-card.top-opinion .opinion-text {
    font-size: 1.3em;
  }
  #post-opinion-btn {
    width: 55px;
    height: 55px;
    font-size: 2em;
    bottom: 75px;
    right: 20px;
  }
  .modal-content {
    width: 90%;
    padding: 25px;
  }
  .qr-modal .qr-modal-content {
    max-width: 90%;
    padding: 25px;
  }
  #qr-code-display-area img {
    width: 160px;
    height: 160px;
  }
}

@media (max-width: 480px) {
  .header-controls {
    gap: 8px;
  }
  .header-button {
    padding: 5px 10px;
    font-size: 0.85em;
  }
  .status-display {
    padding: 8px 15px;
    gap: 10px;
    margin: 15px auto 25px auto;
  }
  .status-item {
    font-size: 1.3em;
  }
  .status-separator {
    font-size: 1.1em;
  }
  .token-select {
    gap: 8px;
  }
  .token-select label {
    padding: 8px 10px;
    font-size: 0.9em;
  }
  .ticker-item {
    margin-right: 40px;
    font-size: 0.85em;
  }
}

/* Ensure immediate interactivity */
body.ready * {
  animation-delay: 0ms !important;
  transition-delay: 0ms !important;
}

/* Ensure all buttons are immediately clickable */
button,
.header-button,
#refresh-btn,
.support-button,
#post-opinion-btn,
#submit-opinion-btn,
.close-btn {
  pointer-events: auto !important;
}

/* Стили для режима истории */
.history-view .status-display {
  flex-direction: row;
  justify-content: center;
}

.history-view #timer,
.history-view .status-separator {
  display: none;
}

.history-view #balance {
  font-size: 2em;
}

.history-view .status-display::before {
  content: "Total: ";
  font-size: 1.2em;
  color: var(--text-secondary);
  margin-right: 8px;
}

/* Стили для топового мнения в истории */
.history-view .top-opinion {
  grid-column: 1 / -1;
  background-color: var(--bg-secondary);
  border: 2px solid var(--accent-primary);
  border-radius: var(--border-radius-large);
  padding: 35px;
  margin-bottom: 20px;
  text-align: center;
  position: relative;
}

.history-view .top-opinion::before {
  content: "TOP OPINION";
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--accent-primary);
  color: white;
  padding: 4px 16px;
  border-radius: var(--border-radius-medium);
  font-weight: 600;
  font-size: 0.9em;
}

.history-view .top-opinion .opinion-text {
  font-size: 1.5em;
  margin: 25px 0;
  font-weight: 500;
}

.history-view .top-opinion .opinion-amount {
  font-size: 1.2em;
  padding: 6px 16px;
}

/* Стили для остальных мнений в истории */
.history-view #opinions-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.history-view .opinion-rank,
.history-view .opinion-amount,
.history-view .opinion-time {
  display: inline-block;
}

.history-view .opinion-footer {
  justify-content: space-between;
}
