/* ============================================================
   TASK FIGHTER — Street Fighter pixel art theme
   ============================================================ */

:root {
  --bg:          #06061a;
  --bg-panel:    #0d0d2e;
  --bg-task:     #111132;
  --red:         #e60026;
  --red-dark:    #660011;
  --yellow:      #ffd700;
  --yellow-dark: #996600;
  --green:       #00c844;
  --green-bright:#00ff66;
  --blue:        #1a4fff;
  --blue-light:  #4477ff;
  --white:       #ffffff;
  --gray:        #666688;
  --border:      #2a2a6a;
  --border-bright:#4444aa;
  --hp-high:     #00dd55;
  --hp-mid:      #ddcc00;
  --hp-low:      #dd2200;
  --pri-high:    #ff3333;
  --pri-med:     #ffaa00;
  --pri-low:     #33cc66;
}

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Body / Background ───────────────────────────────────── */
body {
  font-family: 'Press Start 2P', monospace;
  background-color: var(--bg);
  color: var(--white);
  min-height: 100vh;
  overflow-x: hidden;
  /* Subtle grid */
  background-image:
    repeating-linear-gradient(0deg,   transparent, transparent 31px, rgba(255,255,255,0.025) 32px),
    repeating-linear-gradient(90deg,  transparent, transparent 31px, rgba(255,255,255,0.025) 32px);
}

/* Scanlines */
.scanlines {
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 3px,
    rgba(0,0,0,0.15) 3px,
    rgba(0,0,0,0.15) 4px
  );
  pointer-events: none;
  z-index: 9990;
}

/* ── Screen Flash ────────────────────────────────────────── */
#screen-flash {
  position: fixed;
  inset: 0;
  background: #ffffff;
  opacity: 0;
  pointer-events: none;
  z-index: 9995;
}

/* ── Flash Message (EXCELLENT! etc.) ─────────────────────── */
#flash-message {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: clamp(20px, 4vw, 42px);
  color: var(--yellow);
  text-shadow:
    4px  4px 0 var(--red),
    8px  8px 0 #440000,
   -2px -2px 0 rgba(0,0,0,0.6);
  pointer-events: none;
  z-index: 10000;
  opacity: 0;
  white-space: nowrap;
  letter-spacing: 3px;
}

/* ── Combo Display ───────────────────────────────────────── */
#combo-display {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9500;
  background: rgba(0,0,0,0.85);
  border: 3px solid var(--yellow);
  box-shadow: 4px 4px 0 var(--yellow-dark), inset 0 0 20px rgba(255,215,0,0.1);
  padding: 12px 18px;
  text-align: center;
}
#combo-display.hidden { display: none; }
#combo-count {
  display: block;
  font-size: clamp(28px, 5vw, 48px);
  color: var(--yellow);
  text-shadow: 3px 3px 0 var(--red);
  line-height: 1;
}
.combo-label {
  display: block;
  font-size: 8px;
  color: var(--red);
  margin-top: 6px;
  letter-spacing: 2px;
}

/* ── Corner Decorations ──────────────────────────────────── */
.corner {
  position: fixed;
  width: 60px;
  height: 60px;
  pointer-events: none;
  z-index: 5;
}
.corner-tl { top: 0;   left: 0;   }
.corner-tr { top: 0;   right: 0;  transform: scaleX(-1); }
.corner-bl { bottom: 0; left: 0;  transform: scaleY(-1); }
.corner-br { bottom: 0; right: 0; transform: scale(-1);  }

.corner-dot {
  position: absolute;
  top: 8px; left: 8px;
  width: 8px; height: 8px;
  background: var(--yellow);
  box-shadow: 0 0 6px var(--yellow);
  display: block;
}
.corner-line-h {
  position: absolute;
  top: 8px; left: 16px;
  width: 36px; height: 4px;
  background: var(--yellow);
  opacity: 0.6;
  display: block;
}
.corner-line-v {
  position: absolute;
  top: 16px; left: 8px;
  width: 4px; height: 36px;
  background: var(--yellow);
  opacity: 0.6;
  display: block;
}

/* ── Particles ───────────────────────────────────────────── */
.particle {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  image-rendering: pixelated;
}

/* ── Container ───────────────────────────────────────────── */
.container {
  max-width: 880px;
  margin: 0 auto;
  padding: 20px 16px 60px;
  position: relative;
  z-index: 1;
}

