:root {
    --midsize: 0.9rem;
}

/* Disable double tap zoom on mobile */
* {
  touch-action: manipulation;
}

.puzzle-widget {
    font-family: Arial, sans-serif;
    max-width: 500px;
    margin: 0 auto;
}

.puzzle-header {
    padding-top: 15px;
    text-align: center;
    font-family: 'Press Start 2P', monospace;
}

.puzzle-title {
    font-size: 1.4rem;
    font-weight: bold;
    color: #8f8f8f;
    margin: 0 0 5px 0;
    text-transform: uppercase;
    font-family: 'Press Start 2P', monospace;
}

.puzzle-date {
    font-size: var(--midsize);
    color: #666;
    margin: 0;
    font-family: monospace;
}

.puzzle-data {
    display: flex;
    justify-content: space-around;
    padding: 8px 0px 0px 0px;
}

.puzzle-meta {
    font-size: var(--midsize);
    color: #666;
    font-family: monospace;
}

.puzzle-info {
    justify-content: center;
    display: flex;
    margin: 0px 32px;
}

.puzzle-rules {
    background: #ededed;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 8px;
    margin: 15px 23px;
    font-size: 0.9rem;
    line-height: 1.4;
    font-family: monospace;
    text-align: justify;
    color: #555;
}

.puzzle-rules.hidden {
    display: none;
}

.game-canvas {
    display: block;
    margin: 15px auto;
    border: 2px solid #666;
    background: #666;
    cursor: pointer;
    max-width: 100%;
    height: auto;
}

.puzzle-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 15px;
    flex-wrap: wrap;
}

.btn {
    padding: 8px 16px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: var(--midsize);;
    cursor: pointer;
    background: #363636;
    color: #e7e7e7;
    font-family: monospace;
}

.btn:disabled {
    color: #a2a2a2;
    background: #e7e7e7;
}

.btn:disabled:hover {
    color: #a2a2a2;
    background: #e7e7e7;
    cursor: not-allowed;
}

.btn:disabled:active {
  transform: none;
  background: #e7e7e7;
  box-shadow: none;
}

.btn:hover {
    background: #f8f9fa;
    border-color: #aaa;
    color: #363636;
}

.btn:active {
  transform: translateY(2px);
  background: #ff5858;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.2);
}

.btn-primary {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.notebook-icon {
  width: 16px;
  height: 16px;
  vertical-align: middle;
}

.overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #FFF;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 1000;
}

.overlay.show {
  opacity: 1;
  visibility: visible;
}

.overlay.show .profile {
    transform: translateY(0);
}

.close-button {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #6c757d;
  padding: 5px;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.profile {
  background: white;
  border-radius: 12px;
  padding: 30px;
  max-width: 300px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  transform: translateY(60px);
  transition: transform 0.4s cubic-bezier(0.57, 0.17, 0.36, 0.74);
  font-family: monospace;
}

.profile-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.profile-header h3 {
    font-family: monospace;
}

.profile-info {
    text-align: center;
}

.profile-footer {
    display: flex;
    justify-content: center;
    margin-top: 10px;
}

.square {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  transition: all 0.2s ease;
}

.contribution-grid {
  display: grid;
  justify-content: center;
  grid-template-columns: repeat(12, 12px);
  grid-template-rows: repeat(7, 12px);
  gap: 2px;
}

/* Contribution levels */
.level-0 { background-color: #f5f5f5; }
.level-1 { background-color: #bcc3c0; }
.level-2 { background-color: #ff5858; }


.stats-container {
  display: flex;
  justify-content: space-around;
  padding: 20px 0px;
  max-width: 600px;
  margin: 0 auto;
}

.stat-item {
    text-align: center;
    flex: 1;
}

.stat-number {
    font-size: 29px;
    color: #333;
    margin: 0;
    line-height: 1;
}

.stat-label {
    font-size: 14px;
    color: #666;
    margin-top: 5px;
    font-weight: normal;
}


.btn-primary:hover {
    background: #0056b3;
    border-color: #0056b3;
}

.btn-success {
    background: #28a745;
    color: white;
    border-color: #28a745;
}

.btn-success:hover {
    background: #1e7e34;
    border-color: #1e7e34;
}

.status-message {
    text-align: center;
    margin: 10px;
    min-height: 18px;
    border-radius: 4px;
    visibility: hidden;
    font-size: 0.9rem;
}

.status-success {
    color: #155724;
}

.status-error {
    color: #721c24;
}

.loading-state {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .puzzle-widget {
        border-radius: 4px;
        margin: 0;
    }

    .btn {
        min-width: 120px;
    }
}
