:root {
  --bg-yellow: #FFE600;
  --bg-pink: #FF3366;
  --bg-cyan: #00E5FF;
  --bg-purple: #7B2CBF;
  --bg-green: #00E676;
  --ink: #1A1A1A;
  --card-bg: #FFFFFF;
  --shadow: 4px 4px 0px #1A1A1A;
  --shadow-lg: 6px 6px 0px #1A1A1A;
  --shadow-sm: 2px 2px 0px #1A1A1A;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: #222;
  background-image: radial-gradient(#444 15%, transparent 16%), radial-gradient(#444 15%, transparent 16%);
  background-size: 24px 24px;
  background-position: 0 0, 12px 12px;
  color: var(--ink);
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
}

.app-wrapper {
  width: 100%;
  max-width: 480px;
  min-height: 100dvh;
  background: var(--bg-yellow);
  position: relative;
  display: flex;
  flex-direction: column;
  border-left: 4px solid var(--ink);
  border-right: 4px solid var(--ink);
  box-shadow: 0 0 40px rgba(0,0,0,0.6);
  overflow: hidden;
}

@media (min-width: 520px) {
  .app-wrapper {
    min-height: 860px;
    max-height: 95dvh;
    border-radius: 28px;
    border: 5px solid var(--ink);
  }
}

/* Header */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: #fff;
  border-bottom: 4px solid var(--ink);
  z-index: 10;
}

.brand-badge {
  font-weight: 900;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.brand-badge span.crazy-tag {
  background: var(--bg-pink);
  color: #fff;
  padding: 2px 8px;
  border: 2px solid var(--ink);
  border-radius: 6px;
  transform: rotate(-3deg);
  display: inline-block;
  box-shadow: var(--shadow-sm);
}

.top-actions {
  display: flex;
  gap: 8px;
}

.icon-btn {
  background: var(--bg-cyan);
  border: 2.5px solid var(--ink);
  border-radius: 10px;
  padding: 6px 10px;
  font-weight: 800;
  font-size: 0.85rem;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.1s, box-shadow 0.1s;
  display: flex;
  align-items: center;
  gap: 4px;
}

.icon-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 0px 0px 0px var(--ink);
}

/* Main Screen Container */
.screen {
  flex: 1;
  display: none;
  flex-direction: column;
  padding: 16px;
  overflow-y: auto;
}

.screen.active {
  display: flex;
  animation: popIn 0.25s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Home Screen */
.hero-card {
  background: #fff;
  border: 4px solid var(--ink);
  border-radius: 20px;
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  margin-bottom: 14px;
  position: relative;
  overflow: hidden;
}

.hero-Burst {
  display: inline-block;
  background: var(--bg-pink);
  color: #fff;
  font-weight: 900;
  font-size: 0.78rem;
  padding: 4px 12px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  margin-bottom: 6px;
  transform: rotate(-2deg);
}

.hero-title {
  font-size: 1.85rem;
  font-weight: 900;
  line-height: 1.15;
  margin-bottom: 6px;
  color: var(--ink);
  text-shadow: 2px 2px 0px var(--bg-cyan);
}

.hero-sub {
  font-size: 0.85rem;
  font-weight: 700;
  color: #444;
  margin-bottom: 10px;
}

.hero-showcase {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
}

.hero-thumb {
  width: 72px;
  height: 72px;
  border-radius: 12px;
  border: 3px solid var(--ink);
  object-fit: cover;
  box-shadow: var(--shadow-sm);
  background: #eee;
}

.hero-thumb:nth-child(odd) {
  transform: rotate(-3deg);
}
.hero-thumb:nth-child(even) {
  transform: rotate(3deg);
}

/* Pack Selector Box */
.pack-selector-box {
  background: #fff;
  border: 3.5px solid var(--ink);
  border-radius: 16px;
  padding: 10px 12px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}

.pack-selector-label {
  font-size: 0.8rem;
  font-weight: 900;
  color: var(--ink);
  margin-bottom: 6px;
  display: block;
}

.pack-select {
  width: 100%;
  padding: 10px 12px;
  font-size: 0.92rem;
  font-weight: 900;
  border: 3px solid var(--ink);
  border-radius: 10px;
  background: #FFF9C4;
  color: var(--ink);
  font-family: inherit;
  cursor: pointer;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.stat-box {
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 12px;
  padding: 8px 6px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.stat-label {
  font-size: 0.72rem;
  font-weight: 800;
  color: #555;
}

.stat-value {
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--bg-pink);
}

.mode-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-primary, .mode-btn {
  width: 100%;
  border: 3.5px solid var(--ink);
  border-radius: 16px;
  padding: 13px 16px;
  font-size: 1.02rem;
  font-weight: 900;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.1s, box-shadow 0.1s;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  font-family: inherit;
}

.btn-primary:active, .mode-btn:active {
  transform: translate(3px, 3px);
  box-shadow: 1px 1px 0px var(--ink);
}

.mode-btn.pink {
  background: var(--bg-pink);
  color: #fff;
}

.mode-btn.cyan {
  background: var(--bg-cyan);
  color: var(--ink);
}

.mode-btn.green {
  background: var(--bg-green);
  color: var(--ink);
}

.mode-btn.white {
  background: #fff;
  color: var(--ink);
}

.mode-btn-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mode-btn-desc {
  font-size: 0.76rem;
  font-weight: 700;
  opacity: 0.9;
}

.mode-badge {
  font-size: 1.4rem;
}

/* Quiz Screen */
.quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  gap: 8px;
}

.progress-bar-wrap {
  flex: 1;
  height: 16px;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 99px;
  overflow: hidden;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  background: var(--bg-pink);
  width: 20%;
  transition: width 0.3s ease;
}

.combo-pill {
  background: #fff;
  border: 2.5px solid var(--ink);
  border-radius: 99px;
  padding: 3px 10px;
  font-weight: 900;
  font-size: 0.8rem;
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
}

.question-card {
  background: #fff;
  border: 3.5px solid var(--ink);
  border-radius: 18px;
  padding: 12px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  position: relative;
}

.question-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.scene-tag {
  display: inline-block;
  background: var(--ink);
  color: var(--bg-yellow);
  font-size: 0.75rem;
  font-weight: 900;
  padding: 3px 10px;
  border-radius: 6px;
}

.q-counter-tag {
  font-size: 0.78rem;
  font-weight: 900;
  color: #555;
}

.illustration-box {
  width: 100%;
  height: 215px;
  background: #F4F6F9;
  border: 3px solid var(--ink);
  border-radius: 14px;
  margin-bottom: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 0 10px rgba(0,0,0,0.08);
}

.illustration-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
  transition: transform 0.25s ease;
}

