/* Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: #f2f4f6;
  color: #191f28;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  -webkit-font-smoothing: antialiased;
}

/* App Container */
.app {
  width: 100%;
  max-width: 960px;
  min-height: 100vh;
  background: #f2f4f6;
}

/* Header */
.header {
  background: #ffffff;
  padding: 24px 24px 20px;
  text-align: left;
}

.header h1 {
  color: #191f28;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.6px;
}

/* Tab Navigation */
.tab-nav {
  display: flex;
  gap: 6px;
  padding: 0 24px 16px;
  background: #ffffff;
  position: sticky;
  top: 0;
  z-index: 10;
}

.tab-btn {
  padding: 8px 16px;
  background: #f2f4f6;
  border: none;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  color: #8b95a1;
  cursor: pointer;
  transition: all 0.2s;
}

.tab-btn.active {
  background: #191f28;
  color: #ffffff;
}

/* Tab Content */
.tab-content {
  display: none;
  padding: 16px;
}

.tab-content.active {
  display: block;
}

/* === 메뉴 뽑기 탭 === */
.pick-layout {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.pick-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.history-panel {
  width: 280px;
  flex-shrink: 0;
  background: #ffffff;
  border-radius: 20px;
  padding: 20px;
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.history-title {
  font-size: 16px;
  font-weight: 700;
  color: #191f28;
  letter-spacing: -0.3px;
}

.history-count {
  font-size: 13px;
  color: #8b95a1;
  font-weight: 500;
}

.history-list {
  list-style: none;
  display: flex;
  flex-direction: column;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid #f2f4f6;
}

.history-item:last-child {
  border-bottom: none;
}

.history-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.history-item-menu {
  font-size: 15px;
  font-weight: 600;
  color: #191f28;
  letter-spacing: -0.3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-item-date {
  font-size: 12px;
  color: #8b95a1;
  font-weight: 400;
}

.history-item .btn-delete {
  background: none;
  border: none;
  color: #b0b8c1;
  font-size: 18px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 8px;
  transition: color 0.2s, background 0.2s;
  line-height: 1;
  flex-shrink: 0;
}

.history-item .btn-delete:hover {
  color: #f04452;
  background: rgba(240, 68, 82, 0.06);
}

.history-empty {
  text-align: center;
  padding: 32px 0;
  color: #b0b8c1;
}

.history-empty p {
  font-size: 14px;
  font-weight: 500;
}

@media (max-width: 700px) {
  .app {
    max-width: 480px;
  }

  .pick-layout {
    flex-direction: column;
  }

  .history-panel {
    width: 100%;
  }
}

/* Slot Machine */
.slot-machine {
  width: 100%;
  background: #ffffff;
  border-radius: 20px;
  padding: 32px 24px;
}

.slot-window {
  background: #f2f4f6;
  border: none;
  border-radius: 16px;
  height: 88px;
  overflow: hidden;
  position: relative;
}

.slot-window::before,
.slot-window::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 24px;
  z-index: 2;
  pointer-events: none;
}

.slot-window::before {
  top: 0;
  background: linear-gradient(to bottom, #f2f4f6, transparent);
}

.slot-window::after {
  bottom: 0;
  background: linear-gradient(to top, #f2f4f6, transparent);
}

.slot-list {
  text-align: center;
  transition: transform 0.1s ease-out;
}

.slot-item {
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 800;
  color: #191f28;
  letter-spacing: -0.8px;
}

/* Pick Button */
.btn-pick {
  width: 100%;
  padding: 18px 0;
  background: #3182f6;
  color: #ffffff;
  border: none;
  border-radius: 16px;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  letter-spacing: -0.3px;
}

.btn-pick:hover {
  background: #1b6de8;
}

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

.btn-pick:disabled {
  background: #d1d6db;
  cursor: not-allowed;
  transform: none;
}

/* Result */
.result-area {
  text-align: center;
  background: #ffffff;
  border-radius: 20px;
  padding: 28px 24px;
  width: 100%;
  animation: fadeInUp 0.4s ease-out;
}

.result-label {
  font-size: 14px;
  color: #8b95a1;
  margin-bottom: 8px;
  font-weight: 500;
}

.result-menu {
  font-size: 32px;
  font-weight: 800;
  color: #3182f6;
  letter-spacing: -0.8px;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* === 메뉴 관리 탭 === */
.manage-area {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Add Form */
.add-form {
  display: flex;
  gap: 8px;
  background: #ffffff;
  padding: 16px;
  border-radius: 20px;
}

.add-form input {
  flex: 1;
  padding: 14px 16px;
  border: 1.5px solid #e5e8eb;
  border-radius: 12px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
  background: #f9fafb;
  color: #191f28;
}

.add-form input:focus {
  border-color: #3182f6;
  background: #ffffff;
}

.add-form input::placeholder {
  color: #b0b8c1;
}

.btn-add {
  padding: 14px 20px;
  background: #3182f6;
  color: #ffffff;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}

.btn-add:hover {
  background: #1b6de8;
}

/* Menu Header */
.menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px 0;
}

/* Menu Count */
.menu-count {
  font-size: 13px;
  color: #8b95a1;
  font-weight: 500;
}

/* Delete All Button */
.btn-delete-all {
  padding: 6px 14px;
  background: none;
  border: 1.5px solid #f04452;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: #f04452;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.btn-delete-all:hover {
  background: #f04452;
  color: #ffffff;
}

/* Menu List */
.menu-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border-radius: 20px;
  overflow: hidden;
}

.menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  transition: background 0.15s;
  border-bottom: 1px solid #f2f4f6;
}

.menu-item:last-child {
  border-bottom: none;
}

.menu-item:hover {
  background: #f9fafb;
}

.menu-item-name {
  font-size: 16px;
  font-weight: 600;
  color: #191f28;
  letter-spacing: -0.3px;
}

.btn-delete {
  background: none;
  border: none;
  color: #b0b8c1;
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: color 0.2s, background 0.2s;
  line-height: 1;
}

.btn-delete:hover {
  color: #f04452;
  background: rgba(240, 68, 82, 0.06);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 56px 0;
  color: #b0b8c1;
}

.empty-state p {
  font-size: 15px;
  line-height: 1.7;
  font-weight: 500;
}

/* Download Button */
.btn-download {
  margin-top: 16px;
  padding: 12px 24px;
  background: #191f28;
  color: #ffffff;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  letter-spacing: -0.3px;
}

.btn-download:hover {
  background: #333d4b;
}

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

/* Slot spinning animation */
.slot-list.spinning .slot-item {
  animation: none;
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  background: #191f28;
  color: #ffffff;
  padding: 14px 28px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 600;
  z-index: 100;
  letter-spacing: -0.2px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  animation: toastIn 0.3s ease-out, toastOut 0.3s ease-in 1.7s forwards;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  to {
    opacity: 0;
    transform: translateX(-50%) translateY(12px);
  }
}
