* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-color: #0a0a0a;
    --text-color: #ffffff;
    --accent-color: #333;
    --input-bg: #1a1a1a;
    --hover-color: #2a2a2a;
}

html, body {
    height: 100%;
    height: 100dvh;
    overflow: hidden;
}

/* Fullscreen mode */
body.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
}

.view {
    height: 100%;
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
    transition: opacity 0.2s ease;
}

.view.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Edit View */
#edit-view {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 500px;
}

h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 30px;
    text-align: center;
}

.input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
}

#phrase-input {
    flex: 1;
    padding: 15px 20px;
    font-size: 1rem;
    border: none;
    border-radius: 8px;
    background: var(--input-bg);
    color: var(--text-color);
    outline: none;
}

#phrase-input::placeholder {
    color: #666;
}

#phrase-input:focus {
    box-shadow: 0 0 0 2px #444;
}

#add-btn {
    padding: 15px 30px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    background: var(--text-color);
    color: var(--bg-color);
    cursor: pointer;
    transition: transform 0.1s;
}

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

#phrase-list {
    list-style: none;
    max-height: 50vh;
    overflow-y: auto;
}

.phrase-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    margin-bottom: 8px;
    background: var(--input-bg);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.1s;
}

.phrase-item:hover {
    background: var(--hover-color);
}

.phrase-text {
    flex: 1;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 10px;
}

.delete-btn {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #666;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.1s, background 0.1s;
}

.delete-btn:hover {
    background: #ff4444;
    color: white;
}

/* Display View */
#display-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    touch-action: pan-x;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.phrase-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    width: 100%;
}

#display-phrase {
    font-size: 10vw;
    font-weight: 700;
    text-align: center;
    line-height: 1.2;
    word-wrap: break-word;
    max-width: 100%;
}

#dots-container {
    display: flex;
    gap: 8px;
    padding: 20px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #444;
    transition: background 0.2s;
}

.dot.active {
    background: var(--text-color);
}

.hint {
    font-size: 0.8rem;
    color: #444;
    padding-bottom: 30px;
    padding-bottom: max(30px, env(safe-area-inset-bottom));
}

/* Force landscape orientation on mobile for display view */
@media (max-width: 900px) and (orientation: portrait) {
    #display-view:not(.hidden) {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vh;
        height: 100vw;
        transform: rotate(90deg);
        transform-origin: top left;
        translate: 100vw 0;
    }

    #display-view:not(.hidden) .phrase-container {
        padding: 20px;
    }

    #display-view:not(.hidden) #display-phrase {
        font-size: 15vh;
    }

    #display-view:not(.hidden) .hint {
        padding-bottom: 20px;
    }
}

/* Responsive */
@media (max-width: 600px) {
    h1 {
        font-size: 1.5rem;
    }

    .input-group {
        flex-direction: column;
    }

    #add-btn {
        width: 100%;
    }

    #display-phrase {
        font-size: 12vw;
    }

    .hint {
        font-size: 0.7rem;
    }
}

/* Scrollbar */
#phrase-list::-webkit-scrollbar {
    width: 6px;
}

#phrase-list::-webkit-scrollbar-track {
    background: transparent;
}

#phrase-list::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 3px;
}
