* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

    background: radial-gradient(circle at top, #07090f, #02030a);
    color: #e5e7eb;

    min-height: 100vh;

    display: flex;
    justify-content: center;
    align-items: center;
}

.app {
    display: flex;
    gap: 40px;
    padding: 34px 44px;

    background: linear-gradient(180deg, #181c27, #11141d);

    border-radius: 22px;

    box-shadow:
        0 40px 120px rgba(0,0,0,0.8),
        inset 0 0 0 1px rgba(255,255,255,0.04);
}

.app-name {
    position:absolute;
    left: 50%;
    top: 0;
    transform: translateX(-50%) translateY(-40%);
    z-index: 1;
    font-size: 2em;
}

#appGrid {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 20px;

    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
}

/* LEFT TOOL SIDEBAR */

#generalToolbar {
    background: rgba(20, 20, 35, 0.75);
    backdrop-filter: blur(14px);

    border-radius: 18px;
    padding: 16px;

    display: flex;
    flex-direction: column;
    gap: 12px;

    box-shadow:
        0 10px 40px rgba(0,0,0,0.6),
        inset 0 0 0 1px rgba(120,140,255,0.15);
}

/* ---------------- TOOLS ---------------- */
.toolBtn {
    background: linear-gradient(135deg, #2d2d55, #3a2f66);
    color: white;

    border: none;
    border-radius: 12px;

    padding: 10px 14px;
    font-size: 14px;

    display: flex;
    align-items: center;
    gap: 8px;

    cursor: pointer;

    transition: transform .12s ease, box-shadow .12s ease;
}

.toolBtn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(120,100,255,0.45);
}

/* ---------------- ENTRIES ---------------- */

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

th, td {
    padding: 6px;
    border-bottom: 1px solid #2a2f3a;
}

input {
    width: 100%;
    background: #0f1219;
    color: white;
    border: 1px solid #2a2f3a;
    border-radius: 6px;
    padding: 4px;
}

.wheelEntriesToolbar {
    display: flex;
    gap: 6px;
}

#tagFilters {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.tagToggle {
    background: #2a2f3a;
    padding: 4px 8px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 12px;
}

.tagToggle.active {
    background: #6366f1;
}

#addEntryBtn {
    background: linear-gradient(135deg, #2cff9a, #1ccf7b);
    color: black;

    border-radius: 14px;
    font-size: 22px;

    padding: 8px 14px;

    width: 44px;
    height: 44px;

    display: grid;
    place-items: center;

    box-shadow: 0 6px 22px rgba(0,255,150,.45);
}

#addEntryBtn:hover {
    transform: scale(1.08);
}

#textModeArea {
    width: 100%;
    height: 400px;
    font-family: monospace;
    font-size: 16px;
    padding: 10px;
    box-sizing: border-box;
}

.textModeToggle {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
    font-weight: bold;
    font-size: 16px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #dd0000;
  transition: 0.4s;
  border-radius: 34px;
}

.slider::before {
  position: absolute;
  content: "";
  height: 20px; width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}

.switch input:checked + .slider {
  background-color: #4CAF50;
}

.switch input:checked + .slider::before {
  transform: translateX(24px);
}

.slider.round {
  border-radius: 34px;
}

.slider.round::before {
  border-radius: 50%;
}

#shuffleBtn {
    position: absolute;
    right: -1px;
    top: 0px;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    padding: 0px 0px;
    align-content: center;
    justify-content: center;
    background-color: #9021da;
}

.wheelEntriesHeader {
    display: flex;
    align-items: center;
    align-self: center;
    justify-content: space-between;
    margin-bottom: 8px;
    gap: 12px;
}

#wheelEntriesCount {
    font-weight: 500;
    font-size: 0.95rem;
}

/* ---------- Controls ---------- */

