@import url('https://fonts.googleapis.com/css2?family=Zen+Maru+Gothic:wght@300;400;500;700&display=swap');

:root {
  --bg-light: #fdfdfd;
  --bg-sky: linear-gradient(135deg, #f0f9ff 0%, #e8f4f8 100%);
  --card-bg: rgba(255, 255, 255, 0.9);
  --card-border: rgba(226, 232, 240, 0.5);
  --glass-bg: rgba(255, 255, 255, 0.6);
  --glass-border: rgba(255, 255, 255, 0.8);
  --text-primary: #475569;
  --text-secondary: #94a3b8;
  --accent-soft-blue: #bae6fd;
  --accent-navy: #1e3a5f;
  --accent-navy-light: #e0eaf5;
  --accent-glow: rgba(30, 58, 95, 0.1);
  --danger-muted: #cbd5e1;
  --transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
}

* {
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  padding: 0;
  font-family: 'Zen Maru Gothic', sans-serif;
  background: var(--bg-light);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  overflow-y: scroll;
  overflow-x: hidden;
  line-height: 1.8;
  letter-spacing: 0.03em;
}

/* Background Animated Blobs (Cloud-like) */
.bg-blobs {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  background: var(--bg-sky);
  overflow: hidden;
}

.blob {
  position: absolute;
  width: 800px;
  height: 800px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.8) 0%, transparent 70%);
  border-radius: 50%;
  filter: blur(100px);
  animation: float 30s infinite alternate;
  opacity: 0.6;
}

.blob:nth-child(2) {
  background: radial-gradient(circle, rgba(186, 230, 253, 0.4) 0%, transparent 70%);
  width: 1000px;
  height: 1000px;
  left: 40%;
  top: -10%;
  animation-duration: 40s;
  animation-delay: -5s;
}

.blob:nth-child(3) {
  background: radial-gradient(circle, rgba(30, 58, 95, 0.08) 0%, transparent 70%);
  width: 600px;
  height: 600px;
  right: -10%;
  bottom: -10%;
  animation-duration: 35s;
  animation-delay: -15s;
}

@keyframes float {
  0% {
    transform: translate(-5%, -5%) scale(1);
  }

  100% {
    transform: translate(5%, 5%) scale(1.1);
  }
}

#app {
  width: 100%;
  max-width: 900px;
  min-height: 100vh;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

/* Heavenly Glass Containers */
.glass-panel {
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border: 1px solid var(--glass-border);
  border-radius: 40px;
  padding: 3.5rem;
  box-shadow: 0 10px 40px rgba(148, 163, 184, 0.1);
  animation: fadeIn 1.5s cubic-bezier(0.16, 1, 0.3, 1);
  margin: 2rem 0;
}

h1,
h2,
h3 {
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-top: 0;
  color: #1e293b;
}

.title-glow {
  background: linear-gradient(to bottom right, #1e293b, #64748b);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
  line-height: 1.4;
  display: block;
}

/* Buttons */
.btn {
  padding: 0.8rem 2rem;
  border-radius: 50px;
  border: 1px solid var(--accent-navy);
  background: white;
  color: var(--accent-navy);
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  box-shadow: 0 4px 10px rgba(30, 58, 95, 0.1);
}

.btn:hover {
  background: var(--accent-navy);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(30, 58, 95, 0.2);
}

.btn-primary {
  background: var(--accent-navy-light);
  color: var(--accent-navy);
  border: 1px solid #b3cde0;
}

.btn-primary:hover {
  background: #b3cde0;
  transform: translateY(-2px);
}

/* Game Cards - Soft and Precious */
.game-card {
  aspect-ratio: 2 / 3;
  background: white;
  border: 2px solid var(--card-border);
  border-radius: 16px;
  padding: 0.8rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.02);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-primary);
}

.game-card img {
  width: 100%;
  height: 65%;
  object-fit: cover;
  border-radius: 10px;
  margin-bottom: 0.8rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.game-card span {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 35%;
  width: 100%;
  word-break: break-all;
  line-height: 1.4;
}

.game-card .category-label {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 0.7rem;
  font-weight: 600;
  background: rgba(30, 58, 95, 0.1);
  color: var(--accent-navy);
  padding: 3px 8px;
  border-radius: 8px;
  height: auto;
  width: auto;
  line-height: 1.2;
  z-index: 2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 70%;
}

.game-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent, rgba(255, 255, 255, 0.8), transparent);
  transform: translateX(-100%);
  transition: 0.8s;
}

.game-card:hover {
  transform: translateY(-6px) scale(1.03);
  border-color: var(--accent-soft-blue);
  box-shadow: 0 20px 25px -5px rgba(186, 230, 253, 0.2);
}

.game-card:hover::after {
  transform: translateX(100%);
}

.game-card.selected {
  border-color: var(--danger-muted);
  background: #f8fafc;
  transform: scale(0.95);
  opacity: 0.5;
  filter: grayscale(0.8);
}

.game-card.selected::before {
  content: 'お別れ';
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 0.65rem;
  background: var(--danger-muted);
  color: white;
  padding: 2px 10px;
  border-radius: 20px;
}

/* Card Grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin: 1.5rem 0;
}

@media (max-width: 900px) {
  .card-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 600px) {
  #app {
    padding: 0.5rem;
  }

  .glass-panel {
    padding: 1.5rem 1rem;
    border-radius: 20px;
    margin: 0.5rem 0;
  }

  h1 {
    font-size: 1.3rem;
  }

  h2 {
    font-size: 1.1rem;
  }

  h3 {
    font-size: 1rem;
  }

  .card-grid {
    grid-template-columns: 1fr;
    max-width: 280px;
    margin-left: auto;
    margin-right: auto;
  }
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

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

@keyframes slideIn {
  from {
    transform: translateX(30px);
    opacity: 0;
  }

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

/* Editor Specific Styles */
.editor-controls {
  margin-bottom: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

input,
textarea {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 0.8rem 1rem;
  color: var(--text-primary);
  font-family: inherit;
  width: 100%;
  font-size: 0.9rem;
  transition: var(--transition);
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent-soft-blue);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

textarea {
  resize: vertical;
  min-height: 60px;
}

/* Screen Layouts */
.screen {
  display: none;
  flex-direction: column;
  width: 100%;
}

.screen.active {
  display: flex;
}