:root {
  --theme: #e6394f;
  --theme-dark: #b02338;
  --gold: #f7b32b;
  --bg: #fff7f0;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background: linear-gradient(180deg, var(--theme) 0%, var(--theme-dark) 240px, var(--bg) 420px);
  color: #333;
  -webkit-font-smoothing: antialiased;
}
.app { max-width: 480px; margin: 0 auto; padding: 12px 14px 40px; }

.topbar { display: flex; justify-content: space-between; align-items: center; padding: 6px 2px 14px; }
.activity-name { color: #fff; font-size: 18px; font-weight: 700; text-shadow: 0 1px 4px rgba(0,0,0,.2); }
.lang-btn {
  border: 1px solid rgba(255,255,255,.7); background: rgba(255,255,255,.15); color: #fff;
  border-radius: 14px; padding: 4px 14px; font-size: 13px; cursor: pointer;
}

.banner-wrap { margin-bottom: 12px; border-radius: 14px; overflow: hidden; box-shadow: 0 4px 16px rgba(0,0,0,.15); }
.banner-wrap img { width: 100%; display: block; }

.card { background: #fff; border-radius: 16px; padding: 16px; margin-bottom: 14px; box-shadow: 0 4px 18px rgba(0,0,0,.08); }

/* 九宫格 */
.grid-card { padding: 14px; }
.status-bar { text-align: center; color: #999; font-size: 13px; min-height: 20px; margin-bottom: 10px; }
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.cell {
  aspect-ratio: 1;
  background: linear-gradient(180deg, #fff7ec, #ffe9d6);
  border: 2px solid #ffd9b3;
  border-radius: 12px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 4px;
  overflow: hidden;
  transition: transform .12s, box-shadow .12s, border-color .12s;
}
.cell img { max-width: 62%; max-height: 52%; object-fit: contain; }
.cell .fallback-icon { font-size: 30px; line-height: 1; }
.cell .cell-name {
  margin-top: 4px; font-size: 11px; color: #a05a2c; font-weight: 600;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center;
}
.cell.none-cell { background: #f7f7f9; border-color: #e8e8ee; }
.cell.none-cell .cell-name { color: #aaa; }
.cell.lit {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px var(--gold), 0 0 14px rgba(247,179,43,.7);
  transform: scale(1.05);
  background: linear-gradient(180deg, #fff4d6, #ffe9b8);
}
.grid-center { grid-column: 2; grid-row: 2; display: flex; align-items: center; justify-content: center; }
.draw-btn {
  width: 88%; aspect-ratio: 1; border: none; border-radius: 50%;
  background: radial-gradient(circle at 30% 25%, #ff8a5c, var(--theme) 60%, var(--theme-dark));
  color: #fff; font-size: 22px; font-weight: 800; letter-spacing: 1px;
  box-shadow: 0 4px 14px rgba(230,57,79,.45), inset 0 -3px 6px rgba(0,0,0,.18);
  cursor: pointer; transition: transform .1s;
}
.draw-btn:active { transform: scale(.95); }
.draw-btn:disabled { filter: grayscale(.5); opacity: .7; }

/* 抽奖码输入 */
.code-row { display: flex; gap: 8px; margin-top: 12px; }
.code-input {
  flex: 1; border: 2px solid #ffd9b3; border-radius: 10px; padding: 10px 12px;
  font-size: 16px; letter-spacing: 2px; text-transform: uppercase; text-align: center;
  outline: none; min-width: 0; background: #fffdf9;
}
.code-input:focus { border-color: var(--theme); }
.mini-btn {
  border: 1px solid #ddd; background: #f7f7f9; color: #666; border-radius: 10px;
  padding: 0 12px; font-size: 13px; cursor: pointer; white-space: nowrap;
}

/* FB 区块 */
.fb-section { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.fb-status { font-size: 13px; color: #666; }
.fb-btn, .fb-btn-a {
  border: none; border-radius: 10px; padding: 9px 14px; font-size: 13px; font-weight: 700;
  background: #1877f2; color: #fff; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.fb-btn.gray { background: #999; }

/* 规则 */
.rules-card summary { font-weight: 700; color: #a05a2c; cursor: pointer; font-size: 14px; }
.rules-body { margin-top: 10px; font-size: 13px; color: #666; line-height: 1.8; white-space: pre-wrap; word-break: break-word; }

.privacy-note { font-size: 11px; color: #b99; text-align: center; padding: 4px 10px; line-height: 1.6; }

/* 弹窗 */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-mask { position: absolute; inset: 0; background: rgba(0,0,0,.6); }
.modal-box {
  position: relative; background: #fff; border-radius: 18px; width: 100%; max-width: 400px;
  max-height: 86vh; overflow-y: auto; padding: 26px 20px 20px; text-align: center;
  animation: pop .22s ease-out;
}
@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-close {
  position: absolute; top: 10px; right: 12px; border: none; background: none;
  font-size: 16px; color: #bbb; cursor: pointer; padding: 6px;
}
.result-image img { width: 130px; height: 130px; object-fit: contain; margin: 0 auto 8px; display: block; }
.result-title { font-size: 20px; font-weight: 800; color: var(--theme); margin-bottom: 6px; }
.result-body { font-size: 14px; color: #666; line-height: 1.6; margin-bottom: 12px; word-break: break-word; }
.gift-box {
  background: linear-gradient(180deg, #fff8ec, #ffefdc); border: 2px dashed var(--gold);
  border-radius: 12px; padding: 14px; margin-bottom: 14px;
}
.gift-box code { display: block; font-size: 20px; font-weight: 800; letter-spacing: 1.5px; color: #7a4a00; word-break: break-all; user-select: all; }
.copy-btn {
  margin-top: 10px; border: none; border-radius: 10px; padding: 10px 24px;
  background: var(--gold); color: #5a3a00; font-size: 14px; font-weight: 800; cursor: pointer;
}
.physical-form { text-align: left; margin-bottom: 14px; }
.physical-form .f-item { margin-bottom: 12px; }
.physical-form label { display: block; font-size: 13px; color: #555; margin-bottom: 4px; }
.physical-form label .req { color: var(--theme); }
.physical-form input, .physical-form textarea {
  width: 100%; border: 1.5px solid #e5d9cc; border-radius: 10px; padding: 9px 12px;
  font-size: 14px; outline: none; background: #fffdf9;
}
.physical-form textarea { height: 68px; resize: vertical; }
.physical-form input:focus, .physical-form textarea:focus { border-color: var(--theme); }
.modal-ok {
  border: none; border-radius: 12px; padding: 12px 0; width: 100%;
  background: linear-gradient(90deg, var(--theme), #ff7a50); color: #fff;
  font-size: 16px; font-weight: 800; cursor: pointer;
}
.modal-ok.gray { background: #ccc; }

.toast {
  position: fixed; left: 50%; bottom: 12vh; transform: translateX(-50%);
  background: rgba(0,0,0,.78); color: #fff; font-size: 14px;
  padding: 10px 18px; border-radius: 20px; z-index: 99; max-width: 80vw;
}

[hidden] { display: none !important; }
