* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  max-width: 600px;
  margin: 0 auto;
  padding: 20px;
  background: #f5f5f5;
  color: #333;
}

h1 {
  text-align: center;
  margin-bottom: 20px;
  font-size: 1.8em;
}

#auth-status {
  text-align: center;
  margin-top: 40px;
}
#auth-status p {
  margin-bottom: 15px;
  font-size: 1.1em;
}
#login-btn {
  background: #4caf50;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 1em;
  cursor: pointer;
}

#app {
  display: flex;
  flex-direction: column;
  height: 80vh;
}

.mode-switch {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}
.mode-btn {
  flex: 1;
  padding: 10px;
  border: 2px solid #4caf50;
  background: white;
  color: #4caf50;
  border-radius: 8px;
  font-size: 0.9em;
  cursor: pointer;
  transition: 0.2s;
}
.mode-btn.active {
  background: #4caf50;
  color: white;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

/* 送礼对象选择器 */
.recipient-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding: 8px 12px;
  background: white;
  border-radius: 8px;
  border: 1px solid #ddd;
  flex: 1 1 100%;
  min-width: 200px;
}
.recipient-selector label {
  white-space: nowrap;
  font-size: 0.9em;
  font-weight: bold;
  color: #333;
}
.recipient-selector select {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 0.9em;
  background: white;
  cursor: pointer;
}
.recipient-selector select:focus {
  outline: none;
  border-color: #4caf50;
  box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.1);
}

/* 可折叠维度面板 */
.dimension-panel {
  margin-bottom: 10px;
  border-radius: 8px;
  overflow: hidden;
  flex: 1 1 100%;
}
.toggle-btn {
  width: 100%;
  padding: 10px 14px;
  background: #333;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.9em;
  cursor: pointer;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: 0.2s;
}
.toggle-btn:hover {
  background: #444;
}
#toggle-icon {
  font-size: 0.7em;
  transition: transform 0.2s;
  display: inline-block;
}
#toggle-icon.open {
  transform: rotate(90deg);
}
.dimension-options-collapsible {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  background: white;
  border: 1px solid #ddd;
  border-top: none;
  border-radius: 0 0 8px 8px;
}
.dim-option-inline {
  flex: 1 1 calc(50% - 8px);
  min-width: 80px;
  padding: 10px 6px;
  border: 2px solid #ddd;
  background: white;
  border-radius: 8px;
  font-size: 0.85em;
  cursor: pointer;
  transition: 0.2s;
  text-align: center;
}
.dim-option-inline:hover {
  background: #f0f0f0;
  border-color: #4caf50;
}

.tags-area {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 24px;
  flex: 1 1 100%;
}
.tag {
  background: #e0e0e0;
  color: #333;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.8em;
  display: flex;
  align-items: center;
  gap: 4px;
}
.tag button {
  background: none;
  border: none;
  color: #999;
  cursor: pointer;
  font-size: 1em;
  padding: 0 2px;
}

#chat-box {
  flex: 1;
  overflow-y: auto;
  border: 1px solid #ddd;
  padding: 10px;
  margin: 10px 0;
  background: white;
  border-radius: 8px;
}
.message {
  margin-bottom: 12px;
  padding: 8px 12px;
  border-radius: 12px;
  max-width: 85%;
  word-wrap: break-word;
  line-height: 1.5;
}
.user-message {
  background: #e0f7fa;
  text-align: right;
  margin-left: auto;
}
.ai-message {
  background: #f1f8e9;
  text-align: left;
}
.system-message {
  background: #fff3e0;
  text-align: center;
  margin: 0 auto 12px auto;
  font-style: italic;
  font-size: 0.9em;
}

.input-area {
  display: flex;
  gap: 8px;
}
#user-input {
  flex: 1;
  padding: 12px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 1em;
}
#send-btn {
  padding: 12px 18px;
  background: #4caf50;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1em;
  cursor: pointer;
}

