body {
    margin: 0;
    min-height: 100vh;
    background-color: #f4f4f4;
    /* gray grid */
    background-image:
        linear-gradient(to right, #e5e5e5 1px, transparent 1px),
        linear-gradient(to bottom, #e5e5e5 1px, transparent 1px);
    background-size: 20px 20px; /* Dimensions of the square */
    font: 14px system-ui, sans-serif;
    transition: background-color 0.5s ease, color 0.5s ease;
}

body.dark {
  background-color: #0f1b2c;
  background-image:
        linear-gradient(to right, #3d3a48 1px, transparent 1px),
        linear-gradient(to bottom, #3d3a48 1px, transparent 1px);
  color: #fff7cb;
}

@media (prefers-reduced-motion: reduce) {
    body,
    .timer {
        transition: none;
    }
}

#timer-grid {
    display: grid;
    grid-template-columns: repeat(var(--timer-grid-columns), calc(var(--timer-width) * 1px));
    grid-auto-rows: minmax(100px, auto);
    min-width: calc(var(--timer-grid-columns) * var(--timer-width) * 1px);
    gap: 8px;
    padding: 8px;
    align-items: start;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    padding: 8px;
}

.button {
    background-color: #999999;
    border: 1px solid #000000;
    color: white;
    padding: 4px 8px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 16px;
    margin: 0;
    cursor: pointer;
    border-radius: 4px;
    box-shadow:
        0px 1px 1px rgba(000,000,000,0.5),
        inset 1px 2px 0px rgba(255,255,255,0.4);
    text-shadow:
        1px 1px 2px rgba(000,000,000,0.7),
        0px 1px 0px rgba(255,255,255,0.4);
    min-height: 32px;
    z-index: 99;
}

#clearAll {
    position: relative;
    overflow: hidden;
}

#clearAll::after {
    content: attr(data-hover);
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

/* Hide original text and show new text on hover */
#clearAll:hover {
    color: transparent;
}

#clearAll:hover::after {
    opacity: 1;
    color: white;
}

#theme-toggle {
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 99;
}

.bottom_button {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 99;
}

a.bottom_button,
a.bottom_button:visited {
  color: #667fa1; /*#1d3557*/
}

/* Hover and active states */
a.bottom_button:hover,
a.bottom_button:active {
  color: #ffa629;
}

.timer {
    min-width: 0;
    padding: 8px;
    padding-top: 10px;
    border-radius: 6px;
    cursor: grab;
    user-select: none;
    touch-action: none;
    box-shadow:
        0px 1px 1px rgba(000,000,000,0.5),
        inset 1px 2px 0px rgba(255,255,255,0.4);
    text-shadow:
        1px 1px 2px rgba(000,000,000,0.7),
        0px 1px 0px rgba(255,255,255,0.4);
    transition: background-color 0.5s ease, color 0.5s ease;
}

.timer.dragging {
    cursor: grabbing;
    opacity: .95;
    z-index: 1;
}

.name {
    font-weight: 600;
    outline: none;
    cursor: text;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.name:focus {
    text-overflow: clip;
    background: rgba(255,255,255,.25);
}

.time {
    font: 24px ui-monospace, monospace;
    margin: 4px 0;
    cursor: pointer;
}

.row {
    display: flex;
    gap: 4px;
    align-items: center;
}

.toggle, .reset, .copy, .del {
    padding: 2px;
    min-width: 24px;
    background-color: #999999;
}

button {
    cursor: pointer;
}

#copy-message {
    position: fixed;
    z-index: 10;
    padding: 5px 8px;
    border-radius: 4px;
    background: rgba(25, 25, 25, .9);
    color: #fff;
    font-size: 12px;
    line-height: 1.2;
    opacity: 0;
    pointer-events: none;
    transform: translateY(3px);
    transition: opacity .15s ease, transform .15s ease;
}

#copy-message.visible {
    opacity: 1;
    transform: translateY(0);
}

input[type=color] {
    width: 26px;
    height: 24px;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;

    /* Outer border */
    border: 1px solid #000000;
    cursor: pointer;
}

/* Remove inner padding in WebKit/Blink (Chrome, Edge, Safari) */
input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

/* Inner swatch border (Chrome, Edge, Safari) */
input[type="color"]::-webkit-color-swatch {
  border: none;
}

/* Inner swatch border (Firefox) */
input[type="color"]::-moz-color-swatch {
  border: none;
}

.del {
    background-color: red;
    color: white;
}
