/* Trafik Wordle - Clean Wordle Style */

:root {
  --tw-green: #6aaa64;
  --tw-yellow: #c9b458;
  --tw-gray: #787c7e;
  --tw-light-gray: #d3d6da;
  --tw-dark-gray: #86888a;
  --tw-white: #ffffff;
  --tw-black: #1a1a1b;
  --tw-bg: #ffffff;
  --tw-key-bg: #d3d6da;
  --tw-border: #d3d6da;
  --tw-tile-border: #878a8c;
}

.tw-game {
  position: relative;
  overflow: hidden;
  max-width: 500px;
  margin: 0 auto;
  padding: 0 8px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Header */
.tw-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--tw-border);
  margin-bottom: 8px;
}

.tw-header-left,
.tw-header-right {
  width: 70px;
  display: flex;
}

.tw-header-right {
  justify-content: flex-end;
}

.tw-header-center {
  text-align: center;
}

.tw-title {
  font-size: 28px;
  font-weight: 700;
  margin: 0;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--tw-black);
}

.tw-game-number {
  font-size: 12px;
  color: var(--tw-gray);
}

.tw-icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--tw-black);
  opacity: 0.7;
}

.tw-icon-btn:hover {
  opacity: 1;
}

/* Hint */
.tw-hint {
  display: inline-block;
  text-align: center;
  padding: 12px 24px;
  margin: 0 auto 16px;
  font-size: 16px;
  font-weight: 600;
  color: #5c4d3d;
  background: linear-gradient(135deg, #fff9e6 0%, #fff3cd 100%);
  border: 2px solid #ffc107;
  border-radius: 25px;
  box-shadow: 0 2px 8px rgba(255, 193, 7, 0.25);
}

.tw-hint::before {
  content: "💡 ";
}

.tw-hint:empty {
  display: none;
}

.tw-hint-wrapper {
  text-align: center;
}

/* Board */
.tw-board {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  margin-bottom: 24px;
}

.tw-row {
  display: flex;
  gap: 5px;
}

.tw-tile {
  width: 58px;
  height: 58px;
  border: 2px solid var(--tw-light-gray);
  font-size: 32px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
  color: var(--tw-black);
  box-sizing: border-box;
  user-select: none;
}

.tw-tile.tw-filled {
  border-color: var(--tw-tile-border);
  animation: tw-pop 0.1s ease;
}

.tw-tile.tw-correct {
  background: var(--tw-green);
  border-color: var(--tw-green);
  color: var(--tw-white);
}

.tw-tile.tw-present {
  background: var(--tw-yellow);
  border-color: var(--tw-yellow);
  color: var(--tw-white);
}

.tw-tile.tw-absent {
  background: var(--tw-gray);
  border-color: var(--tw-gray);
  color: var(--tw-white);
}

.tw-tile.tw-reveal {
  animation: tw-flip 0.5s ease forwards;
}

@keyframes tw-pop {
  50% { transform: scale(1.1); }
}

@keyframes tw-flip {
  0% { transform: rotateX(0); }
  50% { transform: rotateX(90deg); }
  100% { transform: rotateX(0); }
}

.tw-tile.tw-shake {
  animation: tw-shake 0.5s ease;
}

@keyframes tw-shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-4px); }
  40%, 60% { transform: translateX(4px); }
}

.tw-tile.tw-bounce {
  animation: tw-bounce 0.5s ease;
}

@keyframes tw-bounce {
  0%, 20% { transform: translateY(0); }
  40% { transform: translateY(-20px); }
  50% { transform: translateY(5px); }
  60% { transform: translateY(-10px); }
  80% { transform: translateY(2px); }
  100% { transform: translateY(0); }
}

/* Keyboard */
.tw-keyboard {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  margin-bottom: 16px;
  width: 100%;
  max-width: 500px;
}

.tw-keyboard-row {
  display: flex;
  gap: 4px;
  width: 100%;
  justify-content: center;
}

.tw-key {
  height: 52px;
  flex: 1;
  max-width: 44px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: var(--tw-key-bg);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
  user-select: none;
  color: var(--tw-black);
  display: flex;
  align-items: center;
  justify-content: center;
}

.tw-key:hover {
  opacity: 0.9;
}

.tw-key.tw-key-wide {
  flex: 1.5;
  max-width: 65px;
  font-size: 11px;
}

.tw-key.tw-correct {
  background: var(--tw-green);
  color: var(--tw-white);
}

.tw-key.tw-present {
  background: var(--tw-yellow);
  color: var(--tw-white);
}

.tw-key.tw-absent {
  background: var(--tw-gray);
  color: var(--tw-white);
}

/* Loading */
.tw-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 16px;
}

