:root {
  --bg-1: #fff9eb;
  --bg-2: #f5f8ff;
  --ink: #2f2f2f;
  --muted: #6b6b6b;
  --panel: rgba(255, 255, 255, 0.86);
  --border: rgba(0, 0, 0, 0.08);
  --shadow: 0 22px 40px rgba(41, 44, 59, 0.1);
  --accent: #ff8c5a;
  --accent-2: #6f8dff;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Zen Kaku Gothic New", "Hiragino Kaku Gothic ProN", sans-serif;
  color: var(--ink);
  background: radial-gradient(1000px 700px at 20% -10%, #ffe9c7 0%, transparent 55%),
    radial-gradient(1000px 700px at 85% -5%, #dce7ff 0%, transparent 50%),
    linear-gradient(140deg, var(--bg-1), var(--bg-2));
  padding: 40px 18px;
  overflow-x: hidden;
}

.bg-shape {
  position: fixed;
  z-index: -1;
  filter: blur(1px);
  opacity: 0.5;
}

.bg-shape-left {
  width: 180px;
  height: 180px;
  border-radius: 46% 54% 38% 62% / 50% 43% 57% 50%;
  background: #ffca9f;
  left: -35px;
  bottom: 18%;
  animation: floatLeft 7s ease-in-out infinite;
}

.bg-shape-right {
  width: 220px;
  height: 220px;
  border-radius: 59% 41% 65% 35% / 43% 61% 39% 57%;
  background: #cad9ff;
  right: -70px;
  top: 14%;
  animation: floatRight 8s ease-in-out infinite;
}

.app {
  width: min(980px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 18px;
}

.hero,
.panel {
  backdrop-filter: blur(7px);
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: 28px;
}

.hero {
  padding: 28px;
  transform: translateY(14px);
  opacity: 0;
  animation: reveal 0.65s ease forwards;
}

.badge {
  margin: 0;
  display: inline-block;
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: 0.08em;
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 10px;
}

.hero h1 {
  margin: 14px 0 10px;
  line-height: 1.3;
  font-size: clamp(26px, 4vw, 40px);
}

.lead {
  margin: 0;
  color: var(--muted);
}

.panel {
  padding: 24px;
  opacity: 0;
  transform: translateY(16px);
  animation: reveal 0.65s ease forwards;
}

.input-panel {
  animation-delay: 0.08s;
}

.output-panel {
  animation-delay: 0.14s;
}

label,
button,
input,
textarea {
  font: inherit;
}

label {
  display: inline-block;
  font-weight: 700;
  margin-bottom: 8px;
}

input,
textarea {
  width: 100%;
  border: 1px solid #d6d6d6;
  border-radius: 16px;
  background: #ffffff;
  color: var(--ink);
}

.input-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.array-card {
  border: 1px solid #ececec;
  border-radius: 20px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.8);
}

.array-card h2 {
  margin: 2px 0 10px;
  font-size: 20px;
}

.rows {
  display: grid;
  gap: 8px;
}

.entry-row {
  display: block;
}

.entry-input {
  border-radius: 12px;
  padding: 10px 12px;
}

.add-row-wrap {
  margin-top: 16px;
}

.add-row-wrap .ghost {
  width: 100%;
}

.action-row {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

#shuffleButton,
#mixShuffleButton {
  border: 0;
  border-radius: 999px;
  padding: 16px 14px;
  min-height: 74px;
  font-size: clamp(20px, 3vw, 38px);
  font-weight: 900;
  letter-spacing: 0.03em;
  color: #6f6f6f;
  background: #e4e4e4;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.08), 0 10px 20px rgba(0, 0, 0, 0.09);
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
}

#shuffleButton:hover,
#mixShuffleButton:hover {
  filter: brightness(0.97);
}

#shuffleButton:active,
#mixShuffleButton:active {
  transform: translateY(2px) scale(0.998);
}

.output-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

h2 {
  margin: 0;
}

.ghost {
  border: 1px solid #d1d1d1;
  border-radius: 999px;
  background: white;
  color: var(--ink);
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 700;
}

#result {
  margin: 12px 0 0;
  padding: 14px;
  min-height: 110px;
  white-space: pre-wrap;
  word-break: break-word;
  border-radius: 16px;
  background: linear-gradient(130deg, #ffffff, #f2f6ff);
  border: none;
  line-height: 1.65;
  font-weight: 900;
  font-size: clamp(18px, 2.4vw, 26px);
  letter-spacing: 0.01em;
  color: #1c2447;
}

.memo-panel textarea {
  resize: vertical;
  min-height: 100px;
  padding: 12px 14px;
  line-height: 1.65;
}

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

@keyframes floatLeft {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-14px) rotate(5deg);
  }
}

@keyframes floatRight {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(16px) rotate(-6deg);
  }
}

@media (max-width: 680px) {
  body {
    padding: 18px 12px 30px;
  }

  .hero,
  .panel {
    border-radius: 22px;
    padding: 18px;
  }

  .hero h1 {
    margin-top: 12px;
    line-height: 1.4;
  }

  .input-grid {
    grid-template-columns: 1fr;
  }

  .action-row {
    grid-template-columns: 1fr;
  }

  #shuffleButton {
    font-size: clamp(20px, 8vw, 34px);
  }
}
