/* Crossword Puzzle - 填字游戏样式 */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  background: #f0f2f5;
  color: #333;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 24px;
}

.container {
  max-width: 1100px;
  width: 100%;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  padding: 32px 40px;
}

/* ========== Header ========== */
header {
  text-align: center;
  margin-bottom: 32px;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-top > div:first-child {
  width: 80px;
}

.header-top h1 {
  flex: 1;
  text-align: center;
  font-size: 28px;
  font-weight: 700;
  color: #1a1a2e;
  letter-spacing: 2px;
}

.btn-login-top {
  padding: 8px 20px;
  border: 2px solid #5b6ef5;
  border-radius: 8px;
  background: transparent;
  color: #5b6ef5;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-login-top:hover {
  background: #5b6ef5;
  color: #fff;
}

.user-area {
  display: flex;
  align-items: center;
  gap: 10px;
  width: auto;
}

.user-name {
  font-size: 14px;
  font-weight: 600;
  color: #333;
  white-space: nowrap;
  cursor: pointer;
}

.user-name:hover {
  color: #5b6ef5;
}

.btn-settings {
  width: 36px;
  height: 36px;
  border: 2px solid #ddd;
  border-radius: 8px;
  background: #fff;
  color: #555;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  line-height: 1;
}

.btn-settings:hover {
  border-color: #5b6ef5;
  color: #5b6ef5;
  background: #f5f6ff;
}

.subtitle {
  margin-top: 6px;
  color: #888;
  font-size: 14px;
}

/* ========== Main Layout ========== */
.main {
  display: flex;
  gap: 40px;
  align-items: flex-start;
}

/* ========== 左侧提示面板 ========== */
.clue-panel {
  width: 220px;
  flex-shrink: 0;
}

.clue-panel h2 {
  font-size: 16px;
  font-weight: 600;
  color: #555;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid #e8e8e8;
}

.clue-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.clue-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f8f9fa;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 2px solid transparent;
  font-size: 14px;
}

.clue-item:hover {
  background: #eef1ff;
}

.clue-item.active {
  background: #e8ecff;
  border-color: #5b6ef5;
}

.clue-item.completed {
  background: #e8f5e9;
  border-color: #66bb6a;
}

.clue-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #5b6ef5;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.clue-item.completed .clue-num {
  background: #66bb6a;
}

.clue-text {
  flex: 1;
  line-height: 1.4;
}

.clue-dir {
  font-size: 11px;
  color: #999;
  margin-left: 4px;
}

/* ========== 图例 ========== */
.legend {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: #888;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
}

.arrow-across {
  background: #e3f2fd;
  color: #1976d2;
}

.arrow-down {
  background: #fce4ec;
  color: #c62828;
}

/* ========== 网格面板 ========== */
.grid-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.grid-wrapper {
  overflow: auto;
  padding: 8px;
  max-width: 100%;
}

/* ========== 填字表格 ========== */
#crosswordGrid {
  border-collapse: collapse;
}

#crosswordGrid td {
  width: 44px;
  height: 44px;
  text-align: center;
  vertical-align: middle;
  position: relative;
  padding: 0;
}

.cell-input {
  width: 100%;
  height: 100%;
  border: none;
  outline: none;
  text-align: center;
  font-size: 22px;
  font-weight: 600;
  text-transform: uppercase;
  background: transparent;
  color: #1a1a2e;
  cursor: default;
  caret-color: #5b6ef5;
}

.cell-input:focus {
  background: #e8ecff;
}

.cell-empty {
  background: #e9ecef;
  border: 1px solid #dee2e6;
}

.cell-active {
  background: #fff;
  border: 2px solid #adb5bd;
  border-radius: 2px;
}

.cell-active.focused {
  border-color: #5b6ef5;
  background: #eef1ff;
  box-shadow: 0 0 0 2px rgba(91, 110, 245, 0.25);
  z-index: 2;
}

.cell-correct {
  background: #e3f2fd;
  border-color: #42a5f5;
}

.cell-wrong {
  background: #ffebee;
  border-color: #ef5350;
}

.cell-revealed {
  color: #888;
  font-style: italic;
}

/* ========== 工具栏 ========== */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: #5b6ef5;
  color: #fff;
}

.btn-primary:hover {
  background: #4a5de0;
}

.btn-secondary {
  background: #ff9800;
  color: #fff;
}

.btn-secondary:hover {
  background: #e68900;
}

.btn-outline {
  background: #fff;
  color: #666;
  border: 2px solid #ddd;
}

.btn-outline:hover {
  border-color: #aaa;
  color: #333;
}

.score {
  margin-left: 8px;
  font-size: 15px;
  font-weight: 600;
  color: #5b6ef5;
}

.score.success {
  color: #4caf50;
}

/* ========== 响应式 ========== */
@media (max-width: 860px) {
  .main {
    flex-direction: column;
    align-items: center;
  }

  .clue-panel {
    width: 100%;
    max-width: 400px;
  }

  .container {
    padding: 20px;
  }
}

/* ========== 登录弹窗 ========== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-box {
  background: #fff;
  border-radius: 16px;
  padding: 36px 40px;
  width: 360px;
  max-width: 90vw;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
  position: relative;
  text-align: center;
}

.modal-box h3 {
  font-size: 20px;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 28px;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  font-size: 24px;
  color: #999;
  cursor: pointer;
  line-height: 1;
}

.modal-close:hover {
  color: #333;
}

.modal-buttons {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.btn-login {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 0;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-login:active {
  transform: scale(0.98);
}

.login-icon {
  font-size: 20px;
}

.btn-login-wechat {
  background: #07c160;
  color: #fff;
}

.btn-login-wechat:hover {
  background: #06ad56;
}

.btn-login-google {
  background: #fff;
  color: #333;
  border: 2px solid #ddd;
}

.btn-login-google:hover {
  border-color: #4285f4;
  color: #4285f4;
}

/* ========== 设置弹窗 ========== */
.settings-box {
  width: 380px;
  text-align: left;
}

.settings-box h3 {
  text-align: center;
}

.settings-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.settings-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #e8ecff;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}

.settings-avatar.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: #5b6ef5;
  font-weight: 700;
}

.settings-info {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: #f8f9fa;
  border-radius: 8px;
}

.settings-label {
  font-size: 13px;
  color: #888;
}

.settings-value {
  font-size: 14px;
  font-weight: 600;
  color: #333;
}

.settings-balance {
  color: #e65100;
}

.btn-logout {
  margin-top: 8px;
  width: 100%;
  color: #e53935;
  border-color: #ffcdd2;
}

.btn-logout:hover {
  background: #ffebee;
  border-color: #e53935;
}