/* ── Header ──────────────────────────────────────────────── */
header {
  text-align: center;
  padding: 28px 0 20px;
  position: relative;
}
.header-vs {
  font-size: 10px;
  color: var(--red);
  letter-spacing: 8px;
  margin-bottom: 10px;
  opacity: 0.8;
}
.title {
  font-size: clamp(32px, 7vw, 60px);
  line-height: 1.25;
  letter-spacing: 6px;
  color: var(--yellow);
  text-shadow:
     5px  5px 0 var(--red),
    10px 10px 0 var(--red-dark),
    -2px -2px 0 rgba(255,255,180,0.3);
}
.subtitle {
  margin-top: 18px;
  font-size: 8px;
  color: var(--red);
  letter-spacing: 3px;
}
.header-deco {
  margin-top: 10px;
  font-size: 6px;
  color: var(--yellow-dark);
  letter-spacing: 1px;
}

/* ── Progress / Health Bar ───────────────────────────────── */
.progress-section {
  margin: 22px 0;
  padding: 14px 16px;
  background: var(--bg-panel);
  border: 4px solid var(--green);
  box-shadow: 6px 6px 0 rgba(0,200,68,0.25), inset 0 0 24px rgba(0,200,68,0.04);
}
.progress-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 7px;
  margin-bottom: 8px;
}
.p1-label { color: var(--green); }
.progress-name { color: var(--white); opacity: 0.7; }
.progress-pct { color: var(--green); }

.health-bar-wrap { position: relative; }
.health-bar-bg {
  background: #080818;
  border: 3px solid #222244;
  height: 28px;
  position: relative;
  overflow: hidden;
}
.health-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #00aa44, #00ff66 60%, #ccff00);
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
}
/* Shine stripe */
.health-bar-fill::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 50%;
  background: rgba(255,255,255,0.15);
}
/* Segment dividers */
.health-bar-segments {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    90deg,
    transparent,
    transparent 24px,
    rgba(0,0,0,0.4) 24px,
    rgba(0,0,0,0.4) 26px
  );
  pointer-events: none;
}
.task-stats {
  text-align: center;
  font-size: 7px;
  color: var(--gray);
  margin-top: 8px;
}

/* ── Pixel Panel ─────────────────────────────────────────── */
.pixel-panel {
  background: var(--bg-panel);
  border: 4px solid var(--border-bright);
  box-shadow: 6px 6px 0 #000, inset 0 0 0 2px rgba(80,80,180,0.1);
  padding: 18px;
  margin-bottom: 14px;
  position: relative;
}
.pixel-panel::before {
  content: '';
  position: absolute;
  top: 4px; left: 4px; right: 4px;
  height: 2px;
  background: rgba(255,255,255,0.07);
  pointer-events: none;
}
.panel-title {
  font-size: 8px;
  color: var(--yellow);
  letter-spacing: 2px;
  margin-bottom: 14px;
}

/* ── Form ────────────────────────────────────────────────── */
.form-row { margin-bottom: 10px; }
.form-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: stretch;
}

input[type="text"],
input[type="date"],
select {
  background: #06061a;
  border: 3px solid var(--border-bright);
  color: var(--white);
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  padding: 9px 8px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
  -webkit-appearance: none;
}
input[type="text"]:focus,
input[type="date"]:focus,
select:focus {
  border-color: var(--yellow);
  box-shadow: 0 0 12px rgba(255,215,0,0.25);
}

#task-input {
  width: 100%;
  font-size: 8px;
  padding: 12px 10px;
}

select {
  flex: 1;
  min-width: 90px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23ffd700'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 24px;
}
select option { background: #0d0d2e; }

input[type="date"] {
  flex: 1;
  min-width: 120px;
  color-scheme: dark;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  padding: 9px 12px;
  cursor: pointer;
  border: none;
  white-space: nowrap;
  transition: transform 0.08s, box-shadow 0.08s;
  user-select: none;
}
.btn:active { transform: translate(2px, 2px) !important; }

.btn-primary {
  background: var(--red);
  color: var(--white);
  border: 3px solid #ff6666;
  box-shadow: 4px 4px 0 var(--red-dark);
  letter-spacing: 1px;
}
.btn-primary:hover {
  background: #ff2244;
  box-shadow: 5px 5px 0 var(--red-dark);
  transform: translate(-1px, -1px);
}

.btn-done {
  background: #003311;
  color: var(--green-bright);
  border: 2px solid var(--green);
  box-shadow: 2px 2px 0 #001a08;
  font-size: 6px;
  padding: 6px 8px;
}
.btn-done:hover { background: #005522; transform: translate(-1px,-1px); }
.btn-done.is-done {
  background: #1a1a1a;
  color: #444;
  border-color: #333;
  box-shadow: 2px 2px 0 #000;
  cursor: default;
}

.btn-delete {
  background: #1a0000;
  color: var(--red);
  border: 2px solid var(--red);
  box-shadow: 2px 2px 0 #330000;
  font-size: 6px;
  padding: 6px 8px;
}
.btn-delete:hover { background: var(--red); color: var(--white); transform: translate(-1px,-1px); }

/* ── Search ──────────────────────────────────────────────── */
.search-section { margin-bottom: 14px; }
.search-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-panel);
  border: 3px solid var(--border-bright);
  padding: 4px 12px;
  transition: border-color 0.15s;
}
.search-wrap:focus-within {
  border-color: var(--yellow);
  box-shadow: 0 0 12px rgba(255,215,0,0.2);
}
.search-icon { font-size: 16px; opacity: 0.7; flex-shrink: 0; }
#search-input {
  flex: 1;
  background: transparent;
  border: none;
  box-shadow: none;
  font-size: 8px;
  padding: 8px 0;
  width: 100%;
}
#search-input:focus { border: none; box-shadow: none; }

