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

body {
  font-family: 'Arial', 'Hiragino Sans', sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  padding: 20px;
}

.container {
  max-width: 1000px;
  margin: 0 auto;
  background: white;
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  padding: 30px;
}

h1 {
  text-align: center;
  color: #333;
  margin-bottom: 20px;
  font-size: 2.5em;
}

.top-controls {
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: center;
  margin-bottom: 30px;
  padding: 20px;
  background: #f0f4ff;
  border-radius: 8px;
}

.rotation-input {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rotation-input label {
  font-weight: bold;
  color: #333;
  font-size: 1.1em;
}

.rotation-input input {
  padding: 10px 15px;
  border: 2px solid #667eea;
  border-radius: 5px;
  font-size: 1em;
  width: 120px;
}

.full-reset-btn {
  padding: 12px 30px;
  background: #ff5252;
  color: white;
  border: none;
  border-radius: 5px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 1em;
  -webkit-appearance: none;
  -webkit-border-radius: 5px;
}

.full-reset-btn:hover {
  background: #ff1744;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(255, 82, 82, 0.4);
}

h2 {
  color: #667eea;
  border-bottom: 3px solid #667eea;
  padding-bottom: 10px;
  margin: 25px 0 15px;
  font-size: 1.5em;
}

h3 {
  color: #555;
  margin: 15px 0 10px;
  font-size: 1.1em;
}

.category {
  background: #f9f9f9;
  padding: 15px;
  margin: 15px 0;
  border-radius: 8px;
  border-left: 4px solid #667eea;
}

.counter-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 40px;
  padding: 25px;
  background: white;
  border-radius: 8px;
  margin: 15px 0;
  border: 2px solid #e0e0e0;
}

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

.counter-label {
  font-size: 1.6em;
  font-weight: bold;
  color: #333;
  margin-bottom: 12px;
}

.counter-value {
  font-size: 2.8em;
  font-weight: bold;
  color: #ff6600;
  background: #fff3cd;
  padding: 20px 35px;
  border-radius: 8px;
  border: 3px solid #ffc107;
  display: inline-block;
  min-width: 120px;
  text-align: center;
}

.counter-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.plus-btn, .minus-btn {
  background: #4caf50;
  color: white;
  border: none;
  padding: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
  font-size: 1.8em;
  transition: all 0.3s ease;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-appearance: none;
  -webkit-border-radius: 8px;
  line-height: 1;
}

.plus-btn:hover {
  background: #45a049;
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

.minus-btn {
  background: #ff9800;
}

.minus-btn:hover {
  background: #e68900;
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(255, 152, 0, 0.4);
}

.count-display {
  display: inline-block;
  background: #fff3cd;
  padding: 5px 10px;
  border-radius: 5px;
  margin-left: 10px;
  font-weight: bold;
  color: #ff6600;
}

.voice-grid, .char-grid, .end-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-top: 15px;
  padding: 10px;
}

.counter-item-small {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 18px;
  background: white;
  border-radius: 8px;
  border: 2px solid #e0e0e0;
}

.counter-info-small {
  text-align: center;
}

.counter-label-small {
  font-size: 1.2em;
  font-weight: bold;
  color: #333;
  margin-bottom: 10px;
}

.counter-value-small {
  font-size: 2em;
  font-weight: bold;
  color: #ff6600;
  background: #fff3cd;
  padding: 15px 25px;
  border-radius: 7px;
  border: 2px solid #ffc107;
  display: inline-block;
  min-width: 90px;
  text-align: center;
}

