/* myapp/scoresheet/style.css */

/* =========================================
   1. VARIABLES & GLOBAL RESET
   ========================================= */
:root {
  /* Colors - Swiss Minimalist Dark Optimized */
  --color-card: #16191d;
  --color-surface-hover: #1e2227;
  --accent-color: #FF3B30;
  --accent-rgb: 255, 59, 48;

  /* Text Colors */
  --text-secondary: #9AA0A6;
  --text-tertiary: #4A4E58;

  /* Borders & Status - Muted for focus */
  --border-color: #222222;
  --border-focus: #444444;
  --status-success: #00FF41;
  --status-warning: #FFD700;
  --status-error: #FF3B30;

  /* Spacing & Touch Targets */
  --space-unit: 8px;
  --touch-target: 48px;

  /* Global Typography Settings */
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}

* {
  border-radius: 0 !important;
  /* No Radius Rule */
}

body {
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: -0.01em;
  overscroll-behavior-y: none;
  -webkit-touch-callout: none;
}

body.dial-open {
  overflow: hidden;
  height: 100vh;
}

#container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px min(16px, 4vw);
  width: 100%;
  margin: 0 auto;
}

/* Icons */
.icon-wrapper {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 2.8vh;
  height: 2.8vh;
}

.icon-wrapper svg {
  width: 100%;
  height: 100%;
}

/* =========================================
   2. LAYOUT - HEADER & TITLE
   ========================================= */
.app-header {
  margin-bottom: 1.5vh;
  text-align: center;
  width: 100%;
}

.app-main-title {
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: 0.3em;
  color: var(--text-tertiary);
  margin-bottom: 8px;
}

.game-title-container {
  width: 100%;
  text-align: center;
  margin-bottom: 2vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1vh;
}

.game-title-input {
  font-size: 5vh !important;
  line-height: 1.1;
  display: block;
  font-weight: 950 !important;
  color: var(--color-text) !important;
  letter-spacing: -0.05em;
  margin-bottom: 0.5vh !important;
  text-shadow: none !important;
  width: 100%;
  background: transparent !important;
  border: none !important;
  text-align: center !important;
  outline: none !important;
  text-transform: uppercase;
  cursor: pointer;
}

.tichu-mode-text {
  background: var(--accent-color);
  color: white;
  font-size: 1.4vh;
  font-weight: 900;
  padding: 0.6vh 1.2vh;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin: 0 auto;
  display: inline-block;
  line-height: 1;
}

/* =========================================
   3. TABLE SYSTEM
   ========================================= */
.table-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  margin-bottom: 4vh;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  table-layout: fixed;
  background: var(--color-card);
  border: 1px solid var(--border-color);
  overflow: hidden;
}

/* Header Area */
thead th {
  background: rgba(255, 255, 255, 0.03);
  padding: 2.2vh 0.5vw;
  border-bottom: 2px solid var(--border-color);
  color: var(--color-text);
  font-weight: 900;
  font-size: 1.6vh;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  text-align: center;
}

/* Game Info (Top Image/Date Row) */
.game-info-cell {
  padding: 0;
  text-align: center;
  border: none !important;
  background: transparent !important;
}

.game-info-content {
  background: var(--color-bg);
  border: 2px solid var(--border-color);
  padding: 8vh 5vw 6vh 5vw;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4vh;
  width: 100%;
  position: relative;
  overflow: hidden;
}

.game-info-content::before {
  content: 'BOARD GAME RECORD';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4vh;
  background: var(--border-color);
  color: var(--color-bg);
  font-size: 1.2vh;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.3em;
  text-transform: uppercase;
}

.game-info-content::after {
  content: '';
  position: absolute;
  bottom: 1.5vh;
  right: 2vw;
  width: 4vh;
  height: 4vh;
  border-right: 2px solid var(--accent-color);
  border-bottom: 2px solid var(--accent-color);
}

.date-text {
  font-size: 1.8vh !important;
  color: var(--text-secondary) !important;
  font-weight: 700 !important;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  border-top: 2px solid var(--border-color);
  padding-top: 1.5vh;
  width: 100%;
  margin-top: 1vh;
}

