* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    background: white;
    border-radius: 15px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 30px;
    max-width: 1000px;
    width: 100%;
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
    font-size: 2.5em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.game-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    align-items: start;
}

@media (max-width: 768px) {
    .game-wrapper {
        grid-template-columns: 1fr;
    }
}

/* Dice Section */
.dice-section {
    background: #f8f9fa;
    padding: 20px;
    border: 1px solid lightgray;
    border-radius: 10px;
    text-align: center;
}

.dice-section h2 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.3em;
}

.dice-container {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.die {
    width: 70px;
    height: 70px;
      background: linear-gradient(180deg, #ffffff 0%, #f3f6ff 60%, #e9eefb 100%);
    border: 2px solid #667eea;
    border-radius: 8px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    align-items: center;
    justify-items: center;
    padding: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 0 auto;
    gap: 1px;
}

.pip {
    width: 14px;
    height: 14px;
    background: #667eea;
    border-radius: 50%;
}

.die.locked .pip {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  /* darker teal center with a soft gloss so the dot remains visible on the pale locked face */
  background: #22c1a5 100%;
  
}

.die:hover:not(.locked) {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.die.locked {
  /* spiced-up locked background (teal glass) */
  background: linear-gradient(180deg, #e9fbf8 0%, #dff7f1 100%);
  border-color: rgba(14,162,127,0.22);
  box-shadow: inset 0 4px 12px rgba(6,30,25,0.06), 0 6px 18px rgba(2,6,23,0.06);
  color: #053b33;
  
  opacity: 1;
}

/* Controls */
.controls {
    display: flex;
    gap: 10px;
    flex-direction: column;
}

button {
    padding: 12px 24px;
    font-size: 1em;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-roll {
    background: #667eea;
    color: white;
}

.btn-roll:hover:not(:disabled) {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-roll:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.5;
}

.btn-reset {
    background: #e74c3c;
    color: white;
    width: 100%;
    padding: 15px;
    font-size: 1.1em;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 20px;
}

.btn-reset:hover {
    background: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(231, 76, 60, 0.4);
}

.info {
    background: #e8f4f8;
    padding: 15px;
    border-radius: 8px;
    margin-top: 20px;
    color: #333;
}

.info p {
    margin: 5px 0;
}

.rolls-left {
    font-weight: bold;
    color: #667eea;
}

/* Scorecard */
.scorecard {
    background: #fef9e7;
    padding: 0;
    border-radius: 0;
    border: 3px solid #333;
    overflow: hidden;
    font-family: 'Courier New', monospace;
}

/* Tabs for two players */
.scorecard-wrapper {
    border: 1px solid lightgray;
    border-radius: 10px;
    overflow: hidden;
    background: #fef9e7;
}

.tabs {
    display: flex;
}

.tab-btn {
    flex: 1;
    padding: 3px 6px;
    background: #ddd;
    border: none;
    cursor: pointer;
    font-weight: bold;
    border-radius: 0px;
}

.tab-btn.active {
    background: #333;
    color: white;
}

.panels {
    padding: 4px;
}

.scorecard-panel {
    display: block;
}

.panel-title {
    background: #333;
    color: white;
    padding: 1px 8px;
    margin: 0 0 2px 0;
    font-size: 1.2em;
}

.scorecard h2 {
    color: white;
    background: #333;
    margin: 0;
    padding: 12px;
    font-size: 1em;
    text-align: center;
    border-bottom: 2px solid #333;
}

.score-section {
    margin: 0;
    border-bottom: 2px solid #333;
}

.score-section:last-of-type {
    border-bottom: none;
}

.score-section h3 {
    background: #333;
    color: white;
    padding: 3px 12px;
    border-radius: 0;
    margin: 0;
    font-size: 0.9em;
    font-weight: bold;
    text-transform: uppercase;
    border-bottom: 1px solid #999;
}

.score-row {
    display: grid;
    grid-template-columns: 1fr 60px 40px;
    padding: 2px 8px;
    border-bottom: 1px solid #999;
    align-items: center;
    gap: 3px;
    background: #fef9e7;
}

.score-row:last-child {
    border-bottom: none;
}

.score-row label {
    font-weight: 600;
    color: #333;
    font-size: 1.2em;
}

.score-row button {
    background: #27ae60;
    color: white;
    padding: 1px 1px;
    font-size: 0.75em;
    border-radius: 3px;
    font-weight: bold;
}

.score-row button:hover:not(:disabled) {
    background: #229954;
}

.score-row button:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    opacity: 0.3;
}

.score-value {
    font-weight: bold;
    color: #333;
    text-align: center;
    border: 1px solid #333;
    padding: 0px;
    background: white;
    min-width: 35px;
}

.score-row.used button {
    display: none;
}

.score-row.used .score-value {
    border: 2px solid #27ae60;
    background: #e8f8f5;
}

.total-section {
    background: #333;
    color: white;
    padding: 12px;
    border-radius: 0;
    margin-top: 0;
    font-size: 1.1em;
    font-weight: bold;
    text-align: center;
    border-top: 2px solid #333;
}

.total-section p {
    margin: 3px 0;
}

.calculation {
    font-size: 0.85em;
    color: #ccc;
    margin-top: 5px;
}

/* Modals */
.game-over {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.game-over.show {
    display: flex;
}

.start-menu {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    
}

.start-menu.hidden {
    display: none;
}

.start-menu-content {
    background: white;
    padding: 50px 40px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
    max-width: 400px;
    width: 90%;
}

.start-menu-content h1 {
    margin-bottom: 30px;
    color: #333;
}

.start-menu-content p {
    color: #666;
    margin-bottom: 25px;
    font-size: 1.1em;
}

.start-menu-content input {
    width: 100%;
    padding: 12px;
    font-size: 1em;
    border: 2px solid #667eea;
    border-radius: 8px;
    margin-bottom: 25px;
    box-sizing: border-box;
}

.start-menu-content input:focus {
    outline: none;
    border-color: #5568d3;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.btn-join {
    background: #667eea;
    color: white;
    width: 100%;
    padding: 15px;
    font-size: 1.1em;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-join:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.game-over-content {
    background: white;
    padding: 40px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.game-over-content h2 {
    font-size: 2em;
    color: #667eea;
    margin-bottom: 20px;
}

.game-over-content p {
    font-size: 1.3em;
    color: #333;
    margin-bottom: 20px;
}

.game-over-content button {
    background: #667eea;
    color: white;
    padding: 15px 30px;
    font-size: 1.1em;
}

.game-over-content button:hover {
    background: #5568d3;
}