.wheelEntries {
    width: 300px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.wheelEntries h1 {
    margin: 0 0 8px;
    font-size: 28px;
}

.wheelEntries-container {
    width: 100%; /* Fixed width of the container */
    height: 450px; /* Fixed height of the container */
    overflow: auto; /* Adds scroll bars if content overflows */
    scrollbar-width: none;
    border: 1px solid #444444;
    border-radius: 10px;
    padding: 5px;
}

.tags-container {
    width: 100%;
    height: 150px;
    scrollbar-width: none;
    overflow: auto;
}

textarea {
    background: #0f1219;
    color: #fff;
    border: 1px solid #2a2f3a;
    border-radius: 10px;
    padding: 12px;
    height: 240px;
    resize: vertical;
    outline: none;
}

textarea:focus {
    border-color: #6366f1;
}

button {
    background: #2a2f3a;
    color: white;
    border: none;
    border-radius: 12px;
    padding: 12px;
    font-size: 16px;
    cursor: pointer;
    transition: 0.15s;
}

button:hover {
    background: #3b4253;
}

button.primary {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
}

button.primary:hover {
    filter: brightness(1.1);
}

/* ---------- Wheel ---------- */

.wheel-wrapper {
    position: relative;

    /* Match canvas size exactly */
    width: 650px;
    height: 650px;

    display: flex;
    align-items: center;
    justify-content: center;
}

canvas {
    display: block;
}

.pointer {
    position: absolute;

    /* vertically centered on wheel */
    top: 50%;
    transform: translateY(-50%) rotate(180deg);

    /* slightly overlapping the rim */
    right: -18px;

    width: 0;
    height: 0;

    /* triangle pointing left */
    border-top: 22px solid transparent;
    border-bottom: 22px solid transparent;
    border-left: 42px solid #ef4444;

    filter: drop-shadow(0 3px 6px rgba(0,0,0,0.7));
    z-index: 1;
}

/* Settings Box*/

.settings-btn {
    position: absolute;
    top: 10px;
    right: 10px;

    z-index: 1;

    width: 42px;
    height: 42px;
    padding: 0;

    border-radius: 50%;
    font-size: 20px;

    background: #1f2333;
}

.settingsBox {
    width: 420px;
    max-width: 90vw;

    display: flex;
    flex-direction: column;
    gap: 18px;
}

.settingsBox label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 16px 0;
}

.settingsActions {
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
}

.rangeGroup {
    display: grid;

    grid-template-columns: 34px 1fr 34px 90px;
    grid-template-rows: auto auto;

    gap: 8px 10px;

    align-items: center;
}

.rangeGroup small {
    grid-column: 1 / -1;
    opacity: .65;
    font-size: 12px;
}

.settingsBox input[type="number"] {
    background: linear-gradient(180deg,#0c1030,#090b1d);

    color: #e5e7eb;

    border: 1px solid #3b3f91;
    border-radius: 10px;

    padding: 8px 10px;

    font-size: 13px;

    outline: none;

    box-shadow:
        inset 0 0 0 1px rgba(99,102,241,.15);
}

.settingsBox input[type="number"]:focus {
    border-color: #a78bfa;
}

#settingsModal {
    position: absolute;

    height: auto;
    max-height: 70vh;

    margin: auto;

    width: 460px;
    max-width: 90vw;

    padding: 26px 28px;

    border-radius: 18px;

    background: linear-gradient(180deg,#1b1f3a,#0f1224);

    box-shadow:
        0 40px 120px rgba(0,0,0,.8),
        inset 0 0 0 1px rgba(139,92,246,.18);

    display: flex;
    flex-direction: column;
    gap: 18px;

    z-index: 200;
}

#settingsModal h2 {
    position: absolute;
    top: 10px;
    font-size: 2em;
}

#settingsModal select,
#settingsModal input[type="number"] {
    background: #0f1224;
    color: #e5e7ff;

    border: 1px solid rgba(139,92,246,.35);
    border-radius: 10px;

    padding: 8px 10px;

    font-size: 14px;
}

#settingsModal input[type="range"] {
    grid-column: 2 / 3;

    appearance: none;
    height: 6px;

    background: linear-gradient(90deg,#3b82f6,#8b5cf6);

    border-radius: 6px;
}

#settingsModal input[type="range"]::-webkit-slider-thumb {
    appearance: none;

    width: 18px;
    height: 18px;

    background: #c7d2fe;

    border-radius: 50%;

    box-shadow: 0 0 0 3px rgba(139,92,246,.35);

    cursor: pointer;
}