/* 塔罗抽牌界面 */
.tarot-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(10, 10, 30, 0.95);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding: 20px;
}
.tarot-container {
  background: #1a1a2e;
  border-radius: 20px;
  padding: 20px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  color: #e0d7c6;
  box-shadow: 0 0 40px rgba(150, 100, 255, 0.3);
}
.tarot-header {
  text-align: center;
  margin-bottom: 15px;
}
.tarot-header h2 {
  color: #c9a9ff;
  font-size: 1.3em;
  margin-bottom: 5px;
}
.tarot-header p {
  color: #a99;
  font-size: 0.9em;
  margin: 3px 0;
}
#tarot-progress {
  color: #c9a9ff;
  font-weight: bold;
  font-size: 1em;
}
.tarot-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 15px;
  justify-items: center;
}
@media (min-width: 600px) {
  .tarot-grid {
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
  }
}
.tarot-card-back {
  width: 100%;
  aspect-ratio: 2/3;
  background: linear-gradient(135deg, #2a1a4e, #1a0a3e);
  border: 2px solid #6a4a9e;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5em;
  color: #c9a9ff;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
}
.tarot-card-back::before {
  content: '★';
  position: absolute;
  top: 5px;
  left: 5px;
  font-size: 0.5em;
  opacity: 0.5;
}
.tarot-card-back::after {
  content: '';
  position: absolute;
  top: 10%;
  left: 15%;
  right: 15%;
  bottom: 10%;
  border: 1px solid rgba(201, 169, 255, 0.3);
  border-radius: 4px;
}
.tarot-card-back:hover {
  border-color: #c9a9ff;
  box-shadow: 0 0 15px rgba(150, 100, 255, 0.5);
  transform: translateY(-3px);
}
.tarot-card-back.drawn {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
  border-color: #444;
  background: #111;
}
.tarot-card-back.drawn::before,
.tarot-card-back.drawn::after {
  opacity: 0.1;
}
.tarot-result-area {
  display: none;
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid #3a2a5e;
}
.tarot-result-area h3 {
  color: #c9a9ff;
  font-size: 1em;
  margin-bottom: 10px;
  text-align: center;
}
.tarot-drawn-cards {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 15px;
}
.tarot-drawn-card {
  width: 100px;
  background: linear-gradient(135deg, #2a1a5e, #1a0a4e);
  border: 2px solid #8a6ace;
  border-radius: 10px;
  padding: 12px 8px;
  text-align: center;
  animation: cardReveal 0.6s ease-out;
}
@keyframes cardReveal {
  from { transform: rotateY(90deg); opacity: 0; }
  to { transform: rotateY(0deg); opacity: 1; }
}
.tarot-drawn-card .card-name {
  color: #fff;
  font-weight: bold;
  font-size: 1em;
  margin-bottom: 5px;
}
.tarot-drawn-card .card-meaning {
  color: #c9a9ff;
  font-size: 0.7em;
  line-height: 1.4;
}
.tarot-interpretation {
  background: rgba(201, 169, 255, 0.1);
  border-radius: 10px;
  padding: 15px;
  margin-top: 10px;
  color: #e0d7c6;
  font-size: 0.9em;
  line-height: 1.6;
  display: none;
}
.tarot-interpretation h4 {
  color: #c9a9ff;
  margin-bottom: 8px;
}
.tarot-footer {
  display: flex;
  gap: 10px;
  margin-top: 15px;
  justify-content: center;
}
.tarot-confirm-btn {
  background: linear-gradient(135deg, #7a4ace, #5a2a9e);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 25px;
  font-size: 0.95em;
  cursor: pointer;
  transition: 0.3s;
}
.tarot-confirm-btn:disabled {
  background: #444;
  color: #888;
  cursor: not-allowed;
}
.tarot-confirm-btn:not(:disabled):hover {
  box-shadow: 0 0 20px rgba(150, 100, 255, 0.5);
  transform: translateY(-2px);
}
.tarot-cancel-btn {
  background: transparent;
  color: #a99;
  border: 1px solid #555;
  padding: 12px 20px;
  border-radius: 25px;
  font-size: 0.9em;
  cursor: pointer;
  transition: 0.2s;
}
.tarot-cancel-btn:hover {
  border-color: #999;
  color: #ccc;
}