.game-info-photo {
  display: block;
  margin: 0 auto;
  width: 100%;
  max-width: 100%;
  height: auto;
  aspect-ratio: 4/3;
  object-fit: cover;
  border: 3px solid var(--color-text);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
  filter: grayscale(0.2);
}

.game-info-photo:active {
  transform: scale(0.98);
  filter: grayscale(0);
}

/* Player Name Row */
.player-name-row th {
  background: rgba(0, 0, 0, 0.3);
  font-size: 2vh;
  font-weight: 950;
  color: var(--color-text);
  border-bottom: 3px solid var(--accent-color);
  position: relative;
  z-index: 5;
  height: 8vh;
  vertical-align: middle;
  letter-spacing: -0.02em;
}

/* Body Area */
tbody td {
  padding: 1.2vh 0.5vw;
  border-bottom: none;
  transition: all 0.2s ease;
  text-align: center;
  position: relative;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.round-col {
  width: 15%;
  min-width: 50px;
  color: var(--text-tertiary);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: rgba(0, 0, 0, 0.1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Editable Inputs */
.editable-name,
.editable-round,
.score-input {
  background: transparent !important;
  border: none !important;
  color: inherit !important;
  font-family: inherit !important;
  font-size: inherit !important;
  font-weight: inherit !important;
  text-align: center !important;
  width: 100% !important;
  outline: none !important;
  display: block;
  transition: all 0.2s ease;
}

.editable-name {
  font-weight: 800 !important;
  color: var(--color-text) !important;
  font-size: 2vh !important;
  letter-spacing: -0.02em;
}

.editable-round {
  font-weight: 700 !important;
  color: var(--text-tertiary) !important;
  font-size: 1.6vh !important;
  text-transform: uppercase;
}

.score-cell {
  position: relative;
  vertical-align: middle;
}

.score-cell:active {
  background: rgba(var(--accent-rgb), 0.1) !important;
}

.score-input {
  font-size: 2vh !important;
  font-family: var(--font-main) !important;
  font-variant-numeric: tabular-nums !important;
}

/* Tichu Tags & Badges */
.tichu-bonus-tag,
.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.1vh 0.8vh;
  font-size: 2vh;
  font-weight: 700;
  font-family: var(--font-main);
  font-variant-numeric: tabular-nums;
  border: 1px solid currentColor;
  opacity: 0.9;
  transition: all 0.2s ease;
  margin-top: 2px;
}

.tichu-bonus-tag {
  color: #2ecc71;
  background: rgba(46, 204, 113, 0.15);
  border-color: rgba(46, 204, 113, 0.2);
}

.tichu-bonus-tag.negative {
  color: #ff4757;
  background: rgba(255, 71, 87, 0.15);
  border-color: rgba(255, 71, 87, 0.2);
}

.status-badge {
  font-weight: 900;
  margin-left: 6px;
  text-transform: uppercase;
  background: rgba(0, 0, 0, 0.3);
}

.status-badge.positive {
  color: #2ecc71 !important;
}

.status-badge.negative {
  color: #ff4757 !important;
}

/* Footer & Totals */
tfoot td {
  background: rgba(var(--accent-rgb), 0.1);
  padding: 2.5vh 0.5vw;
  font-weight: 950;
  font-size: 3vh;
  color: var(--accent-color);
  border-top: 2.5px solid var(--accent-color);
  text-align: center;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.total-label {
  background: rgba(255, 255, 255, 0.05) !important;
  color: var(--text-secondary) !important;
  font-size: 1.8vh !important;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* =========================================
   4. CONTROL PANEL (BOTTOM)
   ========================================= */
#bottom-controls {
  width: 100%;
  margin-top: 4vh;
  padding: 0 5vw 6vh 5vw;
  display: flex;
  flex-direction: column;
  gap: 2vh;
  position: relative;
  background: var(--color-card);
  border-top: 1px solid var(--border-color);
}

#bottom-controls::before {
  content: '';
  position: absolute;
  top: 0;
  left: 5vw;
  right: 5vw;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-color), transparent);
  opacity: 0.4;
}

.controls-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1.5vh;
  width: 100%;
}

