/* 
 * PROJECT: Game Menyusun Kata Aksara Jawa (Word Building Tetris)
 * STYLE: tetris.css (Canvas Mobile Flush & Clean Layout)
 */

@font-face {
  font-family: 'Ngayogyakarta';
  src: url('ngayogyann.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

:root {
  --bg-primary: #2B0507;
  --bg-card: #3D090C;
  --bg-board: #1C0305;
  --gold-primary: #D4AF37;
  --gold-light: #F3E5AB;
  --gold-dark: #AA820A;
  --cream-parchment: #FAF3E0;
  --text-dark: #231103;
  --green-success: #2E7D32;
  --font-aksara: 'Ngayogyakarta', 'Noto Sans Javanese', 'Javanese Text', serif;
  --font-latin: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

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

body {
  background: radial-gradient(circle at center, #4A0E12 0%, #1A0304 100%);
  color: var(--cream-parchment);
  font-family: var(--font-latin);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 2px;
  touch-action: manipulation;
}

/* Header */
.app-header {
  text-align: center;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--gold-primary);
  padding-bottom: 4px;
  width: 100%;
  max-width: 360px;
}

.app-title-aksara {
  font-family: var(--font-aksara);
  font-size: 1.0rem;
  color: var(--gold-primary);
  line-height: 1.8;
}

.app-title-latin {
  font-size: 0.8rem;
  letter-spacing: 1px;
  color: var(--gold-light);
  text-transform: uppercase;
  font-weight: 600;
}

/* Main Layout Grid */
.game-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  width: 100%;
  max-width: 360px;
}

.panel {
  background: var(--bg-card);
  border: 1px solid var(--gold-primary);
  border-radius: 8px;
  padding: 8px;
  width: 360px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

/* Panel Target Kata */
.target-panel {
  width: 360px;
  padding: 6px;
}

.panel-title {
  font-size: 0.85rem;
  color: var(--gold-light);
  border-bottom: 1px solid var(--gold-dark);
  padding-bottom: 3px;
  margin-bottom: 6px;
  text-align: center;
  font-weight: bold;
}

.word-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
  align-items: center;
}

.word-item {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(212, 175, 55, 0.4);
  border-radius: 5px;
  padding: 3px 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.word-item.completed {
  background: rgba(46, 125, 50, 0.4);
  border-color: var(--green-success);
}

.word-item .word-aksara {
  font-family: var(--font-aksara);
  font-size: 1.35rem;
  color: var(--gold-primary);
  line-height: 1;
}

.word-item .status-icon {
  font-size: 1.4rem;
}

/* Board Panel: Tanpa Ruang Kosong Samping */
.board-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 360px;
  background: transparent;
  border: none;
  padding: 0;
  box-shadow: none;
}

#tetris-area {
  width: 360px; /* 6 kolom x 60px */
  height: 480px; /* 8 baris x 60px */
  background-color: var(--bg-board);
  background-image: 
    linear-gradient(rgba(212, 175, 55, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(212, 175, 55, 0.08) 1px, transparent 1px);
  background-size: 60px 60px;
  border: 2px solid var(--gold-primary);
  border-radius: 6px;
  position: relative;
  overflow: visible;
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.8);
  touch-action: none;
}

/* Balok Tetris & Fit Aksara */
.block {
  width: 60px;
  height: 60px;
  position: absolute;
  background: linear-gradient(135deg, #7A191B 0%, #4A0E12 100%);
  border: 1.5px solid var(--gold-primary);
  border-radius: 5px;
  color: var(--gold-light);
  font-family: var(--font-aksara);
  font-size: 1.45rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  white-space: nowrap;
  overflow: visible;
  padding: 0;
  text-shadow: 0 0 3px rgba(0,0,0,0.9);
  box-shadow: inset 0 0 4px rgba(255, 215, 0, 0.3);
  user-select: none;
}

.block.next {
  position: relative;
  display: inline-flex;
}

.block-match {
  background: linear-gradient(135deg, #FFD700 0%, #B8860B 100%) !important;
  color: #000 !important;
  animation: pulseMatch 0.5s infinite alternate;
  z-index: 10;
}

@keyframes pulseMatch {
  from { transform: scale(1); box-shadow: 0 0 8px #FFD700; }
  to { transform: scale(1.05); box-shadow: 0 0 15px #FFD700; }
}

/* Dashboard Statistik & Menu */
.stats-panel {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 360px;
  padding: 8px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr) 50px;
  gap: 4px;
  align-items: center;
}

.stat-box {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--gold-dark);
  border-radius: 5px;
  padding: 4px 2px;
  text-align: center;
}

.stat-label {
  font-size: 0.6rem;
  color: var(--gold-light);
  text-transform: uppercase;
}

.stat-value {
  font-size: 1rem;
  font-weight: bold;
  color: var(--cream-parchment);
}

#next-puzzle-box {
  width: 40px;
  height: 40px;
  margin: 0 auto;
  background: var(--bg-board);
  border: 1px dashed var(--gold-dark);
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-group {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
}

.btn {
  background: linear-gradient(180deg, #D4AF37 0%, #AA820A 100%);
  color: var(--text-dark);
  border: none;
  padding: 7px;
  font-weight: bold;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.8rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.btn-secondary {
  background: linear-gradient(180deg, #6C757D 0%, #495057 100%);
  color: #fff;
}

/* Kontrol Layar Sentuh HP */
.mobile-controls {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  width: 360px;
  margin-top: 6px;
}

.touch-btn {
  background: rgba(212, 175, 55, 0.25);
  border: 1.5px solid var(--gold-primary);
  color: var(--gold-light);
  padding: 8px 0;
  font-size: 1rem;
  border-radius: 5px;
  touch-action: manipulation;
  user-select: none;
  cursor: pointer;
  text-align: center;
}

.touch-btn:active {
  background: var(--gold-primary);
  color: var(--text-dark);
}

/* Modal JSON Editor */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.85);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.modal-content {
  background: var(--bg-card);
  border: 2px solid var(--gold-primary);
  border-radius: 8px;
  padding: 12px;
  max-width: 320px;
  width: 100%;
}

.modal-title {
  font-size: 1rem;
  color: var(--gold-primary);
  margin-bottom: 6px;
  border-bottom: 1px solid var(--gold-dark);
  padding-bottom: 4px;
}

#json-editor-textarea {
  width: 100%;
  height: 150px;
  background: #111;
  color: #0f0;
  font-family: monospace;
  padding: 6px;
  border: 1px solid var(--gold-dark);
  border-radius: 5px;
  margin-bottom: 6px;
}

/* Footer */
.app-footer {
  text-align: center;
  margin-top: 10px;
  border-top: 1px solid var(--gold-primary);
  padding-top: 6px;
  padding-bottom: 6px;
  width: 100%;
  max-width: 360px;
  font-size: 0.75rem;
  color: var(--gold-light);
  letter-spacing: 0.5px;
}
