* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* Override Telegram scrollbar styles */
*::-webkit-scrollbar {
  width: 4px !important;
  height: 4px !important;
}

*::-webkit-scrollbar-track {
  background: transparent !important;
}

*::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2) !important;
  border-radius: 2px !important;
}

*::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3) !important;
}

html, body, * {
  scrollbar-width: thin !important;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent !important;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background-color: #0d0d0f;
  color: #ffffff;
  overflow-x: hidden;
}

body.modal-open {
  overflow: hidden !important;
  position: fixed !important;
  width: 100% !important;
  height: 100% !important;
  top: 0 !important;
  left: 0 !important;
  touch-action: none !important;
}

.app {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Grid Background */
.grid-background {
  position: absolute;
  inset: 0;
  opacity: 0.3;
  background-image: 
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

/* Glow Effect */
.glow-effect {
  position: absolute;
  top: 25%;
  left: 50%;
  transform: translateX(-50%);
  width: 400px;
  height: 400px;
  background: rgba(249, 115, 22, 0.1);
  border-radius: 50%;
  filter: blur(100px);
  pointer-events: none;
}

/* Content */
.content {
  position: relative;
  z-index: 10;
  max-width: 400px;
  width: 100%;
  margin: 0 auto;
  padding: clamp(16px, 3vh, 24px) clamp(28px, 7vw, 40px);
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-top: clamp(4px, 1vh, 8px);
  margin-bottom: clamp(8px, 2vh, 16px);
  flex-shrink: 0;
}

.user-info {
  display: flex;
  flex-direction: column;
}

.username {
  font-size: 18px;
  font-weight: 600;
  color: #ffffff;
}

.status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-dot.online {
  background-color: #22c55e;
}

.status-dot.offline {
  background-color: #6b7280;
}

.status-text {
  font-size: 14px;
  color: #9ca3af;
}

.subscription-info {
  text-align: right;
}

.subscription-label {
  font-size: 11px;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.subscription-date {
  font-size: 18px;
  font-weight: 600;
  color: #ffffff;
}

.subscription-status {
  font-size: 12px;
  color: #f97316;
  font-weight: 500;
}

/* Main Section (Circle + Traffic) */
.main-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 0;
}

/* Circular Progress */
.progress-container {
  display: flex;
  justify-content: center;
  position: relative;
  width: clamp(140px, 30vh, 200px);
  height: clamp(140px, 30vh, 200px);
  flex-shrink: 1;
}

.progress-ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.progress-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.1);
  stroke-width: 8;
}

