/* Font Definitions */
@font-face {
  font-family: 'Kaiti';
  src: url('fonts/楷体.ttf') format('truetype');
}
@font-face {
  font-family: 'Xingshu';
  src: url('fonts/行书.ttf') format('truetype');
}
@font-face {
  font-family: 'Gangbi';
  src: url('fonts/钢笔.ttf') format('truetype');
}

/* Base Styles */
:root {
  font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  font-weight: 400;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  overflow: hidden;
  touch-action: none;
  background-color: #f0f0f0;
}

#app {
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Game Container */
.game-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 1024px;
  position: relative;
  transform-origin: center center;
}

.area {
  display: flex;
  width: 100%;
  justify-content: center;
}

/* Spell Area */
.spell-area {
  position: relative;
  margin-top: 50px;
  height: 266px;
}

/* Candidate Area */
.candidate-area {
  margin-top: 50px;
  margin-bottom: 50px;
  height: 200px;
  align-items: center;
}

.candidate-slots-container {
  display: flex;
  justify-content: center;
  width: 100%;
}

.controls-centered {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
}

/* Slot Styles */
.slot {
  width: 80px;
  height: 200px;
  border: 1px dashed #ccc;
  margin: 0 5px;
  box-sizing: border-box;
  background-color: rgba(255, 255, 255, 0.5);
}

.top-row, .bottom-row {
  display: flex;
  position: absolute;
  left: 0;
  right: 0;
  justify-content: center;
}

.top-row {
  top: 0;
}

.bottom-row {
  top: 66px;
}

/* Cards Layer */
.cards-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.card-wrapper {
  position: absolute;
  left: 0;
  top: 0;
  width: 80px;
  height: 200px;
  pointer-events: auto;
  will-change: transform;
  transition: transform 0.15s ease-out;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.card-wrapper.is-dragging {
  transition: none;
  cursor: grabbing;
}

/* Poem Card */
.poem-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 51px;
  gap: 34px;
  width: 100%;
  height: 100%;
  background-color: white;
  border: 1px solid #ccc;
  box-sizing: border-box;
  user-select: none;
  cursor: grab;
}

.poem-card:active {
  cursor: grabbing;
}

.char {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  font-size: 2rem;
  line-height: 1;
}

/* Buttons */
.btn {
  font-size: 2rem;
  padding: 10px 30px;
  cursor: pointer;
  color: white;
  background-color: #1a1a1a;
  border: 1px solid transparent;
  border-radius: 8px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.btn:active {
  opacity: 0.8;
}

/* Question Indicator */
.q-indicator {
  position: absolute;
  top: 60px;
  left: 30px;
  font-size: 3rem;
  font-weight: bold;
  color: #DDD;
  z-index: 10;
  font-family: system-ui, -apple-system, sans-serif;
}

/* Hidden state */
.hidden {
  display: none !important;
}

