:root{
  --bg:#0b0f14;
  --panel:#141a22;
  --line:#202835;
  --text:#e8eef7;
  --muted:#9fb0c3;
  --accent:#4ec1ff;
  --accent-2:#9cff6d;
}
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0; 
  background:
    radial-gradient(ellipse 1500px 800px at 20% -20%, rgba(78,193,255,0.05) 0%, transparent 50%),
    radial-gradient(ellipse 1200px 600px at 80% 80%, rgba(156,255,109,0.03) 0%, transparent 50%),
    radial-gradient(1200px 600px at 30% -10%, #162237, #0b0f14);
  color:var(--text); 
  font-family:ui-sans-serif,system-ui,Segoe UI,Apple SD Gothic Neo,Apple Color Emoji,Arial,Helvetica,sans-serif;
}
.app-header, .app-footer{
  display:flex; align-items:center; justify-content:space-between;
  padding:12px 16px; border-bottom:1px solid var(--line);
}
.app-footer{border-top:1px solid var(--line); border-bottom:none; justify-content:center}

/* 헤더 로고 스타일 */
.app-header h1 {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 22px;
  margin: 0;
}

.app-logo {
  width: 32px;
  height: 32px;
  filter: drop-shadow(0 0 8px rgba(78, 193, 255, 0.3));
  transition: filter 0.3s ease;
}

.app-logo:hover {
  filter: drop-shadow(0 0 12px rgba(78, 193, 255, 0.5));
}

.app-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

h1{font-size:22px; margin:0}
.toggles label{margin-right:14px; font-size:14px; color:var(--muted)}
.layout{
  display:grid; grid-template-columns: 1fr 360px; gap:18px; padding:18px; align-items:start;
}
.stage{
  position:relative; display:flex; flex-direction:column; align-items:center; justify-content:center;
  min-height:620px; border:1px solid var(--line); border-radius:12px; 
  background: 
    radial-gradient(ellipse 800px 400px at 50% 20%, rgba(78,193,255,0.03) 0%, transparent 50%),
    radial-gradient(ellipse 600px 300px at 80% 80%, rgba(156,255,109,0.02) 0%, transparent 50%),
    linear-gradient(180deg,#0f1623,#0b0f14);
  overflow:hidden;
  box-shadow: 
    inset 0 0 100px rgba(0,0,0,0.3),
    0 0 50px rgba(78,193,255,0.05);
}
#three-overlay{
  position:absolute; inset:0; pointer-events:none; z-index:1;
  background: radial-gradient(ellipse at center, transparent 0%, rgba(0,0,0,0.1) 70%, rgba(0,0,0,0.3) 100%);
}
.pointer{
  position:absolute; top:38px; width:0; height:0; z-index:2;
  border-left:14px solid transparent; border-right:14px solid transparent; border-bottom:22px solid #fff;
  filter: drop-shadow(0 0 8px rgba(255,255,255,.6));
}
#wheel{
  width: 100%; 
  max-width: 520px; 
  height: auto;
  aspect-ratio: 1/1; 
  border-radius: 50%; 
  background: radial-gradient(circle at center, #0c1421, #060a10);
  border: 3px solid #2c374a; 
  box-shadow: 
    inset 0 0 60px rgba(0,0,0,.6), 
    0 0 120px rgba(78,193,255,.1),
    0 0 200px rgba(78,193,255,.05);
  transform: rotate(0deg);
  cursor: pointer;
  transition: all 0.3s ease;
  /* 모바일에서도 원형 유지 */
  min-width: 0;
  min-height: 0;
  filter: drop-shadow(0 0 20px rgba(78,193,255,0.1));
}
#wheel:hover {
  transform: rotate(0deg) scale(1.02);
  box-shadow: 
    inset 0 0 60px rgba(0,0,0,.6), 
    0 0 120px rgba(78,193,255,.2),
    0 0 200px rgba(78,193,255,.1);
  filter: drop-shadow(0 0 30px rgba(78,193,255,0.2));
}
#wheel:active {
  transform: rotate(0deg) scale(0.98);
}
.result{ 
  margin-top:10px; 
  min-height:28px; 
  color:var(--accent-2); 
  font-weight:600; 
  letter-spacing:0.2px;
  text-shadow: 0 0 20px rgba(156, 255, 109, 0.6);
  animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
  from { text-shadow: 0 0 20px rgba(156, 255, 109, 0.6); }
  to { text-shadow: 0 0 30px rgba(156, 255, 109, 0.8), 0 0 40px rgba(156, 255, 109, 0.4); }
}
.panel{
  position:sticky; top:12px; background:var(--panel); border:1px solid var(--line); border-radius:12px; padding:14px;
}
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.panel h2{margin:0; font-size: 18px;}
.game-description {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  margin: 0 0 16px 0;
  padding: 0;
}
.refresh-btn {
  background: none;
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  outline: none;
}

.refresh-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(78, 193, 255, 0.1), transparent);
  transition: left 0.5s ease;
}

.refresh-btn:hover,
.refresh-btn:focus {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(78, 193, 255, 0.3);
}

.refresh-btn:hover::before,
.refresh-btn:focus::before {
  left: 100%;
}

