* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    height: 100%;
    overflow: hidden;
    position: fixed;
    width: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #1a1a1a;
    color: #fff;
    padding: clamp(10px, 3vw, 20px);
}

.container {
    max-width: 600px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.header {
    text-align: center;
    margin-bottom: clamp(15px, 4vw, 20px);
    flex-shrink: 0;
}

.header h1 {
    font-size: clamp(1.5rem, 5vw, 2rem);
}

.setup-container {
    background: #333;
    padding: clamp(15px, 4vw, 20px);
    border-radius: 10px;
    margin-bottom: clamp(15px, 4vw, 20px);
    flex-shrink: 0;
}

.setup-container.hidden {
    display: none;
}

.setup-input {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.setup-input label {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.setup-input input {
    padding: 10px;
    border: none;
    border-radius: 5px;
    background: #444;
    color: white;
    font-size: clamp(14px, 4vw, 16px);
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
}

.setup-input input::placeholder {
    color: #888;
}

.game-container {
    display: none;
    height: 100%;
    overflow: hidden;
    flex-direction: column;
}

.game-container.active {
    display: flex;
}

.bullets-display {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(40px, 1fr));
    gap: clamp(8px, 2vw, 10px);
    margin-bottom: clamp(15px, 4vw, 20px);
    flex-shrink: 0;
}

.bullet {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: clamp(14px, 4vw, 16px);
    color: white;
    position: relative;
    cursor: pointer;
}

.bullet-real {
    background: #ff4444;
}

.bullet-blank {
    background: #4444ff;
}

.bullet-unknown {
    background: #666;
}

.counts {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: clamp(8px, 2vw, 10px);
    margin-bottom: clamp(15px, 4vw, 20px);
    flex-shrink: 0;
}

.count-box {
    background: #333;
    padding: clamp(10px, 3vw, 15px);
    border-radius: 10px;
    text-align: center;
}

.count-box h3 {
    font-size: clamp(12px, 3.5vw, 14px);
    margin-bottom: 5px;
    color: #aaa;
}

.count-box .number {
    font-size: clamp(16px, 5vw, 20px);
    font-weight: bold;
}

.count-box .detail {
    font-size: clamp(12px, 3.5vw, 14px);
    color: #aaa;
    margin-top: 5px;
}

.bullet-menu {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #333;
    padding: clamp(15px, 4vw, 20px);
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    z-index: 1000;
}

.bullet-menu.active {
    transform: translateY(0);
}

.bullet-menu-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 10px;
}

.bottom-buttons {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 10px;
}

.btn {
    padding: clamp(15px, 4vw, 20px);
    border: none;
    border-radius: 10px;
    font-size: clamp(14px, 4vw, 18px);
    font-weight: bold;
    color: white;
    cursor: pointer;
    text-transform: uppercase;
    width: 100%;
}

.btn-real {
    background: #ff4444;
}

.btn-blank {
    background: #4444ff;
}

.blank-input {
    border: 2px solid #4444ff !important;
}

.real-input {
    border: 2px solid #ff4444 !important;
}

.btn-cancel {
    background: #666;
}

.probability {
    background: #333;
    padding: clamp(15px, 4vw, 20px);
    border-radius: 10px;
    text-align: center;
    margin-bottom: clamp(15px, 4vw, 20px);
    flex-shrink: 0;
}

.reset {
    display: block;
    width: 100%;
    padding: clamp(12px, 3vw, 15px);
    background: #555;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: clamp(14px, 4vw, 16px);
    cursor: pointer;
    flex-shrink: 0;
    margin-top: auto;
}

.error-message {
    color: #ff4444;
    margin-top: 5px;
    font-size: clamp(12px, 3.5vw, 14px);
}

/* Media query for very small devices */
@media (max-width: 320px) {
    .bullet-menu-buttons {
        grid-template-columns: 1fr;
    }

    .bottom-buttons {
        grid-template-columns: 1fr;
    }

    .setup-input {
        flex-direction: column;
    }
}