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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
  padding: 20px;
}

h1 {
  margin-bottom: 10px;
  font-size: 1.8rem;
  text-align: center;
}

.subtitle {
  color: #888;
  margin-bottom: 30px;
  font-size: 0.9rem;
}

.roulette-container {
  position: relative;
  width: 400px;
  height: 400px;
  margin-bottom: 30px;
}

.roulette-wheel {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  position: relative;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.5), inset 0 0 10px rgba(0,0,0,0.3);
  border: 4px solid #333;
}

.roulette-wheel svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.sector {
  cursor: pointer;
  transition: opacity 0.2s, filter 0.2s;
}

.sector:hover {
  filter: brightness(1.2);
}

.roulette-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1a1a2e 0%, #2d2d44 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
  border: 3px solid #444;
  z-index: 10;
}

.result-prefecture {
  font-size: 1.2rem;
  font-weight: bold;
  text-align: center;
}

.result-area {
  font-size: 0.65rem;
  color: #888;
  margin-top: 3px;
  text-align: center;
}

.result-prob {
  font-size: 0.6rem;
  color: #feca57;
  margin-top: 2px;
}

.pointer {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 18px solid transparent;
  border-right: 18px solid transparent;
  border-top: 35px solid #ff6b6b;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.4));
  z-index: 20;
}

.pointer::after {
  content: '';
  position: absolute;
  top: -35px;
  left: -10px;
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 20px solid #fff;
}

.tooltip {
  position: fixed;
  background: rgba(0, 0, 0, 0.9);
  color: #fff;
  padding: 10px 15px;
  border-radius: 8px;
  font-size: 0.9rem;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 1000;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.tooltip.visible {
  opacity: 1;
}

.tooltip-name {
  font-weight: bold;
  font-size: 1.1rem;
  margin-bottom: 5px;
}

.tooltip-info {
  color: #aaa;
  font-size: 0.8rem;
}

.tooltip-prob {
  color: #feca57;
  font-size: 0.8rem;
  margin-top: 3px;
}

.spin-button {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  padding: 15px 50px;
  font-size: 1.2rem;
  color: #fff;
  border-radius: 50px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.spin-button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.spin-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.info-panel {
  margin-top: 30px;
  background: rgba(255, 255, 255, 0.1);
  padding: 20px;
  border-radius: 10px;
  max-width: 400px;
  text-align: center;
}

.history {
  text-align: left;
}

.history h4 {
  margin-bottom: 10px;
  color: #48dbfb;
}

.history-list {
  list-style: none;
  max-height: 120px;
  overflow-y: auto;
}

.history-list li {
  padding: 5px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.85rem;
  display: flex;
  justify-content: space-between;
}

.history-list .prob {
  color: #888;
}

/* Filter Toggle Button */
.filter-toggle {
  margin-top: 20px;
}

.filter-toggle-button {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 10px 25px;
  font-size: 0.9rem;
  color: #fff;
  border-radius: 25px;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-toggle-button:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
}

/* Filter Panel */
.filter-panel {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 15px;
  padding: 20px;
  z-index: 1000;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.filter-panel.visible {
  display: block;
}

.filter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.filter-header h3 {
  font-size: 1.1rem;
  color: #fff;
}

.filter-actions {
  display: flex;
  gap: 10px;
}

.filter-action-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 5px 12px;
  font-size: 0.75rem;
  color: #fff;
  border-radius: 15px;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-action-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.filter-content {
  max-height: 50vh;
  overflow-y: auto;
  padding-right: 10px;
}

.filter-content::-webkit-scrollbar {
  width: 6px;
}

.filter-content::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
}

.filter-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

/* Region Group */
.region-group {
  margin-bottom: 15px;
}

.region-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}

.region-header:hover {
  background: rgba(255, 255, 255, 0.1);
}

.region-header input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #667eea;
}

.region-header label {
  font-weight: bold;
  font-size: 0.95rem;
  cursor: pointer;
  flex: 1;
}

.region-count {
  font-size: 0.75rem;
  color: #888;
}

.prefecture-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 5px;
  padding: 10px 0 0 28px;
}

.prefecture-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 5px;
  transition: background 0.2s;
}

.prefecture-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.prefecture-item input[type="checkbox"] {
  width: 14px;
  height: 14px;
  cursor: pointer;
  accent-color: #667eea;
}

.prefecture-item label {
  font-size: 0.85rem;
  cursor: pointer;
  color: #ddd;
}

.prefecture-item input:not(:checked) + label {
  color: #666;
}

/* Filter Footer */
.filter-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.selected-count {
  font-size: 0.85rem;
  color: #888;
}

.filter-apply-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  padding: 10px 30px;
  font-size: 0.9rem;
  color: #fff;
  border-radius: 25px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.filter-apply-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.filter-apply-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Overlay */
.overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 999;
}

.overlay.visible {
  display: block;
}

/* Disabled state indicator */
.disabled-indicator {
  color: #ff6b6b;
  font-size: 0.8rem;
  margin-left: 5px;
}
