@font-face {
  font-family: 'Capriola';
  src: url('res/Capriola-Regular.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

body {
  margin: 0;
  padding: 0;
  font-family: 'Capriola', sans-serif;
  min-height: 100vh;
  color: white;
  text-shadow: 0 0 5px rgba(0,0,0,0.8);
  overflow: hidden;
  background-color: #111;
}

.app-container {
  display: flex;
  width: 100vw;
  height: 100vh;
}

#canvas {
  width: 100%;
  height: 100%;
  display: block;
  background-color: transparent;
  cursor: grab;
}

#canvas:active {
  cursor: grabbing;
}

.canvas-container {
  flex: 1;
  position: relative;
  background-color: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.cursor-display {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(0, 0, 0, 0.7);
  padding: 10px 15px;
  border-radius: 5px;
  backdrop-filter: blur(5px);
  font-family: monospace;
  font-size: 1.2em;
  z-index: 10;
  pointer-events: none;
}

.controls {
  width: 350px;
  background: #1a1a1a;
  padding: 20px;
  border-right: 1px solid #333;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 10;
  overflow-y: auto;
}

.controls h1 {
  margin: 0 0 10px 0;
  font-size: 1.5em;
  color: #ff66aa;
}

.controls label {
  display: block;
  margin-bottom: 5px;
  font-size: 0.9em;
  color: #aaa;
}

.controls hr {
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin: 10px 0;
}

.playback-controls {
  width: 100%;
  background: rgba(0, 0, 0, 0.7);
  padding: 15px 20px;
  display: flex;
  align-items: center;
  gap: 20px;
  backdrop-filter: blur(5px);
  z-index: 20;
  box-sizing: border-box;
}

.playback-controls .play-btn {
  min-width: 50px;
  font-size: 1.2em;
  display: flex;
  align-items: center;
  justify-content: center;
}

.playback-controls .seek-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.seek-canvas {
  width: 100%;
  height: 30px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  cursor: pointer;
}

.playback-controls .time-display {
  font-family: monospace;
  font-size: 0.9em;
  color: #eee;
  text-align: right;
  align-self: flex-end;
}

.playback-controls input[type="range"] {
  flex: 1;
}

input[type="range"] {
  width: 100%;
}

input[type="file"] {
  width: 100%;
  font-size: 0.8em;
  color: #999;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid #333;
  border-radius: 6px;
  padding: 6px 8px;
  box-sizing: border-box;
  cursor: pointer;
  transition: border-color 0.2s;
}

input[type="file"]:hover {
  border-color: #555;
}

input[type="file"]::file-selector-button,
input[type="file"]::-webkit-file-upload-button {
  margin-right: 10px;
  padding: 6px 12px;
  background: #ff66aa;
  border: none;
  border-radius: 4px;
  color: white;
  font-family: 'Capriola', sans-serif;
  font-weight: bold;
  font-size: 0.95em;
  cursor: pointer;
  transition: background 0.2s;
}

input[type="file"]::file-selector-button:hover,
input[type="file"]::-webkit-file-upload-button:hover {
  background: #ff88bb;
}

button {
  padding: 10px;
  background: #ff66aa;
  border: none;
  border-radius: 5px;
  color: white;
  font-weight: bold;
  cursor: pointer;
}

button:hover {
  background: #ff88bb;
}

button:disabled {
  background: #444;
  cursor: not_allowed;
}

.upload-tabs {
  display: flex;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 4px;
  gap: 4px;
}

.upload-tabs button {
  flex: 1;
  background: transparent;
  color: #aaa;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 0.85em;
  font-weight: bold;
  transition: all 0.2s;
}

.upload-tabs button:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.upload-tabs button.active {
  background: #ff66aa;
  color: white;
  box-shadow: 0 2px 8px rgba(255, 102, 170, 0.4);
}

.upload-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 12px;
}

.upload-panel .field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.upload-panel .field label {
  margin-bottom: 0;
}

.upload-panel .file-hint {
  font-size: 0.75em;
  color: #ff66aa;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.upload-panel select {
  background: #222;
  color: #fff;
  border: 1px solid #444;
  border-radius: 4px;
  padding: 6px;
  font-family: 'Capriola', sans-serif;
  font-size: 0.85em;
}

input[type="text"] {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid #333;
  border-radius: 6px;
  color: #fff;
  padding: 6px 8px;
  font-family: 'Capriola', sans-serif;
  font-size: 0.85em;
  box-sizing: border-box;
}

input[type="text"]:focus {
  outline: none;
  border-color: #ff66aa;
}

.inline-input-group {
  display: flex;
  gap: 6px;
}

.inline-input-group input[type="text"] {
  flex: 1;
  min-width: 0;
}

.inline-input-group button {
  flex-shrink: 0;
  padding: 6px 12px;
  font-size: 0.85em;
}

.browse-beatmap-summary {
  font-size: 0.8em;
  color: #ccc;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  padding: 6px 8px;
}

.score-list {
  max-height: 280px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 4px;
  border: 1px solid #333;
  padding: 4px;
}

.score-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 4px;
  font-size: 0.78em;
}

.score-rank {
  font-weight: bold;
  color: #ff66aa;
  width: 22px;
  flex-shrink: 0;
}

.score-user {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #eee;
}

.score-mods {
  font-family: monospace;
  color: #aaa;
  flex-shrink: 0;
}

