/* FreeCell H5 - Freecell-only styles (standard CSS) */

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

html,
body {
  width: 100%;
  height: 100%;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: #f9fafb;
  background: #000000;
}

.fc-root {
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
}

.fc-screen {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 480px;
  max-height: 900px;
  display: flex;
  flex-direction: column;
}

.fc-hidden {
  display: none !important;
}

/* Splash */
.fc-splash {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000000;
  color: #ffffff;
}

.fc-splash__logo {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.fc-splash__publisher {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  font-size: 0.75rem;
  opacity: 0.7;
}

/* Main layout */
.fc-main {
  padding: 0.75rem 0.5rem 0.75rem;
  border-radius: 1rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.8);
}

.fc-top {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.fc-top-left,
.fc-top-right {
  display: flex;
  flex: 1 1 0;
  gap: 0.25rem;
}

.fc-freecell-slot,
.fc-foundation-slot {
  flex: 1 1 0;
  aspect-ratio: 2 / 3;
  border-radius: 0.35rem;
  border: 1px dashed rgba(255, 255, 255, 0.35);
  background: rgba(0, 0, 0, 0.25);
  position: relative;
  overflow: hidden;
}

.fc-foundation-slot::before {
  content: "";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  opacity: 0.22;
  pointer-events: none;
}

.fc-foundation-slot[data-suit="S"]::before {
  content: "♠";
  color: rgba(249, 250, 251, 0.7);
}

.fc-foundation-slot[data-suit="H"]::before {
  content: "♥";
  color: rgba(248, 113, 113, 0.9);
}

.fc-foundation-slot[data-suit="D"]::before {
  content: "♦";
  color: rgba(248, 113, 113, 0.9);
}

.fc-foundation-slot[data-suit="C"]::before {
  content: "♣";
  color: rgba(249, 250, 251, 0.7);
}

.fc-tableau {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 0.3rem;
  padding: 0.25rem 0.05rem;
  align-items: flex-start;
}

.fc-column {
  position: relative;
  min-height: 2.5rem;
}

/* Card placeholder */
.fc-card {
  position: absolute;
  left: 0;
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: 0.3rem;
  background: #ffffff;
  color: #000000;
  font-weight: 600;
  font-size: 0.85rem;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.6);
  user-select: none;
  touch-action: none;
  cursor: grab;
  opacity: 1;
}

.fc-card:active {
  cursor: grabbing;
}

.fc-card--red {
  color: #d62839;
}

.fc-card--black {
  color: #111827;
}

/* Dragging highlight */
.fc-card--dragging {
  outline: 2px solid rgba(250, 204, 21, 0.9);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.9);
}

/* Card corners */
.fc-card-corner {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1;
}

.fc-card-corner--top-left {
  top: 0.16rem;
  left: 0.18rem;
}

.fc-card-corner--bottom-right {
  bottom: 0.16rem;
  right: 0.18rem;
}
.fc-card-corner--top-right {
  top: 0.16rem;
  right: 0.18rem;
  align-items: flex-end;
}

.fc-card-corner--bottom-left {
  bottom: 0.16rem;
  left: 0.18rem;
  align-items: flex-start;
}

.fc-card-rank {
  font-weight: 700;
  font-size: 0.75rem;
}

.fc-card-suit {
  font-size: 0.65rem;
}

/* Hint highlight */
.fc-card--hint {
  outline: 2px solid rgba(56, 189, 248, 0.9);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.9);
}

/* Drag layer for moving stacks */
.fc-drag-layer {
  position: fixed;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 100;
}

.fc-drag-layer-inner {
  position: absolute;
}

.fc-bottom-bar {
  display: flex;
  gap: 0.3rem;
  margin-top: 0.3rem;
}

.fc-btn {
  flex: 1 1 0;
  border-radius: 999px;
  border: none;
  padding: 0.4rem 0.3rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  background: rgba(15, 23, 42, 0.85);
  color: #e5e7eb;
  cursor: pointer;
}
.fc-btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.fc-btn--primary {
  background: linear-gradient(135deg, #4ade80, #22c55e);
  color: #052e16;
}

.fc-btn--secondary {
  background: rgba(15, 23, 42, 0.9);
}

.fc-status-bar {
  display: flex;
  justify-content: space-between;
  gap: 0.4rem;
  margin-top: 0.35rem;
  font-size: 0.75rem;
  opacity: 0.85;
}

.fc-status-item {
  flex: 1 1 0;
}

/* Modal */
.fc-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.fc-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}