.illustration-box:hover .illustration-img {
  transform: scale(1.03);
}

.jp-prompt {
  font-size: 1.08rem;
  font-weight: 900;
  line-height: 1.42;
  color: var(--ink);
  text-align: center;
  padding: 4px 2px;
}

.sub-hint {
  font-size: 0.78rem;
  color: #666;
  text-align: center;
  font-weight: 700;
  margin-top: 4px;
}

/* Choices */
.choices-container {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.choice-btn {
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 14px;
  padding: 11px 13px;
  font-size: 0.94rem;
  font-weight: 800;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.08s, background 0.15s;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: inherit;
  line-height: 1.32;
}

.choice-btn:active:not(:disabled) {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0px var(--ink);
}

.choice-index {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--bg-yellow);
  border: 2px solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.choice-btn.correct {
  background: var(--bg-green);
  transform: scale(1.01);
}

.choice-btn.wrong {
  background: #FF6B6B;
  color: #fff;
}

/* Sort Mode */
.sort-slots {
  min-height: 58px;
  background: #FFF9C4;
  border: 3px dashed var(--ink);
  border-radius: 14px;
  padding: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  align-items: center;
}

.sort-pool {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 12px;
}

.word-chip {
  background: #fff;
  border: 2.5px solid var(--ink);
  border-radius: 10px;
  padding: 8px 12px;
  font-weight: 800;
  font-size: 0.92rem;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  user-select: none;
}

.word-chip:active {
  transform: translate(1px, 1px);
}

.word-chip.used {
  opacity: 0.25;
  pointer-events: none;
}

/* Feedback Drawer / Modal */
.feedback-card {
  margin-top: 12px;
  background: #fff;
  border: 4px solid var(--ink);
  border-radius: 18px;
  padding: 14px;
  box-shadow: var(--shadow-lg);
  display: none;
  animation: popIn 0.22s ease-out;
}

.feedback-card.show {
  display: block;
}

.feedback-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 2.5px dashed #ddd;
}

.feedback-status {
  font-size: 1.2rem;
  font-weight: 900;
}

.feedback-status.ok {
  color: #00A854;
}

.feedback-status.ng {
  color: var(--bg-pink);
}

.tts-btn {
  background: var(--bg-cyan);
  border: 2.5px solid var(--ink);
  border-radius: 99px;
  padding: 6px 12px;
  font-weight: 900;
  font-size: 0.8rem;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.en-answer-box {
  background: #F4F6F9;
  border: 2px solid var(--ink);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 8px;
}

.en-sentence {
  font-size: 1rem;
  font-weight: 900;
  color: var(--ink);
  margin-bottom: 3px;
}

.en-katakana {
  font-size: 0.76rem;
  color: #555;
  font-weight: 700;
}

.tsukkomi-box {
  background: #FFF3CD;
  border: 2px solid var(--ink);
  border-radius: 10px;
  padding: 9px 11px;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.45;
  margin-bottom: 10px;
}

.grammar-point {
  font-size: 0.8rem;
  color: #333;
  background: #E8F5E9;
  border: 2px solid var(--ink);
  border-radius: 10px;
  padding: 8px 10px;
  margin-bottom: 12px;
  font-weight: 700;
}

/* Collection / Dictionary Screen */
.collection-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.collection-item {
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 14px;
  padding: 12px;
  box-shadow: var(--shadow-sm);
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.collection-thumb {
  width: 78px;
  height: 78px;
  border-radius: 10px;
  border: 2.5px solid var(--ink);
  object-fit: cover;
  flex-shrink: 0;
  background: #eee;
}

.collection-body {
  flex: 1;
  min-width: 0;
}

.collection-item.locked {
  background: #eee;
  opacity: 0.8;
}

/* Generator / Custom Crazy Maker */
.slot-machine-box {
  background: #fff;
  border: 3.5px solid var(--ink);
  border-radius: 18px;
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
  text-align: center;
}

.slot-part {
  background: #FFF9C4;
  border: 2.5px solid var(--ink);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 8px;
  font-weight: 900;
}

/* Modal for QR / Share */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  display: none;
  justify-content: center;
  align-items: center;
  padding: 16px;
  z-index: 100;
}

.modal-overlay.open {
  display: flex;
}

.modal-box {
  background: #fff;
  border: 4px solid var(--ink);
  border-radius: 20px;
  padding: 20px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

/* Floating animations */
@keyframes floatSlow {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-6px); }
}

.float-anim {
  animation: floatSlow 2.2s ease-in-out infinite;
}