/* ── Filter Tabs ─────────────────────────────────────────── */
.filter-tabs {
  display: flex;
  gap: 5px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.tab-btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 6px;
  padding: 7px 10px;
  cursor: pointer;
  background: var(--bg-panel);
  color: var(--gray);
  border: 2px solid var(--border);
  box-shadow: 2px 2px 0 #000;
  transition: all 0.1s;
  letter-spacing: 1px;
}
.tab-btn:hover { color: var(--white); border-color: var(--blue-light); }
.tab-btn.active {
  background: var(--yellow);
  color: #000;
  border-color: #fff;
  box-shadow: 3px 3px 0 var(--yellow-dark);
}

/* ── Task List ───────────────────────────────────────────── */
.task-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ── Empty State ─────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--gray);
}
.empty-sprite { font-size: 48px; display: block; margin-bottom: 16px; }
.empty-title  { font-size: 10px; margin-bottom: 12px; }
.empty-sub    { font-size: 7px; color: #444; margin-bottom: 16px; }
.empty-blink  { font-size: 7px; color: var(--red); animation: blink 1s step-end infinite; }

@keyframes blink { 50% { opacity: 0; } }

/* ── Task Item ───────────────────────────────────────────── */
.task-item {
  background: var(--bg-task);
  border: 3px solid var(--border-bright);
  box-shadow: 4px 4px 0 #000;
  padding: 12px;
  display: grid;
  grid-template-columns: 10px 1fr auto;
  gap: 12px;
  align-items: start;
  position: relative;
  overflow: hidden;
}
.task-item:hover { border-color: #5555cc; }
.task-item.completed { opacity: 0.55; border-color: #2a2a44; }
.task-item.completed .task-name {
  text-decoration: line-through;
  color: var(--gray);
}

/* Priority side-bar */
.priority-bar {
  align-self: stretch;
  min-height: 16px;
  border-radius: 1px;
  flex-shrink: 0;
}
.task-item.pri-high   .priority-bar { background: var(--pri-high);  box-shadow: 0 0 8px var(--pri-high);  }
.task-item.pri-medium .priority-bar { background: var(--pri-med);   box-shadow: 0 0 8px var(--pri-med);   }
.task-item.pri-low    .priority-bar { background: var(--pri-low);   box-shadow: 0 0 8px var(--pri-low);   }

/* Task content */
.task-content { min-width: 0; }
.task-name {
  font-size: 8px;
  line-height: 1.7;
  word-break: break-word;
  margin-bottom: 8px;
}
.task-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.badge {
  font-size: 6px;
  padding: 3px 6px;
  border: 1px solid;
  letter-spacing: 0.5px;
}
.badge-cat   { color: var(--blue-light);  border-color: var(--blue-light);  background: rgba(26,79,255,0.12); }
.badge-high  { color: var(--pri-high); border-color: var(--pri-high); background: rgba(255,51,51,0.1); }
.badge-medium{ color: var(--pri-med);  border-color: var(--pri-med);  background: rgba(255,170,0,0.1); }
.badge-low   { color: var(--pri-low);  border-color: var(--pri-low);  background: rgba(51,204,102,0.1); }
.badge-due   { color: var(--yellow);   border-color: var(--yellow);   background: rgba(255,215,0,0.08); }
.badge-due.overdue {
  color: var(--red);
  border-color: var(--red);
  background: rgba(230,0,38,0.1);
  animation: blink 1s step-end infinite;
}

/* Task actions */
.task-actions {
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: flex-end;
  flex-shrink: 0;
}

/* ── Fail Button ─────────────────────────────────────────── */
.btn-fail {
  background: #1a0000;
  color: #ff2222;
  border: 2px solid #cc0000;
  box-shadow: 2px 2px 0 #440000;
  font-size: 6px;
  padding: 6px 8px;
}
.btn-fail:hover:not(:disabled) {
  background: #880000;
  color: #fff;
  transform: translate(-1px,-1px);
  box-shadow: 3px 3px 0 #220000;
}
.btn-fail.is-failed,
.btn-fail:disabled {
  background: #0d0000;
  color: #440000;
  border-color: #330000;
  box-shadow: 1px 1px 0 #000;
  cursor: default;
}

/* ── Failed Task State ───────────────────────────────────── */
.task-item.failed {
  opacity: 0.5;
  border-color: #440000;
  background: #0d0000;
}
.task-item.failed .task-name {
  text-decoration: line-through;
  color: #882222;
}
.task-item.failed .priority-bar {
  background: #440000 !important;
  box-shadow: none !important;
}

/* ── Game Over Screen ────────────────────────────────────── */
#game-over-screen {
  position: fixed;
  inset: 0;
  background: #080000;
  z-index: 19999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
#game-over-screen.hidden { display: none; }

/* Pulsing red background glow */
#game-over-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, #3a0000 0%, #080000 65%);
  animation: goBgPulse 1.8s ease-in-out infinite;
  pointer-events: none;
}

.go-scanlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px, transparent 3px,
    rgba(0,0,0,0.35) 3px, rgba(0,0,0,0.35) 4px
  );
  pointer-events: none;
  z-index: 3;
}

