* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

input,
textarea {
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
  user-select: text;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  margin: 0;
  padding: 0;
  background: var(--tg-theme-bg-color, #ffffff);
  color: var(--tg-theme-text-color, #000000);
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}

.container {
  max-width: 560px;
  margin: 0 auto;
  padding: 20px;
}

.card {
  background: var(--tg-theme-secondary-bg-color, #f4f4f5);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.no-bg .card,
body.no-bg {
  background: transparent;
  box-shadow: none;
}

.title {
  font-size: 28px;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--tg-theme-text-color, #000000);
}

.subtitle {
  font-size: 15px;
  color: var(--tg-theme-hint-color, #999999);
  margin-bottom: 24px;
}

h1 {
  margin: 0 0 12px;
  font-size: 24px;
  font-weight: 600;
  color: var(--tg-theme-text-color, #000000);
}

.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  margin-right: 8px;
}

.badge-admin {
  background: var(--tg-theme-destructive-text-color, #e74c3c);
  color: #ffffff;
}

.badge-user {
  background: var(--tg-theme-button-color, #3390ec);
  color: var(--tg-theme-button-text-color, #ffffff);
}

.form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.label {
  font-size: 14px;
  font-weight: 500;
  color: var(--tg-theme-text-color, #000000);
}

.required {
  color: var(--tg-theme-destructive-text-color, #e74c3c);
}

.input {
  width: 100%;
  padding: 12px 16px;
  font-size: 16px;
  border: 1px solid var(--tg-theme-hint-color, rgba(0, 0, 0, 0.1));
  border-radius: 12px;
  background: var(--tg-theme-bg-color, #ffffff);
  color: var(--tg-theme-text-color, #000000);
  outline: none;
  transition: all 0.2s;
}

.input:focus {
  border-color: var(--tg-theme-button-color, #3390ec);
}

.input::placeholder {
  color: var(--tg-theme-hint-color, #999999);
}

.btn {
  width: 100%;
  padding: 14px 24px;
  font-size: 16px;
  font-weight: 600;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  outline: none;
}

.btn-primary {
  background: var(--tg-theme-button-color, #3390ec);
  color: var(--tg-theme-button-text-color, #ffffff);
}

.btn-primary:hover {
  opacity: 0.9;
}

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

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Admin Panel Styles */
.giveaway-grid {
  display: grid;
  gap: 16px;
  margin-bottom: 80px;
}

.giveaway-card {
  background: var(--tg-theme-secondary-bg-color, #f4f4f5);
  border-radius: 12px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  min-width: 0;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.giveaway-card:active {
  transform: scale(0.98);
}

.giveaway-card-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--tg-theme-text-color, #000000);
  word-wrap: break-word;
  overflow-wrap: break-word;
  padding-right: 80px;
}

.giveaway-card-desc {
  font-size: 14px;
  color: var(--tg-theme-hint-color, #999999);
  margin-bottom: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 20px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  max-height: 40px;
}

.giveaway-card-info {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--tg-theme-hint-color, #999999);
}

.info-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.info-item svg {
  width: 16px;
  height: 16px;
  color: var(--tg-theme-hint-color, #999999);
}

.giveaway-card-note {
  font-size: 12px;
  color: var(--tg-theme-destructive-text-color, #e74c3c);
  font-style: italic;
}

.fab {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--tg-theme-button-color, #3390ec);
  color: var(--tg-theme-button-text-color, #ffffff);
  border: none;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fab:active {
  transform: scale(0.95);
}

.prize-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

.prize-item {
  display: flex;
  gap: 12px;
  align-items: center;
}

.prize-item input {
  flex: 1;
}

.prize-item input:last-child {
  flex: 0 0 80px;
}

.btn-remove {
  background: var(--tg-theme-destructive-text-color, #e74c3c);
  color: #ffffff;
  padding: 8px 12px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}

.btn-secondary {
  background: var(--tg-theme-secondary-bg-color, #f4f4f5);
  color: var(--tg-theme-text-color, #000000);
}

.btn-group {
  display: flex;
  gap: 12px;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 16px 20px;
  background: var(--tg-theme-bg-color, #ffffff);
  border-top: 1px solid var(--tg-theme-hint-color, rgba(0, 0, 0, 0.1));
  z-index: 100;
  max-width: 560px;
  margin: 0 auto;
}

.btn-group .btn {
  flex: 1;
}

.container>.form,
.tab-content .form {
  padding-bottom: 80px;
}

.btn-add {
  background: transparent;
  color: var(--tg-theme-button-color, #3390ec);
  border: 1px dashed var(--tg-theme-button-color, #3390ec);
  padding: 12px;
  margin-top: 8px;
}

textarea.input {
  min-height: 80px;
  resize: vertical;
  font-family: inherit;
}

#description.input {
  min-height: 150px;
}

.welcome-text {
  text-align: center;
  padding: 40px 20px;
}

.welcome-text h1 {
  font-size: 32px;
  margin-bottom: 16px;
}

.welcome-text p {
  font-size: 16px;
  color: var(--tg-theme-hint-color, #999999);
}

.card-actions {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 8px;
  z-index: 10;
}

.action-btn {
  background: transparent;
  border: none;
  border-radius: 8px;
  padding: 6px;
  cursor: pointer;
  line-height: 1;
  transition: opacity 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.action-btn:active {
  opacity: 0.6;
}

.action-btn svg {
  display: block;
}

.delete-btn {
  color: var(--tg-theme-hint-color, #999999);
}

.visibility-btn {
  color: var(--tg-theme-hint-color, #999999);
}

.visibility-btn svg {
  width: 18px;
  height: 18px;
}

.giveaway-hidden {
  opacity: 0.5;
}

.giveaway-hidden .giveaway-card-title,
.giveaway-hidden .giveaway-card-desc {
  color: var(--tg-theme-hint-color, #999999);
}

.giveaway-detail {
  padding: 20px;
}

.detail-section {
  margin-bottom: 20px;
}

.detail-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--tg-theme-text-color, #000000);
  margin-bottom: 8px;
}

.detail-value {
  font-size: 16px;
  color: var(--tg-theme-text-color, #000000);
}

.detail-value-box {
  font-size: 15px;
  color: var(--tg-theme-text-color, #000000);
  background: var(--tg-theme-secondary-bg-color, #f4f4f5);
  padding: 14px 16px;
  border-radius: 10px;
  line-height: 1.5;
}

.prize-list-view {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.prize-list-item {
  background: var(--tg-theme-secondary-bg-color, #f4f4f5);
  padding: 12px;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
}


.user-card {
  cursor: pointer;
}

.user-card .prize-list-view {
  margin-top: 12px;
}


.participating {
  border: 2px solid var(--tg-theme-button-color, #3390ec);
}

.participant-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--tg-theme-button-color, #3390ec);
  color: var(--tg-theme-button-text-color, #ffffff);
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.participate-section {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--tg-theme-hint-color, rgba(0, 0, 0, 0.1));
}

.participants-list {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.participant-item {
  background: var(--tg-theme-secondary-bg-color, #f4f4f5);
  padding: 12px;
  border-radius: 8px;
  font-size: 14px;
}


.card-participate-btn {
  margin-top: 16px;
  width: 100%;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: opacity 0.2s;
  background: var(--tg-theme-button-color, #3390ec);
  color: var(--tg-theme-button-text-color, #ffffff);
}

.participating .card-participate-btn {
  background: var(--tg-theme-secondary-bg-color, #f4f4f5);
  color: var(--tg-theme-text-color, #000000);
}

.card-participate-btn:active {
  opacity: 0.7;
}


.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  justify-content: center;
}

.tab-btn {
  padding: 10px 24px;
  background: var(--tg-theme-secondary-bg-color, #f4f4f5);
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 500;
  color: var(--tg-theme-text-color, #000000);
  cursor: pointer;
  transition: all 0.2s;
}

.tab-btn.active {
  background: var(--tg-theme-button-color, #3390ec);
  color: var(--tg-theme-button-text-color, #ffffff);
}

.tab-btn:active {
  opacity: 0.7;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.participants-header {
  margin-bottom: 16px;
  margin-top: 16px;
  padding-bottom: 12px;
}

.participant-item {
  background: var(--tg-theme-secondary-bg-color, #f4f4f5);
  padding: 14px 16px;
  border-radius: 10px;
  font-size: 14px;
}

.participant-name {
  font-weight: 500;
  color: var(--tg-theme-text-color, #000000);
  margin-bottom: 4px;
}

.participant-username {
  font-size: 13px;
  color: var(--tg-theme-hint-color, #999999);
}


.collapsible-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.collapse-icon {
  width: 16px;
  height: 16px;
  transition: transform 0.2s;
  flex-shrink: 0;
}

.collapse-icon.expanded {
  transform: rotate(90deg);
}

.collapsible-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
}

.collapsible-content.expanded {
  max-height: 2000px;
  transition: max-height 0.5s ease-in;
}


.user-detail-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 24px;
}


.fixed-bottom-btn {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 16px 20px;
  background: var(--tg-theme-bg-color, #ffffff);
  border-top: 1px solid var(--tg-theme-hint-color, rgba(0, 0, 0, 0.1));
  z-index: 100;
  max-width: 560px;
  margin: 0 auto;
}

.fixed-bottom-btn .btn {
  width: 100%;
}


.participant-item {
  background: var(--tg-theme-secondary-bg-color, #f4f4f5);
  padding: 14px 16px;
  border-radius: 10px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.participant-info-btn {
  background: transparent;
  border: none;
  padding: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--tg-theme-hint-color, #999999);
  flex-shrink: 0;
}

.participant-info-btn svg {
  width: 20px;
  height: 20px;
}

.participant-info-btn:active {
  opacity: 0.6;
}

.participant-content {
  flex: 1;
}

.participant-username {
  cursor: pointer;
  color: var(--tg-theme-link-color, #3390ec);
  margin-top: 4px;
}

.participant-username:hover {
  text-decoration: underline;
}

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-content {
  background: var(--tg-theme-bg-color, #ffffff);
  border-radius: 16px;
  max-width: 400px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
}

.modal-header h2 {
  font-size: 20px;
  font-weight: 600;
  margin: 0;
  color: var(--tg-theme-text-color, #000000);
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
  color: var(--tg-theme-hint-color, #999999);
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:active {
  opacity: 0.6;
}

.modal-body {
  padding: 0 20px 20px 20px;
}

.modal-info-item {
  margin-bottom: 16px;
}

.modal-info-item:last-child {
  margin-bottom: 0;
}

.modal-info-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--tg-theme-hint-color, #999999);
  margin-bottom: 6px;
}

.modal-info-value {
  font-size: 16px;
  color: var(--tg-theme-text-color, #000000);
  background: var(--tg-theme-secondary-bg-color, #f4f4f5);
  padding: 12px 14px;
  border-radius: 10px;
}


.questions-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 12px;
}


.btn-type-toggle {
  background: var(--tg-theme-button-color, #3390ec);
  color: var(--tg-theme-button-text-color, #ffffff);
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
  min-width: 50px;
}

.btn-type-toggle:active {
  opacity: 0.7;
}


/* Draw winners modal */
.draw-modal-content {
  max-width: 500px;
  width: 90%;
}

.draw-prize-item {
  background: var(--tg-theme-secondary-bg-color, #f4f4f5);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
}

.draw-prize-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--tg-theme-text-color, #000000);
  margin-bottom: 12px;
}

.draw-prize-winners {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.draw-winner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--tg-theme-bg-color, #ffffff);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
}

.winner-name {
  color: var(--tg-theme-text-color, #000000);
  font-weight: 500;
}

.winner-username {
  color: var(--tg-theme-link-color, #3390ec);
  font-size: 13px;
}

.draw-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}

.draw-btn {
  width: 100%;
  margin-top: 16px;
  background: var(--tg-theme-button-color, #3390ec);
  color: var(--tg-theme-button-text-color, #ffffff);
  border: none;
  border-radius: 12px;
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.draw-btn:hover:not(:disabled) {
  opacity: 0.9;
}

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




/* Settings button */
.header-with-settings {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.header-with-settings .title {
  margin: 0;
}

.settings-btn {
  background: transparent;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  padding: 0;
}

.settings-btn svg {
  width: 20px;
  height: 20px;
  color: var(--tg-theme-text-color, #000000);
}

.settings-btn:active {
  transform: scale(0.95);
  opacity: 0.7;
}

/* Spinner animation for loading states */
@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}