* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto',
    sans-serif;
  background: linear-gradient(135deg, #2196f3 0%, #1976d2 100%);
  min-height: 100vh;
  color: #333;
  overflow-x: hidden;
}

.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: #0d47a1;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  padding: 0;
}

.nav-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: white;
  font-size: 20px;
  font-weight: 600;
}

.nav-brand i {
  font-size: 24px;
}

.language-switcher {
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.15);
  padding: 4px;
  border-radius: 8px;
}

.lang-btn {
  background: transparent;
  border: 2px solid transparent;
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lang-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
}

.lang-btn.active {
  background: white;
  border-color: white;
}

.flag-icon {
  width: 32px;
  height: 24px;
  object-fit: cover;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.view-controls {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1100;
  display: inline-flex;
  gap: 6px;
  background: white;
  padding: 8px;
  border-radius: 50px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
  align-items: center;
}

.view-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: #f5f5f5;
  color: #424242;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-size: 18px;
}

.view-btn:hover:not(:disabled) {
  background: #e3f2fd;
  color: #2196f3;
}

.view-btn:active:not(:disabled) {
  transform: scale(0.95);
}

.view-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.view-label {
  padding: 0 20px;
  height: 40px;
  border: none;
  border-radius: 50px;
  background: #2196f3;
  color: white;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 70px;
}

.view-label:hover {
  background: #1976d2;
}