/* Full width for specific groups */
.controls-groups .button-group:nth-child(3),
.controls-groups .button-group:nth-child(4) {
  grid-column: span 2;
}

.button-group {
  background: var(--color-card);
  border: 1px solid var(--border-color);
  padding: 2vh;
  display: flex;
  flex-direction: column;
  gap: 1.5vh;
  justify-content: space-between;
}

.button-group-label {
  font-size: 1.2vh;
  font-weight: 800;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  opacity: 0.7;
}

.button-row {
  display: flex;
  gap: 1vh;
  /* Gap reduced for 4 buttons */
  height: 6vh;
}

/* Base Button Styles */
.button-row button,
.button-row .btn-style {
  flex: 1;
  height: 100%;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  color: var(--color-text);
  font-family: var(--font-main);
  font-weight: 800;
  font-size: 1.6vh;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.button-row button:active,
.button-row .btn-style:active {
  background: var(--accent-color);
  border-color: var(--accent-color);
  color: white;
  transform: scale(0.96);
}

.button-row button:disabled {
  opacity: 0.2;
  cursor: not-allowed;
  transform: none !important;
}

/* Function Specific Colors */
.button-row button:nth-child(1) {
  border-left: 3px solid var(--status-success);
}

.button-row button:nth-child(2) {
  border-left: 3px solid var(--status-warning);
}

.button-row button:nth-child(3) {
  border-left: 3px solid var(--status-error);
}

/* Special Buttons */
.tichu-start-btn,
.tichu-cancel-btn {
  width: 100%;
  height: 8vh !important;
  font-size: 2.2vh !important;
  margin-top: 1vh !important;
  gap: 1.5vh;
  font-weight: 900 !important;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: 2px solid transparent !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.tichu-start-btn {
  background: var(--accent-color) !important;
  color: white !important;
  border-color: var(--accent-color) !important;
}

.tichu-cancel-btn {
  border-color: var(--status-error) !important;
  color: var(--status-error) !important;
  background: transparent !important;
}

.tichu-cancel-btn:active {
  background: var(--status-error) !important;
  color: white !important;
}

/* =========================================
   5. PRESET SYSTEM
   ========================================= */
.preset-toggle-btn {
  width: 100%;
  height: 7vh !important;
  background: var(--color-bg) !important;
  border: 2px solid var(--border-color) !important;
  color: var(--color-text) !important;
  font-size: 2vh !important;
  font-weight: 800 !important;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  gap: 1.5vh;
  margin-top: 1vh;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.preset-toggle-btn.active {
  border-color: var(--accent-color) !important;
  color: var(--accent-color) !important;
}

.preset-container {
  display: none;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  padding: 0;
  background: var(--border-color);
  border: 1px solid var(--border-color);
  margin-top: 1.5vh;
}

.preset-container.show {
  display: grid;
  animation: fade-in 0.3s ease;
}

.preset-btn {
  background: var(--color-bg) !important;
  border: none !important;
  color: var(--color-text) !important;
  padding: 2vh !important;
  font-size: 1.7vh !important;
  font-weight: 700 !important;
  width: 100% !important;
  height: 100% !important;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.preset-btn:active {
  background: var(--accent-color) !important;
  color: white !important;
}

/* =========================================
   6. DIAL OVERLAY (SCORE INPUT)
   ========================================= */
#drag-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: var(--blur-lg);
  -webkit-backdrop-filter: var(--blur-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fade-in 0.3s ease;
  cursor: pointer;
  touch-action: none;
}

#drag-overlay.opening {
  pointer-events: none;
}

.dial-close-hint {
  position: absolute;
  top: 5vh;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1vh;
  color: rgba(255, 255, 255, 0.4);
  font-family: var(--font-main);
  pointer-events: none;
}

.dial-close-hint .close-icon {
  font-size: 3vh;
  font-weight: 300;
}

.dial-close-hint .close-text {
  font-size: 1.2vh;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.2em;
}

.dial-close-btn-bottom {
  position: absolute;
  bottom: 5vh;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  padding: 1.5vh 8vw;
  font-size: 2vh;
  background: var(--color-bg);
  border: 1px solid var(--border-color);
  color: var(--color-text);
  font-family: var(--font-main);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 120px;
}

.dial-close-btn-bottom:active {
  background: var(--accent-color);
  border-color: var(--accent-color);
  color: #ffffff;
  transform: translateX(-50%) scale(0.92);
}

.dial-container-wrapper {
  width: 75vw;
  max-width: 340px;
  padding: 4vh;
  display: flex;
  flex-direction: column;
  gap: 3vh;
  animation: slide-up 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.dial-content {
  width: 100%;
  height: 30vh;
  perspective: 1000px;
  transform-style: preserve-3d;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.8) 0%, rgba(30, 30, 35, 0.4) 25%, rgba(40, 40, 45, 0.2) 50%, rgba(30, 30, 35, 0.4) 75%, rgba(0, 0, 0, 0.8) 100%);
  position: relative;
  overflow: hidden;
  cursor: ns-resize;
  touch-action: none;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.dial-highlight {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 9vh;
  transform: translateY(-50%) translateZ(25vh);
  transform-style: preserve-3d;
  background: rgba(255, 255, 255, 0.05);
  border-top: 1px solid rgba(var(--accent-rgb), 0.6);
  border-bottom: 1px solid rgba(var(--accent-rgb), 0.6);
  pointer-events: none;
  z-index: 2;
}

.dial-number {
  font-size: 3.2vh;
  font-weight: 700;
  font-family: var(--font-main);
  font-variant-numeric: tabular-nums;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.dial-number.active {
  font-size: 7vh;
  font-weight: 800;
  color: var(--accent-color);
  text-shadow: 0 0 20px var(--accent-color), 0 0 60px rgba(var(--accent-rgb), 0.8);
  z-index: 10;
}

.dial-btn-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 100%;
  margin-top: 2vh;
  background: var(--border-color);
  /* This acts as divider lines */
  gap: 1px;
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.dial-side-btn {
  height: 7vh !important;
  min-height: 54px;
  background: var(--color-bg);
  border: none;
  color: var(--color-text);
  font-family: var(--font-main);
  font-weight: 800;
  font-size: 1.4vh;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  padding: 0 8px;
  position: relative;
}

.dial-side-btn:active {
  background: rgba(255, 255, 255, 0.08);
  /* Minimalist flash */
  transform: none;
  /* No scaling for grid stability */
}

/* Specific button placements or overrides if needed */
.dial-side-btn.full-width {
  grid-column: span 2;
}

/* Success/Fail States - Subtle and typography-driven */
.dial-side-btn.success {
  color: #00FF41;
  /* Pure terminal green */
}

.dial-side-btn.fail {
  color: #FF3B30;
  /* Swiss Red */
}

.dial-side-btn.one-two-active {
  color: #9b59b6;
  background: rgba(155, 89, 182, 0.05);
}

.dial-side-btn.one-two-default {
  color: var(--text-tertiary);
  opacity: 0.6;
}

.dial-side-btn .status-badge {
  font-size: 1vh;
  font-weight: 900;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  background: currentColor;
  color: var(--color-bg);
  border-radius: 0;
  margin-top: 2px;
  opacity: 0.9;
}

.dial-side-btn:active {
  background: var(--accent-color);
  border-color: var(--accent-color);
  color: #ffffff;
  transform: scale(0.95);
}

/* Dial Side Button States */
.dial-side-btn.success {
  background: rgba(0, 200, 255, 0.15) !important;
  color: #00c8ff !important;
  border-color: #00c8ff !important;
}

.dial-side-btn.fail {
  background: rgba(255, 71, 87, 0.15) !important;
  color: #ff4757 !important;
  border-color: #ff4757 !important;
  text-decoration: line-through;
}

.dial-side-btn.one-two-active {
  background: rgba(155, 89, 182, 0.2) !important;
  color: #9b59b6 !important;
  border-color: #9b59b6 !important;
  font-weight: 800 !important;
}

/* =========================================
   7. MODALS & OTHER OVERLAYS
   ========================================= */
/* Share Modal */
#share-modal {
  position: fixed;
  inset: 0;
  z-index: 10010;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(15px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fade-in 0.3s ease;
}

.share-modal-content {
  width: 90vw;
  max-width: 500px;
  background: #000000;
  border: 2px solid var(--color-text);
  padding: 3vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2.5vh;
}

.share-image-preview {
  width: 100%;
  border: 4px solid var(--color-text);
  background: #FFFFFF;
}

.share-hint {
  color: var(--text-secondary);
  font-size: 1.4vh;
  margin-top: 1vh;
  text-align: center;
}

.share-modal-btns {
  display: flex;
  gap: 1vh;
  width: 100%;
  margin-top: 2vh;
}

.share-modal-btns button {
  flex: 1;
  padding: 1.5vh;
  font-weight: 900;
  text-transform: uppercase;
  border: 2px solid var(--color-text);
  background: none;
  color: var(--color-text);
  cursor: pointer;
  font-size: 1.6vh;
  transition: all 0.2s ease;
}

.share-modal-btns button.primary {
  background: var(--accent-color);
  border-color: var(--accent-color);
  color: #FFFFFF;
}

.share-modal-btns button:active {
  transform: scale(0.95);
}

/* History Modal */
#history-modal {
  position: fixed;
  inset: 0;
  z-index: 10005;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fade-in 0.2s ease;
}

.history-modal-content {
  width: 90vw;
  max-width: 600px;
  background: #000000;
  border: 2px solid var(--color-text);
  padding: 3vh;
  display: flex;
  flex-direction: column;
  gap: 2vh;
  animation: slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.history-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 1.5vh;
  border-bottom: 2px solid var(--accent-color);
}

.history-modal-title {
  font-size: 1.8vh;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-color);
}

.history-close-btn {
  background: none;
  border: none;
  color: var(--color-text);
  font-size: 2.5vh;
  cursor: pointer;
  padding: 0 1vh;
  opacity: 0.6;
  transition: opacity 0.2s ease;
}

.history-close-btn:hover {
  opacity: 1;
}

.modal-input-group {
  display: flex;
  gap: 0;
  width: 100%;
}

.modal-direct-input {
  flex: 1;
  background: #000000;
  border: 2px solid var(--border-color);
  border-right: none;
  color: var(--color-text);
  padding: 1.5vh 2vw;
  font-size: 1.8vh;
  font-family: var(--font-main);
  outline: none;
  transition: border-color 0.2s ease;
}

.modal-direct-input:focus {
  border-color: var(--accent-color);
}

.modal-confirm-btn {
  background: var(--accent-color);
  border: 2px solid var(--accent-color);
  color: #FFFFFF;
  padding: 0 3vw;
  font-weight: 900;
  text-transform: uppercase;
  cursor: pointer;
  font-size: 1.6vh;
  transition: all 0.2s ease;
}

.modal-confirm-btn:active {
  background: #000000;
  color: var(--accent-color);
}

.history-list-title {
  font-size: 1.4vh;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-top: 1vh;
  letter-spacing: 0.05em;
}

.history-list {
  max-height: 55vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--border-color);
  border: 1px solid var(--border-color);
}

.history-item {
  padding: 1.8vh 2vw;
  background: var(--color-card);
  color: var(--color-text);
  font-size: 1.7vh;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: none;
}

.history-item:hover {
  background: var(--color-surface-hover);
}

.history-item:active {
  background: var(--accent-color);
  color: #FFFFFF;
}

.history-item.deleting {
  opacity: 0;
  transform: translateX(20px);
  pointer-events: none;
}

.history-item-delete {
  padding: 0.5vh 1vh;
  opacity: 0.3;
  transition: all 0.2s ease;
  font-size: 1.6vh;
}

.history-item:hover .history-item-delete {
  opacity: 0.8;
}

.history-item-delete:hover {
  color: var(--status-error);
  transform: scale(1.2);
}

.history-empty {
  padding: 4vh;
  text-align: center;
  color: var(--text-tertiary);
  font-style: italic;
  font-size: 1.6vh;
  background: var(--color-card);
}

/* Loading & Spinner */
.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 10020;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: white;
  gap: 2vh;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-left-color: var(--accent-color);
  animation: spin 1s linear infinite;
}