.settingsActions {
    display: flex;
    justify-content: flex-end;
}

/* ---------- MODAL ---------- */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.75);

    display: flex;
    justify-content: center;
    align-items: center;

    backdrop-filter: blur(4px);
    z-index: 5;
}

.modal.hidden {
    display: none;
}

.hidden {
    display: none !important;
}

.modalCard {
    background: #121212;
    border-radius: 16px;
    padding: 26px 30px;
    width: 360px;
    box-shadow: 0 25px 70px rgba(0,0,0,.7);
    animation: pop .2s ease;
}

.modalCard h2 {
    margin: 0 0 18px;
    font-size: 1.7rem;
    font-weight: 700;
}

.modalLabel {
    display: block;
    font-size: .9rem;
    opacity: .75;
    margin-bottom: 6px;
}

.modalInput:focus {
    box-shadow: 0 0 0 2px #5aa9ff;
}

.modalActions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 22px;
}

.primaryBtn {
    background: linear-gradient(135deg,#5aa9ff,#7f6cff);
    border: none;
    border-radius: 10px;
    padding: 10px 18px;
    font-weight: 600;
    cursor: pointer;
}

.secondaryBtn {
    background: #222;
    border: 1px solid #333;
    border-radius: 10px;
    padding: 10px 18px;
    cursor: pointer;
}

/* LOAD LIST */

.boardList {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 280px;
    overflow-y: auto;
}

.boardRow {
    background: #1b1b1b;
    padding: 12px 14px;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.boardName {
    font-weight: 600;
}

.boardBtns {
    display: flex;
    gap: 6px;
}

.deleteBtn {
    background: #ff5a5a;
    border: none;
    border-radius: 8px;
    padding: 6px 10px;
    cursor: pointer;
}

.modalInput {
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    border: none;
    background: #1e1e1e;
    color: white;
    font-size: 1rem;
    outline: none;
}

.modalBox {
    background: linear-gradient(180deg,#1c2030,#11141e);
    padding: 36px 50px;
    border-radius: 20px;
    text-align: center;

    box-shadow: 0 40px 120px rgba(0,0,0,.8);
    animation: pop .35s ease;
}

.modal .modalBox.settingsBox {
    width: 460px;
    max-width: 90vw;

    background: linear-gradient(180deg,#1c2038,#111427);

    box-shadow:
        0 40px 120px rgba(0,0,0,.85),
        inset 0 0 0 1px rgba(139,92,246,.15);

    display: flex;
    flex-direction: column;
    align-items: stretch;

    gap: 18px;
}

.modal .settingsBox > * {
    width: 100%;
}


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

#winnerText {
    font-size: 40px;
    font-weight: 700;
    margin: 20px 0;
    color: #a78bfa;
}

#savedBoardsList {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 280px;
    overflow-y: auto;
}

.savedBoardBtn {
    background: #24283a;
    padding: 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: .15s;
}

.savedBoardBtn:hover {
    background: #353b55;
}

.wheelRow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid #ddd;
}

.wheelName {
    flex: 1;
    font-weight: 500;
    font-size: 1rem;
    text-align: center;
}

.wheelBtns {
    display: flex;
    gap: 8px;
}

.wheelBtns button {
    min-width: 60px;
    height: 32px;
    padding: 0 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}


/* ---------- Notification Cards ---------- */

#cardContainer {
    position: fixed;
    top: 18px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;

    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toastCard {
    min-width: 280px;
    padding: 14px 18px 12px;

    background: linear-gradient(180deg,#1c2038,#111427);
    border-radius: 14px;

    box-shadow:
        0 14px 40px rgba(0,0,0,.75),
        inset 0 0 0 1px rgba(139,92,246,.2);

    font-size: 14px;

    animation: slideDown .25s ease;
    position: relative;
    overflow: hidden;
}

.toastBar {
    position: absolute;
    top: 0;
    left: 0;
    height: 4px;
    width: 100%;

    background: linear-gradient(90deg,#6366f1,#8b5cf6);
}

@keyframes slideDown {
    from { transform: translateY(-14px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}