.fc-modal-content {
  position: relative;
  background: rgba(15, 23, 42, 0.98);
  border-radius: 0.9rem;
  padding: 1rem 1.25rem;
  width: 90%;
  max-width: 360px;
  color: #e5e7eb;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.9);
}

.fc-modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.fc-modal-body {
  font-size: 0.85rem;
}

.fc-modal-actions {
  margin-top: 1rem;
  display: flex;
  justify-content: center;
}

.fc-modal-footer {
  margin-top: 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.fc-modal-note {
  margin-top: 0.75rem;
  font-size: 0.75rem;
  opacity: 0.8;
}

.fc-radio-option {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.3rem;
}

.fc-radio-label--easy {
  color: #4ade80;
}

.fc-setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.fc-setting-group {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.fc-setting-label {
  font-size: 0.8rem;
  opacity: 0.9;
}

/* Switch */
.fc-switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 20px;
}

.fc-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.fc-switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #4b5563;
  border-radius: 999px;
  transition: 0.2s;
}

.fc-switch-slider::before {
  content: "";
  position: absolute;
  height: 16px;
  width: 16px;
  left: 2px;
  top: 2px;
  border-radius: 999px;
  background: #e5e7eb;
  transition: 0.2s;
}

.fc-switch input:checked + .fc-switch-slider {
  background-color: #22c55e;
}

.fc-switch input:checked + .fc-switch-slider::before {
  transform: translateX(18px);
}

/* Theme buttons */
.fc-theme-buttons {
  display: flex;
  gap: 0.4rem;
}

.fc-theme-btn {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 2px solid rgba(15, 23, 42, 0.9);
  cursor: pointer;
}

.fc-theme-btn--green {
  background: #14532d;
}

.fc-theme-btn--red {
  background: #7f1d1d;
}

.fc-theme-btn--blue {
  background: #1e3a8a;
}

.fc-theme-btn--gray {
  background: #374151;
}

.fc-version {
  font-size: 0.7rem;
  opacity: 0.7;
}

/* Victory */
.fc-modal-victory-content {
  text-align: center;
}

.fc-victory-banner {
  display: inline-block;
  padding: 0.4rem 1.1rem;
  margin-bottom: 0.6rem;
  border-radius: 999px;
  background: linear-gradient(135deg, #facc15, #f97316);
  color: #78350f;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.fc-victory-difficulty {
  font-size: 0.9rem;
  margin-bottom: 0.6rem;
}

.fc-victory-stats {
  font-size: 0.8rem;
  margin-bottom: 0.8rem;
}

.fc-stat-row {
  display: flex;
  justify-content: space-between;
  margin: 0.2rem 0;
}

/* Toast */
.fc-toast {
  position: fixed;
  left: 50%;
  bottom: 1.3rem;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.95);
  color: #e5e7eb;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  font-size: 0.75rem;
  z-index: 60;
}

/* Themes */
.fc-theme-green .fc-main {
  background: radial-gradient(circle at top, #166534, #052e16 70%);
}

.fc-theme-red .fc-main {
  background: radial-gradient(circle at top, #7f1d1d, #450a0a 70%);
}

.fc-theme-blue .fc-main {
  background: radial-gradient(circle at top, #1d4ed8, #020617 70%);
}

.fc-theme-gray .fc-main {
  background: radial-gradient(circle at top, #374151, #030712 70%);
}

@media (max-width: 768px) {
  .fc-root {
    padding: 0;
  }

  .fc-main {
    border-radius: 0;
  }

  .fc-btn {
    font-size: 0.7rem;
    padding: 0.35rem 0.25rem;
  }
}

/* Undo animation */
.fc-board-undo {
  animation: fc-undo-flash 0.18s ease-out;
}

@keyframes fc-undo-flash {
  from {
    transform: scale(1.02);
    opacity: 0.9;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}