/* =========================================
   8. SPECIAL HIGHLIGHTS (WINNER GLOW)
   ========================================= */
.winner-column {
  position: relative;
  animation: winner-glow 2s infinite ease-in-out;
  box-shadow: inset 2px 0 0 rgba(var(--accent-rgb), 0.3), inset -2px 0 0 rgba(var(--accent-rgb), 0.3);
}

.second-column {
  position: relative;
  animation: second-glow 2.5s infinite ease-in-out;
  box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.15), inset -1px 0 0 rgba(255, 255, 255, 0.15);
}

.third-column {
  position: relative;
  animation: third-glow 3s infinite ease-in-out;
  box-shadow: inset 1px 0 0 rgba(205, 127, 50, 0.15), inset -1px 0 0 rgba(205, 127, 50, 0.15);
}

thead th.winner-column {
  color: var(--accent-color) !important;
}

tfoot td.winner-column {
  background: rgba(var(--accent-rgb), 0.2) !important;
  text-shadow: 0 0 20px var(--accent-color) !important;
  transform: scale(1.05);
  z-index: 1;
}

/* Tichu Specific Winners */
.tichu-winner {
  animation: winner-glow 2s infinite ease-in-out;
  box-shadow: inset 2px 0 0 rgba(255, 215, 0, 0.3), inset -2px 0 0 rgba(255, 215, 0, 0.3);
}