.zoomable-content {
  padding-top: 70px;
  padding-bottom: 80px;
  transition: transform 0.3s ease;
  width: 100%;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

.header {
  background: white;
  border-radius: 15px;
  padding: 25px;
  margin-bottom: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

h1 {
  font-size: 32px;
  color: #2d3748;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-bottom: 20px;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.control-group label {
  font-weight: 600;
  color: #4a5568;
  font-size: 14px;
}

select,
button {
  padding: 12px 20px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
}

select {
  background: white;
  color: #2d3748;
}

select:hover:not(:disabled) {
  border-color: #2196f3;
}

select:focus {
  outline: none;
  border-color: #1976d2;
  box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

select:disabled {
  background: #f7fafc;
  cursor: not-allowed;
  opacity: 0.5;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 15px;
  margin-top: 20px;
}

.stat-card {
  background: linear-gradient(135deg, #2196f3 0%, #1976d2 100%);
  padding: 15px;
  border-radius: 10px;
  text-align: center;
  color: white;
  transition: all 0.3s ease;
}

.stat-card.warning {
  background: linear-gradient(135deg, #f44336 0%, #e53935 100%);
  animation: pulse 1s infinite;
}

.stat-label {
  font-size: 14px;
  opacity: 0.9;
  margin-bottom: 5px;
}

.stat-value {
  font-size: 28px;
  font-weight: bold;
}

.game-area {
  background: white;
  border-radius: 15px;
  padding: 30px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  margin-bottom: 20px;
}

.table-container {
  overflow-x: auto;
  margin: 20px 0;
}

table {
  border-collapse: separate;
  border-spacing: 0;
  margin: 0 auto;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  overflow: hidden;
}

th,
td {
  border: 2px solid #e2e8f0;
  min-width: 80px;
  height: 70px;
  font-size: 20px;
  text-align: center;
  padding: 10px;
}

th {
  background: linear-gradient(135deg, #2196f3 0%, #1976d2 100%);
  color: white;
  font-weight: 600;
}

td {
  background: white;
}

input {
  width: 100%;
  height: 50px;
  font-size: 20px;
  text-align: center;
  border: 2px solid #cbd5e0;
  border-radius: 8px;
  transition: all 0.3s ease;
  font-weight: 600;
}

input:focus {
  outline: none;
  border-color: #2196f3;
  box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

input:disabled {
  background: #f7fafc;
  cursor: not-allowed;
  opacity: 0.6;
}

input.correct {
  background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
  color: white;
  border-color: #4caf50;
  animation: correctAnim 0.5s ease;
}

input.wrong {
  background: linear-gradient(135deg, #f44336 0%, #e53935 100%);
  color: white;
  border-color: #f44336;
  animation: wrongAnim 0.5s ease;
}

@keyframes correctAnim {
  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.05);
  }
}

@keyframes wrongAnim {
  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-5px);
  }

  75% {
    transform: translateX(5px);
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.85;
  }
}

.button-group {
  display: flex;
  gap: 15px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 20px;
}

button {
  background: linear-gradient(135deg, #2196f3 0%, #1976d2 100%);
  color: white;
  border: none;
  padding: 15px 40px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(33, 150, 243, 0.4);
  display: flex;
  align-items: center;
  gap: 8px;
}

button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(33, 150, 243, 0.5);
}

button:active:not(:disabled) {
  transform: translateY(0);
}

button:disabled {
  background: #cbd5e0;
  cursor: not-allowed;
  opacity: 0.6;
  box-shadow: none;
}

button.secondary {
  background: linear-gradient(135deg, #00bcd4 0%, #0097a7 100%);
  box-shadow: 0 4px 15px rgba(0, 188, 212, 0.4);
}

button.secondary:hover:not(:disabled) {
  box-shadow: 0 6px 20px rgba(0, 188, 212, 0.5);
}

.result-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  padding: 10px;
}

.result-modal.active {
  display: flex;
}

.result-content {
  background: white;
  padding: 40px;
  border-radius: 20px;
  text-align: center;
  max-width: 500px;
  width: 100%;
  margin: 20px;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.result-content h2 {
  font-size: 36px;
  margin-bottom: 20px;
  color: #2d3748;
}

.result-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
}

.result-stats {
  background: #f7fafc;
  padding: 20px;
  border-radius: 10px;
  margin: 20px 0;
}

.result-stats p {
  font-size: 18px;
  margin: 10px 0;
  color: #4a5568;
}

.difficulty-badge {
  display: inline-block;
  padding: 5px 15px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  margin-top: 10px;
}

.difficulty-badge.oson {
  background: #c6f6d5;
  color: #22543d;
}

.difficulty-badge.orta {
  background: #feebc8;
  color: #7c2d12;
}

.difficulty-badge.qiyin {
  background: #fed7d7;
  color: #742a2a;
}

.time-up-message {
  background: #fff3cd;
  border: 2px solid #ffc107;
  padding: 15px;
  border-radius: 10px;
  margin-bottom: 15px;
  color: #856404;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

@media (max-width: 480px) {
  .navbar {
    padding: 0;
  }

  .nav-container {
    padding: 10px 15px;
  }

  .nav-brand {
    font-size: 16px;
  }

  .nav-brand i {
    font-size: 20px;
  }

  .flag-icon {
    width: 28px;
    height: 21px;
  }

  .lang-btn {
    padding: 3px 6px;
  }

  .view-controls {
    bottom: 15px;
    gap: 5px;
    padding: 6px;
  }

  .view-btn {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }

  .view-label {
    height: 36px;
    padding: 0 16px;
    font-size: 13px;
    min-width: 60px;
  }

  .zoomable-content {
    padding-top: 60px;
    padding-bottom: 70px;
  }

  .container {
    padding: 10px;
  }

  .header {
    padding: 15px;
    border-radius: 10px;
  }

  h1 {
    font-size: 20px;
    gap: 8px;
  }

  h1 svg {
    width: 28px;
    height: 28px;
  }

  .controls {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  select,
  button {
    padding: 10px 15px;
    font-size: 14px;
  }

  .stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .stat-card {
    padding: 12px;
  }

  .stat-label {
    font-size: 12px;
  }

  .stat-value {
    font-size: 22px;
  }

  .game-area {
    padding: 15px;
    border-radius: 10px;
  }

  th,
  td {
    min-width: 55px;
    height: 55px;
    font-size: 16px;
    padding: 5px;
  }

  input {
    height: 42px;
    font-size: 16px;
  }

  button {
    padding: 10px 20px;
    font-size: 14px;
  }

  button svg {
    width: 16px;
    height: 16px;
  }

  .result-content {
    padding: 25px;
  }

  .result-content h2 {
    font-size: 26px;
  }

  .result-icon {
    width: 60px;
    height: 60px;
  }

  .result-stats {
    padding: 15px;
  }

  .result-stats p {
    font-size: 15px;
  }
}

@media (min-width: 481px) and (max-width: 768px) {
  .nav-container {
    padding: 12px 18px;
  }

  .nav-brand {
    font-size: 18px;
  }

  .view-controls {
    bottom: 18px;
    gap: 5px;
    padding: 7px;
  }

  .view-btn {
    width: 38px;
    height: 38px;
    font-size: 17px;
  }

  .view-label {
    height: 38px;
    padding: 0 18px;
    min-width: 65px;
  }

  .zoomable-content {
    padding-top: 65px;
    padding-bottom: 75px;
  }

  .container {
    padding: 15px;
  }

  .header {
    padding: 20px;
  }

  h1 {
    font-size: 26px;
  }

  h1 svg {
    width: 35px;
    height: 35px;
  }

  .controls {
    grid-template-columns: 1fr;
  }

  .stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .stat-value {
    font-size: 26px;
  }

  .game-area {
    padding: 20px;
  }

  th,
  td {
    min-width: 65px;
    height: 60px;
    font-size: 18px;
  }

  input {
    height: 45px;
    font-size: 18px;
  }

  button {
    padding: 12px 30px;
    font-size: 15px;
  }

  .result-content {
    padding: 30px;
  }

  .result-content h2 {
    font-size: 30px;
  }

  .result-icon {
    width: 70px;
    height: 70px;
  }

  .result-stats p {
    font-size: 16px;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .container {
    max-width: 95%;
  }

  h1 {
    font-size: 28px;
  }

  .controls {
    grid-template-columns: repeat(3, 1fr);
  }

  .stats {
    grid-template-columns: repeat(4, 1fr);
  }

  th,
  td {
    min-width: 75px;
    height: 65px;
    font-size: 19px;
  }

  input {
    height: 48px;
    font-size: 19px;
  }
}

@media (min-width: 1025px) and (max-width: 1440px) {
  .container {
    max-width: 1200px;
  }

  h1 {
    font-size: 30px;
  }

  .controls {
    grid-template-columns: repeat(3, 1fr);
  }

  th,
  td {
    min-width: 85px;
    height: 70px;
    font-size: 20px;
  }
}

@media (min-width: 1441px) {
  .container {
    max-width: 1400px;
  }

  h1 {
    font-size: 36px;
  }

  .header {
    padding: 30px;
  }

  .game-area {
    padding: 40px;
  }

  .controls {
    grid-template-columns: repeat(3, 1fr);
  }

  th,
  td {
    min-width: 100px;
    height: 80px;
    font-size: 22px;
  }

  input {
    height: 55px;
    font-size: 22px;
  }

  .stat-value {
    font-size: 32px;
  }

  button {
    padding: 18px 45px;
    font-size: 18px;
  }

  .result-content {
    padding: 50px;
    max-width: 600px;
  }

  .result-content h2 {
    font-size: 40px;
  }

  .result-icon {
    width: 90px;
    height: 90px;
  }

  .result-stats p {
    font-size: 20px;
  }
}

@media (orientation: landscape) and (max-height: 600px) {
  .zoomable-content {
    padding-top: 60px;
    padding-bottom: 70px;
  }

  .container {
    padding: 10px;
  }

  .header {
    padding: 15px;
  }

  h1 {
    font-size: 20px;
    margin-bottom: 10px;
  }

  .controls {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 10px;
  }

  .stats {
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-top: 10px;
  }

  .stat-card {
    padding: 8px;
  }

  .stat-label {
    font-size: 11px;
  }

  .stat-value {
    font-size: 18px;
  }

  .game-area {
    padding: 15px;
  }

  th,
  td {
    height: 50px;
    min-width: 60px;
  }

  input {
    height: 38px;
  }

  button {
    padding: 8px 20px;
    font-size: 13px;
  }
}