.go-blood-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 160px;
  pointer-events: none;
  z-index: 2;
}

.go-content {
  position: relative;
  z-index: 4;
  text-align: center;
  padding: 24px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.go-title {
  font-size: clamp(52px, 11vw, 96px);
  line-height: 1.1;
  letter-spacing: 10px;
  color: #ffffff;
  text-shadow:
    5px 5px 0 #cc0000,
    10px 10px 0 #660000,
    0 0 50px #ff2200,
    0 0 100px rgba(255,0,0,0.4);
  animation: goFlicker 0.12s infinite alternate;
}

.go-skull {
  font-size: clamp(44px, 7vw, 72px);
  filter: drop-shadow(0 0 12px #ff0000);
  animation: goSpin 0.4s ease-in-out infinite alternate;
}

.go-shame {
  font-size: clamp(8px, 2.2vw, 15px);
  color: #ff3333;
  letter-spacing: 3px;
  text-shadow: 2px 2px 0 #000, 0 0 24px #ff0000;
  animation: goPulse 1.4s ease-in-out infinite;
  max-width: 700px;
}

.go-task-name {
  font-size: clamp(6px, 1.4vw, 9px);
  color: #884444;
  letter-spacing: 1px;
  max-width: 600px;
  word-break: break-word;
  line-height: 1.8;
  border: 1px solid #440000;
  padding: 6px 12px;
  background: rgba(100,0,0,0.15);
}

.go-sub {
  font-size: clamp(5px, 1vw, 7px);
  color: #660000;
  letter-spacing: 2px;
}

.go-retry-btn {
  background: #1a0000;
  color: #ff4444;
  border: 3px solid #cc0000;
  box-shadow: 4px 4px 0 #000, 0 0 20px rgba(255,0,0,0.25);
  font-size: 8px;
  padding: 14px 28px;
  margin-top: 10px;
  animation: blink 1s step-end infinite;
  letter-spacing: 2px;
}
.go-retry-btn:hover {
  background: #880000;
  color: #ffffff;
  animation: none;
  transform: translate(-2px,-2px);
  box-shadow: 6px 6px 0 #000, 0 0 30px rgba(255,0,0,0.5);
}

@keyframes goFlicker {
  0%   { opacity: 1;    text-shadow: 5px 5px 0 #cc0000, 10px 10px 0 #660000, 0 0 50px #ff2200; }
  100% { opacity: 0.82; text-shadow: 5px 5px 0 #ff0000, 10px 10px 0 #990000, 0 0 80px #ff4400, -2px 0 0 #ff0000; }
}

@keyframes goSpin {
  0%   { transform: rotate(-8deg) scale(1); }
  100% { transform: rotate(8deg) scale(1.08); }
}

@keyframes goPulse {
  0%, 100% { transform: scale(1);    opacity: 1; }
  50%       { transform: scale(1.04); opacity: 0.75; }
}

@keyframes goBgPulse {
  0%, 100% { background: radial-gradient(ellipse at center, #3a0000 0%, #080000 65%); }
  50%       { background: radial-gradient(ellipse at center, #5a0000 0%, #120000 65%); }
}

/* ── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar           { width: 8px; }
::-webkit-scrollbar-track     { background: var(--bg); }
::-webkit-scrollbar-thumb     { background: var(--border-bright); }
::-webkit-scrollbar-thumb:hover { background: var(--yellow); }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 560px) {
  .form-controls { flex-direction: column; }
  select, input[type="date"] { width: 100%; }
  .task-item { grid-template-columns: 8px 1fr; }
  .task-actions { grid-column: 2; flex-direction: row; justify-content: flex-end; }
  #combo-display { top: 8px; right: 8px; padding: 8px 10px; }
}
