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

:root {
  --primary-color: #FF6700; /* Xiaomi Orange */
  --primary-color-dark: #E05A00;
  --background: #f8f9fa; /* Lighter, simpler background */
  --surface: #ffffff;
  --text-primary: #212529; /* Darker, more readable text */
  --text-secondary: #6c757d;
  --text-muted: #adb5bd;
  --success: #28a745; /* Standard green for success */
  --error: #dc3545;   /* Standard red for error */
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --border-radius: 12px;
  --border-radius-sm: 8px;
  --border-color: #dee2e6;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--background);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

.background-pattern {
  display: none; /* Removed distracting background pattern for simplicity */
}

.container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.main-card {
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 3rem;
  box-shadow: var(--shadow-lg);
  max-width: 650px;
  width: 100%;
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.3s ease;
}

.progress-container {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: #e9ecef;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.progress-container.active {
  opacity: 1;
}

.progress-bar {
  height: 100%;
  background-color: var(--primary-color);
  width: 0;
  transition: width 0.3s ease;
}

.header {
  text-align: center;
  margin-bottom: 2.5rem;
}

h1 {
  font-size: 2.5rem; /* Slightly smaller for a more official feel */
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

.subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
  font-weight: 400;
}

.info-section {
  padding: 1.5rem 0; /* Rely on padding for spacing */
  margin-bottom: 2.5rem;
}

.info-section h2 {
  color: var(--text-primary);
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.info-section p {
  color: var(--text-secondary);
  line-height: 1.7;
  font-size: 1rem;
}

.info-section a {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s ease;
}

.info-section a:hover {
  color: var(--primary-color-dark);
  text-decoration: underline;
}

.input-group {
  margin-bottom: 1.5rem;
}

.input-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.input-label {
  font-weight: 500;
  font-size: 1rem;
  color: var(--text-primary);
}

.help-button {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.3s ease;
}

.help-button:hover {
  color: var(--primary-color);
  text-decoration: underline;
}

.input-container {
  position: relative;
}

textarea {
  width: 100%;
  min-height: 140px;
  padding: 1rem;
  font-size: 0.95rem;
  background-color: #fff;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  color: var(--text-primary);
  resize: vertical;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(255, 103, 0, 0.15);
}

textarea::placeholder {
  color: var(--text-muted);
}

.verify-button {
  width: 100%;
  padding: 1rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  color: white;
  background-color: var(--primary-color);
  border: 1px solid var(--primary-color);
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: background-color 0.3s ease, border-color 0.3s ease, transform 0.2s ease;
}

.verify-button:hover:not(:disabled) {
  background-color: var(--primary-color-dark);
  border-color: var(--primary-color-dark);
  transform: translateY(-1px);
}

.verify-button:disabled {
  background-color: #ced4da;
  border-color: #ced4da;
  cursor: not-allowed;
}

.verify-button.loading {
  opacity: 0.8;
}

.button-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.loading-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top: 2px solid white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: none;
}

.verify-button.loading .loading-spinner {
  display: block;
}

.verify-button.loading .button-text {
  display: inline;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

#result {
  margin-top: 2rem;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
  overflow: hidden;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.4s ease;
}

#result.show {
  opacity: 1;
  transform: translateY(0);
}

.result-content {
  padding: 1.5rem;
}

#result.success .result-content {
  border-left: 4px solid var(--success);
}

#result.error .result-content {
  border-left: 4px solid var(--error);
}

.result-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

#result.success .result-title {
  color: #155724; /* Dark green text */
}

#result.error .result-title {
  color: #721c24; /* Dark red text */
}

.result-item {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border-color);
}

.result-content > .result-item:first-child {
  padding-top: 0;
}

.result-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.result-label {
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.result-value {
  font-size: 1rem;
  font-weight: 500;
  word-break: break-all;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-primary);
}

.result-value.region {
  font-size: 1.2rem;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
}

.region-global {
  color: var(--success);
}

.region-china {
  color: var(--error);
}



.help-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease;
}

.help-modal.show {
  opacity: 1;
  visibility: visible;
}

.help-content {
  background: var(--surface);
  border-radius: var(--border-radius);
  padding: 2.5rem;
  max-width: 500px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  transform: scale(0.95);
  transition: transform 0.3s ease;
}

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

.help-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1rem;
  text-align: center;
}

.help-text {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  line-height: 1.6;
  text-align: center;
}

.help-commands {
  text-align: left;
  margin-bottom: 1.5rem;
}

.help-command {
  background: #f8f9fa;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 1rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  cursor: pointer;
  transition: border-color 0.3s ease, background-color 0.3s ease;
}

.help-command:hover {
  background-color: #e9ecef;
  border-color: #adb5bd;
}

.close-button {
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: var(--border-radius-sm);
  padding: 0.75rem 1.5rem;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.3s ease;
  display: block;
  width: 100%;
  margin-top: 1rem;
}

.close-button:hover {
  background-color: var(--primary-color-dark);
}

@media (max-width: 768px) {
  .container {
    padding: 1rem;
  }

  .main-card {
    padding: 2rem;
  }

  h1 {
    font-size: 2.25rem;
  }
}

@media (max-width: 480px) {
  .main-card {
    padding: 1.5rem;
  }

  h1 {
    font-size: 2rem;
  }
}

@font-face {
  font-family: 'JetBrains Mono';
  src: url('https://raw.githubusercontent.com/JetBrains/JetBrainsMono/master/web/eot/JetBrainsMono-Regular.eot') format('embedded-opentype'),
       url('https://raw.githubusercontent.com/JetBrains/JetBrainsMono/master/web/woff2/JetBrainsMono-Regular.woff2') format('woff2'),
       url('https://raw.githubusercontent.com/JetBrains/JetBrainsMono/master/web/woff/JetBrainsMono-Regular.woff') format('woff');
  font-weight: normal;
  font-style: normal;
}

.site-footer {
  text-align: center;
  padding: 2rem 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.site-footer a {
  color: var(--primary-color);
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}