.progress-bar {
  fill: none;
  stroke: url(#gradient);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 565.48;
  stroke-dashoffset: 565.48;
  transition: stroke-dashoffset 1s ease-out;
}

.progress-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.days-count {
  font-size: clamp(24px, 5vh, 32px);
  font-weight: 700;
  color: #ffffff;
}

.days-label {
  font-size: clamp(11px, 2vh, 14px);
  color: #9ca3af;
}

/* Cards */
.card {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  border-radius: 14px;
  padding: clamp(10px, 1.5vh, 14px) 14px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  margin-bottom: clamp(8px, 1.5vh, 12px);
  flex-shrink: 0;
}

/* Traffic Info */
.traffic-info {
  margin-top: clamp(16px, 3vh, 24px);
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
}

.traffic-value {
  font-size: 15px;
  font-weight: 500;
  color: #ffffff;
}

.traffic-label {
  font-size: 14px;
  color: #6b7280;
}

/* Buttons */
.btn {
  width: 100%;
  padding: clamp(14px, 2.2vh, 18px) 18px;
  border-radius: 16px;
  font-size: clamp(14px, 2vh, 15px);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: none;
  margin-bottom: clamp(10px, 1.8vh, 14px);
  flex-shrink: 0;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: linear-gradient(to right, #f97316, #ea580c);
  color: #ffffff;
}

.btn-primary:hover {
  background: linear-gradient(to right, #ea580c, #dc2626);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-left svg {
  width: 22px;
  height: 22px;
}

.btn-right {
  color: rgba(255, 255, 255, 0.8);
}

.btn-badge {
  background: rgba(255, 255, 255, 0.1);
  padding: 4px 12px;
  border-radius: 8px;
  font-size: 14px;
}

/* Bottom Actions Container */
.bottom-actions {
  margin-top: 0;
  padding-bottom: clamp(12px, 2vh, 20px);
  flex-shrink: 0;
}

/* Button Grid */
.btn-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  flex-shrink: 0;
}

.btn-small {
  justify-content: center;
  gap: 10px;
  padding: clamp(16px, 2.5vh, 20px) 18px;
  margin-bottom: 0;
}

.btn-small svg {
  width: 22px;
  height: 22px;
  color: #9ca3af;
}

/* ==================== */
/* Register Page Styles */
/* ==================== */

.register-header {
  text-align: center;
  margin-bottom: clamp(24px, 4vh, 40px);
  padding-top: clamp(20px, 4vh, 40px);
}

.register-title {
  font-size: clamp(24px, 4vh, 32px);
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 8px;
}

.register-subtitle {
  font-size: 14px;
  color: #6b7280;
}

.register-form {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Input Groups */
.input-group {
  margin-bottom: 20px;
}

.input-label {
  display: block;
  font-size: 13px;
  color: #9ca3af;
  margin-bottom: 8px;
}

.input-hint {
  color: #6b7280;
  font-weight: 400;
}

.input-wrapper {
  display: flex;
  gap: 10px;
}

.input-field {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 15px;
  color: #ffffff;
  outline: none;
  transition: border-color 0.2s ease;
}

.input-field::placeholder {
  color: #6b7280;
}

.input-field:focus {
  border-color: #f97316;
}

.input-field-full {
  width: 100%;
}

.input-btn {
  width: 50px;
  height: 50px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.input-btn:active {
  transform: scale(0.95);
}

.input-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.input-btn svg {
  width: 20px;
  height: 20px;
  color: #f97316;
}

/* Checkboxes */
.checkbox-group {
  margin-bottom: 24px;
}

.checkbox-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
  cursor: pointer;
}

.checkbox-item input[type="checkbox"] {
  display: none;
}

.checkbox-custom {
  width: 22px;
  height: 22px;
  min-width: 22px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  margin-top: 1px;
}

.checkbox-item input[type="checkbox"]:checked + .checkbox-custom {
  background: #f97316;
  border-color: #f97316;
}

.checkbox-item input[type="checkbox"]:checked + .checkbox-custom::after {
  content: '';
  width: 6px;
  height: 10px;
  border: solid #ffffff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-bottom: 2px;
}

.checkbox-text {
  font-size: 14px;
  color: #9ca3af;
  line-height: 1.5;
}

.link-btn {
  background: none;
  border: none;
  color: #f97316;
  font-size: 14px;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.link-btn:hover {
  color: #fb923c;
}

/* Register Button */
.btn-register {
  margin-top: auto;
  margin-bottom: clamp(16px, 3vh, 24px);
  justify-content: center;
}

.btn-register:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Bottom Sheet */
.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 100;
  touch-action: none;
  overscroll-behavior: contain;
}

.sheet-overlay.active {
  opacity: 1;
  visibility: visible;
}

.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 75vh;
  background: #1a1a1d;
  border-radius: 20px 20px 0 0;
  transform: translateY(100%);
  transition: transform 0.3s ease;
  z-index: 101;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  overscroll-behavior: contain;
}

.bottom-sheet.active {
  transform: translateY(0);
}

.sheet-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
  touch-action: none;
  overscroll-behavior: contain;
}

.sheet-title {
  font-size: 18px;
  font-weight: 600;
  color: #ffffff;
  text-align: center;
}

.sheet-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  color: #d1d5db;
  font-size: 14px;
  line-height: 1.7;
  min-height: 0;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.sheet-content h3 {
  font-size: 15px;
  font-weight: 600;
  color: #ffffff;
  margin-top: 20px;
  margin-bottom: 10px;
}

.sheet-content h3:first-child {
  margin-top: 0;
}

.sheet-content p {
  margin-bottom: 12px;
}

.sheet-content ul {
  margin-bottom: 12px;
  padding-left: 20px;
}

.sheet-content li {
  margin-bottom: 6px;
}

.sheet-footer {
  padding: 16px 24px;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  flex-shrink: 0;
  background: #1a1a1d;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.sheet-close-btn {
  margin: 0;
  justify-content: center;
}

/* Responsive - very small heights */
@media (max-height: 500px) {
  .progress-container {
    width: 120px;
    height: 120px;
  }
  
  .header {
    margin-bottom: 6px;
  }
  
  .username {
    font-size: 16px;
  }
  
  .subscription-date {
    font-size: 16px;
  }
}