.tw-loading p {
  color: var(--tw-dark-gray);
  font-size: 15px;
  font-weight: 500;
  margin: 0;
}

.tw-loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--tw-light-gray);
  border-top-color: var(--tw-black);
  border-radius: 50%;
  animation: twSpin 0.7s linear infinite;
}

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

.tw-loading.tw-hidden {
  display: none;
}

/* Message */
.tw-message {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--tw-black);
  color: var(--tw-white);
  padding: 12px 20px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 14px;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.tw-message.tw-show {
  opacity: 1;
}

.tw-message.tw-win {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 50%, #ffd700 100%);
  color: #fff;
  font-size: 18px;
  padding: 16px 32px;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(240, 147, 251, 0.4);
  animation: tw-win-pulse 0.5s ease;
}

@keyframes tw-win-pulse {
  0%, 100% { transform: translateX(-50%) scale(1); }
  50% { transform: translateX(-50%) scale(1.1); }
}

/* Modal */
.tw-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 16px;
}

.tw-modal.tw-open {
  display: flex;
}

.tw-modal-content {
  background: var(--tw-white);
  border-radius: 8px;
  padding: 24px;
  max-width: 400px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}

.tw-modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--tw-gray);
  line-height: 1;
}

.tw-modal h2 {
  margin: 0 0 16px 0;
  font-size: 20px;
  text-align: center;
}

.tw-modal h3 {
  margin: 16px 0 8px 0;
  font-size: 14px;
  text-transform: uppercase;
  text-align: center;
}

/* Help Modal */
.tw-help-examples {
  margin: 16px 0;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--tw-border);
}

.tw-help-row {
  display: flex;
  gap: 5px;
  margin-bottom: 8px;
}

.tw-help-examples .tw-tile {
  width: 40px;
  height: 40px;
  font-size: 20px;
}

.tw-help-examples p {
  margin: 0;
  font-size: 14px;
}

.tw-help-note {
  text-align: center;
  font-size: 13px;
  color: var(--tw-gray);
  margin-top: 16px;
}

/* Stats Modal */
.tw-stats-grid {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 16px;
}

.tw-stat {
  text-align: center;
}

.tw-stat-value {
  display: block;
  font-size: 32px;
  font-weight: 700;
}

.tw-stat-label {
  font-size: 11px;
  text-transform: uppercase;
}

/* Distribution */
.tw-distribution {
  padding: 0 8px;
}

.tw-dist-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.tw-dist-label {
  width: 12px;
  font-size: 14px;
  font-weight: 700;
}

.tw-dist-bar {
  min-width: 24px;
  padding: 2px 8px;
  background: var(--tw-gray);
  color: var(--tw-white);
  font-size: 14px;
  font-weight: 700;
  text-align: right;
}

.tw-dist-bar.tw-highlight {
  background: var(--tw-green);
}

/* Share Button */
.tw-share-section {
  margin-top: 20px;
  text-align: center;
}

.tw-btn-share {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--tw-green);
  color: var(--tw-white);
  border: none;
  border-radius: 4px;
  padding: 14px 24px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  text-transform: uppercase;
}

.tw-btn-share:hover {
  opacity: 0.9;
}

/* Confetti */
.tw-confetti {
  position: absolute;
  top: -10px;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  animation: tw-confetti-fall linear forwards;
  pointer-events: none;
  z-index: 1000;
}

@keyframes tw-confetti-fall {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(500px) rotate(720deg);
    opacity: 0;
  }
}

/* SEO Content */
.tw-seo {
  margin-top: 32px;
  padding: 24px;
  background: #f7f7f7;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.6;
}

.tw-seo h2 {
  font-size: 18px;
  margin: 0 0 12px 0;
}

.tw-seo h3 {
  font-size: 16px;
  margin: 16px 0 8px 0;
}

.tw-seo ul {
  margin: 0;
  padding-left: 20px;
}

.tw-seo li {
  margin-bottom: 4px;
}

/* Responsive */
@media (max-width: 500px) {
  .tw-hint {
    font-size: 14px;
    padding: 10px 18px;
  }

  .tw-tile {
    width: 52px;
    height: 52px;
    font-size: 28px;
  }

  .tw-key {
    height: 48px;
    font-size: 12px;
  }

  .tw-key.tw-key-wide {
    font-size: 10px;
  }

  .tw-title {
    font-size: 22px;
  }
}

@media (max-width: 380px) {
  .tw-tile {
    width: 46px;
    height: 46px;
    font-size: 24px;
  }

  .tw-key {
    height: 44px;
    font-size: 11px;
  }

  .tw-keyboard-row {
    gap: 3px;
  }
}