.refresh-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(78, 193, 255, 0.2);
}

.refresh-btn svg {
  transition: transform 0.3s ease;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

.refresh-btn:hover svg,
.refresh-btn:focus svg {
  transform: rotate(180deg);
}

/* 키보드 포커스 표시 */
.refresh-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.controls{display:flex; gap:8px; margin-bottom:12px; flex-wrap:wrap;}
.controls button{
  border:1px solid #2f3a4c; background:#121a25; color:#cfe2ff; padding:8px 10px; border-radius:8px; cursor:pointer; font-size:13px;
}
.items-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  min-height: 200px;
  padding-bottom: 70px; /* 추가 버튼을 위한 여백 */
}

.add-item-card {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  justify-content: center;
  padding: 8px;
  z-index: 10; /* 다른 아이템들 위에 표시 */
}

.add-item-btn {
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  font-size: 24px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(78, 193, 255, 0.3);
}

.add-item-btn:hover {
  background: var(--accent-2);
  transform: scale(1.1);
  box-shadow: 0 4px 16px rgba(156, 255, 109, 0.4);
}

.add-item-btn:active {
  transform: scale(0.95);
}

.item-card {
  background: #1a2433;
  border-radius: 8px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-left: 5px solid var(--item-color, #ccc);
  transition: background .2s;
  margin-bottom: 8px;
}

.item-card[data-active="false"] {
  opacity: 0.6;
  background: #1a2433a0;
}

.item-card .item-name {
  flex-grow: 1;
  font-weight: 500;
}

.item-card .item-weight {
  font-size: 13px;
  color: var(--muted);
  min-width: 70px;
}

.item-card .item-actions button {
  background: none;
  border: 1px solid transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
}
.item-card .item-actions button:hover {
  background: #2c3a4f;
  color: var(--text);
}

/* Edit Mode Styles */
.item-card.edit-mode {
  background: #233145;
}

.item-card .edit-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.item-card .edit-controls input[type="text"] {
  flex-grow: 1;
  background: #0b0f14;
  border: 1px solid var(--line);
  color: var(--text);
  padding: 8px;
  border-radius: 6px;
  font-size: 14px;
}

.item-card .edit-controls .weight-control {
  display: flex;
  align-items: center;
  gap: 4px;
}

.item-card .edit-controls .weight-control button {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  background: #141a22;
  color: var(--text);
  border-radius: 6px;
  font-size: 16px;
  line-height: 1;
}

.item-card .edit-controls input[type="color"] {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}

.item-card .edit-controls .save-btn {
  background: var(--accent);
  color: var(--bg);
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  font-weight: 600;
}
.hint{color:var(--muted); font-size:12px; margin-top:8px}
.fx-options{margin-top:12px; color:var(--muted)}
.fx-options summary{cursor:pointer}

@media (max-width: 980px){
  .layout{ grid-template-columns: 1fr; }
  .panel{ position:static; }
}

@media (max-width: 640px) {
  .app-header { flex-direction: column; gap: 12px; }
  
  .app-header h1 {
    flex-direction: row;
    gap: 8px;
    text-align: center;
    justify-content: center;
  }
  
  .app-logo {
    width: 28px;
    height: 28px;
  }
  
  h1 { font-size: 20px; }
  .toggles label { font-size: 13px; }
  .layout { padding: 12px; gap: 12px; }
  .stage { min-height: auto; padding: 12px 0; }
  .pointer { top: 12px; }
  #wheel { 
    max-width: calc(100vw - 80px); 
    width: calc(100vw - 80px);
    height: calc(100vw - 80px);
  }
  .app-footer small { font-size: 11px; }
  
  .panel {
    padding: 12px;
  }
  
  .panel-header {
    margin-bottom: 12px;
  }
  
  .panel h2 {
    font-size: 16px;
  }
  
  .refresh-btn {
    width: 32px;
    height: 32px;
  }
  
  .add-item-btn {
    width: 44px;
    height: 44px;
    font-size: 22px;
  }
  
  .items-list {
    min-height: 180px;
  }
  
  .item-card {
    padding: 10px;
    gap: 8px;
  }
  
  .item-card .item-weight {
    min-width: 60px;
    font-size: 12px;
  }
  
  .item-card .edit-controls {
    gap: 6px;
  }
  
  .item-card .edit-controls input[type="text"] {
    font-size: 13px;
    padding: 6px;
  }
  
  .item-card .edit-controls .weight-control button {
    width: 24px;
    height: 24px;
    font-size: 14px;
  }
  
  .item-card .edit-controls input[type="color"] {
    width: 32px;
    height: 32px;
  }
  
  .item-card .edit-controls .save-btn {
    padding: 6px 10px;
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  .layout { padding: 8px; gap: 8px; }
  .stage { padding: 8px 0; }
  #wheel { 
    max-width: calc(100vw - 60px); 
    width: calc(100vw - 60px);
    height: calc(100vw - 60px);
  }
  
  .panel {
    padding: 10px;
  }
  
  .items-list {
    min-height: 160px;
  }
  
  .item-card {
    padding: 8px;
    gap: 6px;
  }
  
  .item-card .item-actions button {
    padding: 3px;
    font-size: 12px;
  }
}