tfoot td.tichu-winner {
  background: rgba(255, 215, 0, 0.15) !important;
  color: #FFD700 !important;
}

tfoot td.tichu-loser {
  background: rgba(255, 71, 87, 0.05) !important;
  color: #FF4757 !important;
  opacity: 0.7;
}

.tichu-name-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2vh;
  padding: 0.5vh 0;
}

.tichu-player-name {
  font-size: 2.1vh;
  font-weight: 800;
  color: var(--color-text);
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.tichu-player-vs {
  font-size: 1.4vh;
  font-weight: 900;
  color: var(--accent-color);
  opacity: 0.8;
  font-family: var(--font-main);
  line-height: 1;
  margin: -0.2vh 0;
}

/* Ribbons & Medals */
.ribbon {
  position: relative;
  background: linear-gradient(135deg, #FFD700 0%, #FDB931 100%);
  color: #fff;
  font-weight: 900;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 6px 12px 12px 12px;
  margin: 5px auto 5px auto;
  clip-path: polygon(0 0, 100% 0, 100% 85%, 50% 100%, 0 85%);
  width: fit-content;
  min-width: 60px;
  text-align: center;
  z-index: 5;
  animation: fade-in 0.3s ease;
}

.ribbon.winner {
  border-top: 3px solid #FFF8D5;
}

.ribbon.loser {
  background: linear-gradient(135deg, #7f8c8d 0%, #2c3e50 100%);
  color: #ecf0f1;
  border-top: 3px solid #95a5a6;
}

.medal-badge {
  font-size: 28px;
  margin: 5px auto;
  display: block;
  animation: bounce-in 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* =========================================
   9. UTILITIES & ANIMATIONS
   ========================================= */

#credits {
  width: 100%;
  padding: 4vh 0;
  display: flex;
  justify-content: center;
  align-items: center;
}

.credits-content {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 1.2vh 20px;
  background: var(--color-card);
  border: 1px solid var(--border-color);
  font-size: 11px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: 0.1em;
}

@keyframes winner-glow {

  0%,
  100% {
    background: rgba(var(--accent-rgb), 0.05);
  }

  50% {
    background: rgba(var(--accent-rgb), 0.15);
  }
}

@keyframes second-glow {

  0%,
  100% {
    background: rgba(255, 255, 255, 0.03);
  }

  50% {
    background: rgba(255, 255, 255, 0.08);
  }
}

@keyframes third-glow {

  0%,
  100% {
    background: rgba(205, 127, 50, 0.03);
  }

  50% {
    background: rgba(205, 127, 50, 0.08);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slide-up {
  from {
    transform: translateY(20px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

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

@keyframes shine-btn {
  0% {
    left: -100%;
  }

  20%,
  100% {
    left: 200%;
  }
}