:root{
  --bg:#fff8ef;
  --card:#ffffff;
  --text:#3d2b24;
  --muted:#8a756d;
  --primary:#ff7a59;
  --primary2:#ff9a62;
  --line:#f0dfd4;
  --dark:#4d382f;
  --shadow:0 12px 35px rgba(101,68,47,.12);
}

*{box-sizing:border-box}

html,body{
  margin:0;
  min-height:100%;
}

body{
  font-family:"Noto Sans TC","PingFang TC","Microsoft JhengHei",sans-serif;
  color:var(--text);
  background:
    radial-gradient(circle at 12% 8%,#ffe7c9 0,transparent 22%),
    radial-gradient(circle at 92% 82%,#ffd8d0 0,transparent 20%),
    var(--bg);
}

button,input{font:inherit}
button{cursor:pointer}

.screen{
  display:none;
  min-height:100vh;
}

.screen.active{
  display:flex;
}

#welcome{
  align-items:center;
  justify-content:center;
  padding:24px;
}

.welcome-card{
  width:min(560px,100%);
  text-align:center;
  background:rgba(255,255,255,.88);
  border:1px solid rgba(255,255,255,.95);
  box-shadow:var(--shadow);
  border-radius:30px;
  padding:48px 28px;
}

.emoji{
  font-size:74px;
  line-height:1;
}

h1{
  margin:20px 0 12px;
  font-size:clamp(30px,6vw,44px);
}

.subtitle{
  color:var(--muted);
  font-size:17px;
  line-height:1.8;
  margin-bottom:28px;
}

.primary{
  border:0;
  border-radius:999px;
  padding:14px 30px;
  color:#fff;
  background:linear-gradient(135deg,var(--primary),var(--primary2));
  box-shadow:0 8px 20px rgba(255,122,89,.28);
  font-weight:800;
}

.primary:hover{
  transform:translateY(-1px);
}

.primary:disabled{
  opacity:.55;
  cursor:not-allowed;
  transform:none;
}

.big{
  min-width:190px;
  font-size:18px;
}

.ghost{
  border:1px solid var(--line);
  background:#fff;
  color:var(--text);
  border-radius:12px;
  padding:10px 14px;
}

.dark{
  border:0;
  background:var(--dark);
  color:#fff;
  border-radius:12px;
  padding:0 16px;
  font-weight:800;
}

#app{
  flex-direction:column;
  padding:22px;
}

.topbar{
  width:min(1120px,100%);
  margin:0 auto 18px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}

.brand{
  font-size:22px;
  font-weight:900;
}

.layout{
  width:min(1120px,100%);
  margin:auto;
  display:grid;
  grid-template-columns:minmax(360px,1.15fr) minmax(280px,.85fr);
  gap:24px;
  align-items:start;
}

.card{
  background:rgba(255,255,255,.92);
  border:1px solid rgba(255,255,255,.96);
  border-radius:24px;
  box-shadow:var(--shadow);
  padding:22px;
}

.wheel-wrap{
  display:flex;
  align-items:center;
  justify-content:center;
  position:relative;
  padding:12px;
}

.pointer{
  position:absolute;
  z-index:5;
  top:0;
  left:50%;
  transform:translateX(-50%);
  width:0;
  height:0;
  border-left:18px solid transparent;
  border-right:18px solid transparent;
  border-top:34px solid var(--dark);
  filter:drop-shadow(0 3px 2px rgba(0,0,0,.15));
}

canvas{
  width:min(520px,100%);
  height:auto;
  aspect-ratio:1;
  display:block;
}

.spin-row{
  text-align:center;
  margin-top:8px;
}

.hint{
  font-size:13px;
  color:var(--muted);
  margin-top:10px;
}

.options-card h2{
  margin:0 0 14px;
  font-size:20px;
}

.input-row{
  display:flex;
  gap:8px;
}

.input-row input{
  flex:1;
  min-width:0;
  border:1px solid var(--line);
  border-radius:12px;
  padding:11px 13px;
  outline:none;
}

.input-row input:focus{
  border-color:#ffab93;
  box-shadow:0 0 0 3px #fff0eb;
}

.chips{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin:14px 0;
}

.chip{
  border:1px solid var(--line);
  background:#fff7f2;
  border-radius:999px;
  padding:7px 11px;
  font-size:13px;
}

.list{
  display:flex;
  flex-direction:column;
  gap:8px;
  max-height:330px;
  overflow:auto;
  padding-right:3px;
}

.item{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  border:1px solid var(--line);
  background:#fff;
  border-radius:13px;
  padding:10px 12px;
}

.item span{
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.del{
  border:0;
  background:#fff0ec;
  color:#d44a30;
  border-radius:9px;
  width:30px;
  height:30px;
}

.actions{
  display:flex;
  gap:8px;
  margin-top:14px;
}

.actions button{
  flex:1;
}

.modal{
  position:fixed;
  inset:0;
  display:none;
  align-items:center;
  justify-content:center;
  padding:24px;
  background:rgba(48,31,24,.42);
  z-index:50;
}

.modal.show{
  display:flex;
}

.modal-card{
  width:min(420px,100%);
  background:#fff;
  border-radius:26px;
  padding:30px;
  text-align:center;
  box-shadow:0 24px 70px rgba(0,0,0,.24);
  animation:pop .28s ease-out;
}

@keyframes pop{
  from{transform:scale(.86);opacity:0}
  to{transform:scale(1);opacity:1}
}

.result-emoji{
  font-size:58px;
}

.result-label{
  color:var(--muted);
  margin-top:8px;
}

.result-text{
  font-size:34px;
  font-weight:950;
  margin:10px 0 22px;
  word-break:break-word;
}

.modal-actions{
  display:flex;
  gap:10px;
}

.modal-actions button{
  flex:1;
}

@media(max-width:820px){
  #app{padding:14px}
  .layout{grid-template-columns:1fr}
  .topbar{margin-bottom:12px}
  .wheel-card{order:1}
  .options-card{order:2}
  .card{padding:16px}
}