.counter-buttons-small {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.plus-btn-small, .minus-btn-small {
  background: #4caf50;
  color: white;
  border: none;
  padding: 0;
  border-radius: 7px;
  cursor: pointer;
  font-weight: bold;
  font-size: 1.5em;
  transition: all 0.3s ease;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-appearance: none;
  -webkit-border-radius: 7px;
  line-height: 1;
}

.plus-btn-small:hover {
  background: #45a049;
  transform: scale(1.08);
  box-shadow: 0 3px 8px rgba(76, 175, 80, 0.3);
}

.minus-btn-small {
  background: #ff9800;
}

.minus-btn-small:hover {
  background: #e68900;
  transform: scale(1.08);
  box-shadow: 0 3px 8px rgba(255, 152, 0, 0.3);
}

.stats-section {
  background: #f0f4ff;
  padding: 20px;
  border-radius: 8px;
  margin-top: 20px;
}

.stats-display {
  background: white;
  padding: 15px;
  border-radius: 5px;
  max-height: 400px;
  overflow-y: auto;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  border-bottom: 1px solid #eee;
}

.stat-item:last-child {
  border-bottom: none;
}

.stat-name {
  font-weight: bold;
  color: #333;
}

.stat-bar {
  flex: 1;
  margin: 0 15px;
  height: 20px;
  background: #e0e0e0;
  border-radius: 10px;
  overflow: hidden;
}

.stat-fill {
  height: 100%;
  background: linear-gradient(90deg, #667eea, #764ba2);
  transition: width 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8em;
  color: white;
  font-weight: bold;
}

.stat-percent {
  min-width: 50px;
  text-align: right;
  font-weight: bold;
  color: #667eea;
}

.judgment-section {
  background: #fff3cd;
  padding: 20px;
  border-radius: 8px;
  margin-top: 20px;
  border-left: 4px solid #ff9800;
}

.judgment-display {
  background: white;
  padding: 20px;
  border-radius: 5px;
  text-align: center;
  font-size: 1.3em;
}

.judgment-result {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.judgment-item {
  background: #e8f5e9;
  padding: 15px 25px;
  border-radius: 8px;
  font-size: 1.2em;
  font-weight: bold;
  color: #2e7d32;
  border: 2px solid #4caf50;
}

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

.reset-btn, .export-btn {
  padding: 12px 30px;
  font-size: 1em;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.3s ease;
}

.reset-btn {
  background: #f44336;
  color: white;
}

.reset-btn:hover {
  background: #d32f2f;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(244, 67, 54, 0.4);
}

.export-btn {
  background: #4caf50;
  color: white;
  -webkit-appearance: none;
  -webkit-border-radius: 5px;
}

.export-btn:hover {
  background: #388e3c;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(76, 175, 80, 0.4);
}

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

  h1 {
    font-size: 1.8em;
    margin-bottom: 15px;
  }

  h2 {
    font-size: 1.2em;
  }

  h3 {
    font-size: 1em;
  }

  .top-controls {
    flex-direction: column;
    gap: 15px;
    padding: 15px;
  }

  .rotation-input {
    width: 100%;
    justify-content: space-between;
  }

  .rotation-input input {
    width: 100px;
  }

  .full-reset-btn {
    width: 100%;
  }

  .counter-item {
    flex-direction: column;
    gap: 20px;
    padding: 15px;
    text-align: center;
  }

  .counter-info {
    width: 100%;
  }

  .counter-label {
    font-size: 1.3em;
  }

  .counter-value {
    font-size: 2.2em;
    padding: 15px 25px;
    min-width: 100px;
  }

  .counter-buttons {
    flex-direction: row;
    width: 100%;
    gap: 15px;
    justify-content: center;
  }

  .plus-btn, .minus-btn {
    width: 55px;
    height: 55px;
    font-size: 1.6em;
    flex: 1;
    max-width: 80px;
  }

  .voice-grid, .char-grid, .end-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .counter-item-small {
    flex-direction: column;
    gap: 15px;
    padding: 12px;
  }

  .counter-info-small {
    width: 100%;
  }

  .counter-label-small {
    font-size: 1em;
    margin-bottom: 8px;
  }

  .counter-value-small {
    font-size: 1.6em;
    padding: 12px 20px;
    min-width: 80px;
  }

  .counter-buttons-small {
    flex-direction: row;
    width: 100%;
    gap: 10px;
    justify-content: center;
  }

  .plus-btn-small, .minus-btn-small {
    width: 45px;
    height: 45px;
    font-size: 1.3em;
    flex: 1;
    max-width: 70px;
  }

  .stat-item {
    flex-direction: column;
    gap: 8px;
  }

  .stat-bar {
    width: 100%;
    margin: 8px 0;
  }

  .stat-percent {
    text-align: left;
    min-width: auto;
  }

  .controls {
    flex-direction: column;
  }

  #export-btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 10px;
  }

  h1 {
    font-size: 1.5em;
    margin-bottom: 12px;
  }

  h2 {
    font-size: 1.1em;
    margin: 15px 0 10px;
  }

  h3 {
    display: none;
  }

  .top-controls {
    gap: 10px;
    padding: 12px;
  }

  .rotation-input label {
    font-size: 1em;
  }

  .rotation-input input {
    width: 80px;
    padding: 8px 10px;
    font-size: 0.9em;
  }

  .full-reset-btn {
    padding: 10px 20px;
    font-size: 0.9em;
  }

  .counter-item {
    gap: 15px;
    padding: 12px;
  }

  .counter-label {
    font-size: 1.1em;
  }

  .counter-value {
    font-size: 1.8em;
    padding: 12px 20px;
    min-width: 80px;
  }

  .counter-buttons {
    gap: 12px;
  }

  .plus-btn, .minus-btn {
    width: 50px;
    height: 50px;
    font-size: 1.4em;
  }

  .voice-grid, .char-grid, .end-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .counter-item-small {
    gap: 12px;
    padding: 10px;
  }

  .counter-label-small {
    font-size: 0.95em;
  }

  .counter-value-small {
    font-size: 1.4em;
    padding: 10px 15px;
  }

  .plus-btn-small, .minus-btn-small {
    width: 42px;
    height: 42px;
    font-size: 1.2em;
  }

  .stats-display {
    max-height: 300px;
  }

  .stat-item {
    padding: 8px;
  }

  .stat-name {
    font-size: 0.9em;
  }

  .stat-fill {
    font-size: 0.7em;
  }

  .stat-percent {
    font-size: 0.85em;
  }

  .judgment-display {
    font-size: 1.1em;
  }

  .judgment-item {
    padding: 12px 15px;
    font-size: 1em;
  }
}