.score-acc {
  font-family: monospace;
  color: #999;
  flex-shrink: 0;
  white-space: nowrap;
}

.score-load-btn {
  flex-shrink: 0;
  padding: 3px 8px;
  font-size: 0.85em;
}

.time-window-selector {
  margin-top: 10px;
  background: rgba(255, 255, 255, 0.05);
  padding: 10px;
  border-radius: 5px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

.time-window-selector .snap-btn {
  padding: 4px 8px;
  font-size: 0.75em;
  background: #444;
  border-radius: 3px;
}

.time-window-selector .snap-btn:hover:not(:disabled) {
  background: #ff66aa;
}

.time-window-selector .snap-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.time-window-selector label {
  color: #ff66aa;
  font-weight: bold;
  margin-bottom: 0;
}

.time-window-selector .range-container {
  display: flex;
  align-items: center;
  gap: 0;
}

.time-window-selector .range-container input[type="range"] {
  flex: 1;
  margin: 0;
}

.time-window-selector .separator {
  width: 2px;
  height: 20px;
  background: #ff66aa;
  z-index: 1;
}

.time-window-selector .inputs-container {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.time-window-selector .input-with-label {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 1;
}

.time-window-selector .input-with-label input[type="number"] {
  width: 100%;
  background: #333;
  border: 1px solid #444;
  color: white;
  padding: 4px;
  border-radius: 3px;
  font-family: monospace;
  font-size: 0.9em;
}

.time-window-selector .input-with-label span {
  font-size: 0.8em;
  color: #aaa;
  white-space: nowrap;
}

.analysis-widget {
  margin-top: 20px;
  background: rgba(40, 40, 40, 0.8);
  border-radius: 8px;
  padding: 12px;
  border: 1px solid #444;
}

.analysis-widget h3 {
  margin: 0 0 10px 0;
  font-size: 1.1em;
  color: #fff;
  border-bottom: 1px solid #555;
  padding-bottom: 5px;
}

.analysis-section {
  margin-bottom: 12px;
}

.analysis-section h4 {
  margin: 0 0 5px 0;
  font-size: 0.9em;
  color: #ccc;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.analysis-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 8px;
  font-family: monospace;
  font-size: 0.85em;
}

.analysis-grid span:nth-child(odd) {
  color: #888;
}

.analysis-grid span:nth-child(even) {
  color: #eee;
  text-align: right;
}

.hover-mode-selector {
  margin-top: 15px;
  background: rgba(40, 40, 40, 0.8);
  padding: 10px;
  border-radius: 5px;
  border: 1px solid #444;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.hover-mode-selector label {
  color: #ff66aa;
  font-weight: bold;
}

.hover-mode-selector .button-group {
  display: flex;
  gap: 5px;
}

.hover-mode-selector button {
  background: #333;
  color: #ccc;
  border: 1px solid #555;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9em;
  transition: all 0.2s;
}

.hover-mode-selector button:hover {
  background: #444;
  color: white;
}

.hover-mode-selector button.active {
  background: #ff66aa;
  color: white;
  border-color: #ff66aa;
  font-weight: bold;
}

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(40, 40, 40, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  backdrop-filter: blur(2px);
}

.loading-content {
  background: #222;
  padding: 30px 60px;
  border-radius: 10px;
  border: 2px solid #ff66aa;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 102, 170, 0.2);
  border-top: 4px solid #ff66aa;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loading-text {
  color: white;
  font-size: 1.5em;
  font-weight: bold;
  letter-spacing: 2px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.judgments-list {
  max-height: 200px;
  overflow-y: auto;
  margin-top: 4px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 4px;
  border: 1px solid #333;
}

.judgment-item {
  font-family: monospace;
  font-size: 0.82em;
  padding: 4px 8px;
  cursor: pointer;
  white-space: pre;
  color: #ddd;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

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

.judgment-item:hover {
  background: rgba(255, 102, 170, 0.2);
  color: white;
}

.judgment-empty {
  font-family: monospace;
  font-size: 0.82em;
  padding: 6px 8px;
  color: #666;
  font-style: italic;
}

/* Circle detail window */
.circle-detail-window {
  position: absolute;
  top: 16px;
  left: 16px;
  width: 300px;
  flex-direction: column;
  background: rgba(14, 16, 20, 0.97);
  border: 1px solid #383838;
  border-radius: 8px;
  z-index: 20;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0,0,0,0.7);
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 10px;
  background: rgba(28, 30, 36, 0.95);
  border-bottom: 1px solid #2a2a2a;
  gap: 8px;
}

.detail-title {
  font-size: 0.78em;
  color: #ccc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.detail-close {
  background: none;
  border: none;
  color: #777;
  font-size: 16px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  flex-shrink: 0;
}

.detail-close:hover {
  color: #eee;
}

.detail-canvas {
  display: block;
  width: 100%;
  cursor: crosshair;
}

.detail-footer {
  padding: 7px 10px;
  font-size: 0.8em;
  border-top: 1px solid #2a2a2a;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.detail-error {
  color: #aaa;
  font-family: monospace;
}

.detail-hint {
  margin-left: auto;
  color: #555;
  font-size: 0.85em;
  font-style: italic;
}

.detail-notelock {
  color: #ff9944;
  font-size: 0.82em;
  border: 1px solid #ff994466;
  border-radius: 3px;
  padding: 1px 5px;
  margin-left: 4px;
}
